diff --git a/src/include/netif/ppp/ppp.h b/src/include/netif/ppp/ppp.h index 28b2732a..d9ea097e 100644 --- a/src/include/netif/ppp/ppp.h +++ b/src/include/netif/ppp/ppp.h @@ -324,6 +324,7 @@ struct ppp_pcb_s { /* flags */ #if PPP_IPV4_SUPPORT + unsigned int ask_for_local :1; /* request our address from peer */ unsigned int ipcp_is_open :1; /* haven't called np_finished() */ unsigned int ipcp_is_up :1; /* have called ipcp_up() */ unsigned int if4_up :1; /* True when the IPv4 interface is up. */ @@ -475,7 +476,8 @@ void ppp_set_auth(ppp_pcb *pcb, u8_t authtype, const char *user, const char *pas * * Default is unset (0.0.0.0). */ -#define ppp_set_ipcp_ouraddr(ppp, addr) (ppp->ipcp_wantoptions.ouraddr = ip4_addr_get_u32(addr)) +#define ppp_set_ipcp_ouraddr(ppp, addr) do { ppp->ipcp_wantoptions.ouraddr = ip4_addr_get_u32(addr); \ + ppp->ask_for_local = ppp->ipcp_wantoptions.ouraddr != 0; } while(0) #define ppp_set_ipcp_hisaddr(ppp, addr) (ppp->ipcp_wantoptions.hisaddr = ip4_addr_get_u32(addr)) #if LWIP_DNS /* diff --git a/src/netif/ppp/ipcp.c b/src/netif/ppp/ipcp.c index 7d9d6fd8..5d859299 100644 --- a/src/netif/ppp/ipcp.c +++ b/src/netif/ppp/ipcp.c @@ -728,13 +728,8 @@ static void ipcp_resetci(fsm *f) { wo->req_dns1 = wo->req_dns2 = pcb->settings.usepeerdns; /* Request DNS addresses from the peer */ #endif /* LWIP_DNS */ *go = *wo; -#if 0 /* UNUSED */ - /* We don't need ask_for_local, this is only useful for setup which - * can determine the local IP address from the system hostname. - */ - if (!ask_for_local) + if (!pcb->ask_for_local) go->ouraddr = 0; -#endif /* UNUSED */ #if 0 /* UNUSED */ if (ip_choose_hook) { ip_choose_hook(&wo->hisaddr);