net: l2: ppp: drop ppp_context's is_network_up
There is already a variable 'network_protos_up', which stores number of network protocols being up. Additionally each network protocol has its own state represented by is_ip{,v6}cp_up. Use the latter in FSM up() and down() callbacks. This fixes a case when both IPCP and IPv6CP protocols are going down. When using ctx->is_network_up only one of them (the first) was deinitialized correctly, second stayed always up (at least partially, e.g. not calling ppp_network_down()). Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
This commit is contained in:
parent
ab1a306a84
commit
03c774e58c
3 changed files with 2 additions and 9 deletions
|
@ -512,9 +512,6 @@ struct ppp_context {
|
|||
/** PPP enable pending */
|
||||
uint16_t is_enable_done : 1;
|
||||
|
||||
/** Network status (up / down) */
|
||||
uint16_t is_network_up : 1;
|
||||
|
||||
/** IPCP status (up / down) */
|
||||
uint16_t is_ipcp_up : 1;
|
||||
|
||||
|
|
|
@ -470,7 +470,6 @@ static void ipcp_up(struct ppp_fsm *fsm)
|
|||
NET_DBG("PPP up with address %s", log_strdup(addr_str));
|
||||
ppp_network_up(ctx, PPP_IP);
|
||||
|
||||
ctx->is_network_up = true;
|
||||
ctx->is_ipcp_up = true;
|
||||
|
||||
NET_DBG("[%s/%p] Current state %s (%d)", fsm->name, fsm,
|
||||
|
@ -482,11 +481,10 @@ static void ipcp_down(struct ppp_fsm *fsm)
|
|||
struct ppp_context *ctx = CONTAINER_OF(fsm, struct ppp_context,
|
||||
ipcp.fsm);
|
||||
|
||||
if (!ctx->is_network_up) {
|
||||
if (!ctx->is_ipcp_up) {
|
||||
return;
|
||||
}
|
||||
|
||||
ctx->is_network_up = false;
|
||||
ctx->is_ipcp_up = false;
|
||||
|
||||
ppp_network_down(ctx, PPP_IP);
|
||||
|
|
|
@ -417,7 +417,6 @@ static void ipv6cp_up(struct ppp_fsm *fsm)
|
|||
|
||||
ppp_network_up(ctx, PPP_IPV6);
|
||||
|
||||
ctx->is_network_up = true;
|
||||
ctx->is_ipv6cp_up = true;
|
||||
|
||||
NET_DBG("[%s/%p] Current state %s (%d)", fsm->name, fsm,
|
||||
|
@ -469,11 +468,10 @@ static void ipv6cp_down(struct ppp_fsm *fsm)
|
|||
struct in6_addr peer_addr;
|
||||
int ret;
|
||||
|
||||
if (!ctx->is_network_up) {
|
||||
if (!ctx->is_ipv6cp_up) {
|
||||
return;
|
||||
}
|
||||
|
||||
ctx->is_network_up = false;
|
||||
ctx->is_ipv6cp_up = false;
|
||||
|
||||
ppp_network_down(ctx, PPP_IPV6);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue