From 3ca5184998503dedec06adfad98ab604d137f5ff Mon Sep 17 00:00:00 2001 From: Sylvain Rochet Date: Sat, 7 Mar 2015 22:24:27 +0100 Subject: [PATCH] PPP, CORE, separated administrative status from link status of PPP netif This was confusing, recent lwIP changes fixed the meaning as well as how it is used everywhere, making the administrative status a user-only controlled flag. Now that it's clear, updated PPP to follow lwIP core change. Using netif_set_link_{up,down} instead of netif_set_{up,down} when PPP reaches/leaves running state. PPP interface is now set to administratively UP when created with link state down. --- src/netif/ppp/ppp.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/netif/ppp/ppp.c b/src/netif/ppp/ppp.c index 62451ba1..8b58f352 100644 --- a/src/netif/ppp/ppp.c +++ b/src/netif/ppp/ppp.c @@ -414,7 +414,7 @@ static err_t ppp_netif_init_cb(struct netif *netif) { #if PPP_IPV6_SUPPORT netif->output_ip6 = ppp_netif_output_ip6; #endif /* PPP_IPV6_SUPPORT */ - netif->flags = NETIF_FLAG_LINK_UP; + netif->flags = NETIF_FLAG_UP; #if LWIP_NETIF_HOSTNAME /* @todo: Initialize interface hostname */ /* netif_set_hostname(netif, "lwip"); */ @@ -957,7 +957,7 @@ int sifup(ppp_pcb *pcb) { pcb->if4_up = 1; pcb->err_code = PPPERR_NONE; - netif_set_up(pcb->netif); + netif_set_link_up(pcb->netif); PPPDEBUG(LOG_DEBUG, ("sifup: unit %d: err_code=%d\n", pcb->netif->num, pcb->err_code)); pcb->link_status_cb(pcb, pcb->err_code, pcb->ctx_cb); @@ -979,8 +979,8 @@ int sifdown(ppp_pcb *pcb) { && !pcb->if6_up #endif /* PPP_IPV6_SUPPORT */ ) { - /* make sure the netif status callback is called */ - netif_set_down(pcb->netif); + /* make sure the netif link callback is called */ + netif_set_link_down(pcb->netif); } PPPDEBUG(LOG_DEBUG, ("sifdown: unit %d: err_code=%d\n", pcb->netif->num, pcb->err_code)); return 1; @@ -1029,7 +1029,7 @@ int sif6up(ppp_pcb *pcb) { pcb->if6_up = 1; pcb->err_code = PPPERR_NONE; - netif_set_up(pcb->netif); + netif_set_link_up(pcb->netif); PPPDEBUG(LOG_DEBUG, ("sif6up: unit %d: err_code=%d\n", pcb->netif->num, pcb->err_code)); pcb->link_status_cb(pcb, pcb->err_code, pcb->ctx_cb); @@ -1051,8 +1051,8 @@ int sif6down(ppp_pcb *pcb) { && !pcb->if4_up #endif /* PPP_IPV4_SUPPORT */ ) { - /* make sure the netif status callback is called */ - netif_set_down(pcb->netif); + /* make sure the netif link callback is called */ + netif_set_link_down(pcb->netif); } PPPDEBUG(LOG_DEBUG, ("sif6down: unit %d: err_code=%d\n", pcb->netif->num, pcb->err_code)); return 1;