Skip to content

Commit 942aec5

Browse files
author
Mika Leppänen
committed
Corrected lwip to enable disabling of ipcp and ipv6cp protocols
1 parent dd346ec commit 942aec5

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

features/FEATURE_LWIP/lwip-interface/lwip/src/include/netif/ppp/ppp.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,10 @@ struct ppp_pcb_s {
336336
unsigned int ipv6cp_is_up :1; /* have called ip6cp_up() */
337337
unsigned int if6_up :1; /* True when the IPv6 interface is up. */
338338
#endif /* PPP_IPV6_SUPPORT */
339+
#if PPP_IPV4_SUPPORT && PPP_IPV6_SUPPORT
340+
unsigned int ipcp_disabled :1; /* disable ipcp */
341+
unsigned int ipv6cp_disabled :1; /* disable ipv6cp */
342+
#endif
339343
unsigned int lcp_echo_timer_running :1; /* set if a timer is running */
340344
#if VJ_SUPPORT
341345
unsigned int vj_enabled :1; /* Flag indicating VJ compression enabled. */

features/FEATURE_LWIP/lwip-interface/lwip/src/netif/ppp/lwip_ipcp.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,11 @@ static void ipcp_close(ppp_pcb *pcb, const char *reason) {
671671
* ipcp_lowerup - The lower layer is up.
672672
*/
673673
static void ipcp_lowerup(ppp_pcb *pcb) {
674+
#if PPP_IPV4_SUPPORT && PPP_IPV6_SUPPORT
675+
if (pcb->ipcp_disabled) {
676+
return;
677+
}
678+
#endif
674679
fsm *f = &pcb->ipcp_fsm;
675680
fsm_lowerup(f);
676681
}

features/FEATURE_LWIP/lwip-interface/lwip/src/netif/ppp/lwip_ipv6cp.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,11 @@ static void ipv6cp_close(ppp_pcb *pcb, const char *reason) {
473473
* ipv6cp_lowerup - The lower layer is up.
474474
*/
475475
static void ipv6cp_lowerup(ppp_pcb *pcb) {
476+
#if PPP_IPV4_SUPPORT && PPP_IPV6_SUPPORT
477+
if (pcb->ipv6cp_disabled) {
478+
return;
479+
}
480+
#endif
476481
fsm_lowerup(&pcb->ipv6cp_fsm);
477482
}
478483

features/FEATURE_LWIP/lwip-interface/ppp_lwip.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,11 +335,13 @@ extern "C" nsapi_error_t ppp_lwip_if_init(struct netif *netif, const nsapi_ip_st
335335
}
336336
#endif
337337

338+
#if LWIP_IPV4 && LWIP_IPV6
338339
if (stack == IPV4_STACK) {
339340
my_ppp_pcb->ipv6cp_disabled = true;
340341
} else if (stack == IPV6_STACK) {
341342
my_ppp_pcb->ipcp_disabled = true;
342343
}
344+
#endif
343345

344346
return NSAPI_ERROR_OK;
345347
}

0 commit comments

Comments
 (0)