From 4a5422cd1181558b09da7f321851d78e825bc225 Mon Sep 17 00:00:00 2001 From: Sylvain Rochet Date: Sun, 26 Jun 2016 19:16:51 +0200 Subject: [PATCH] PPP, PPPoS, SERVER: fix DNS servers support DNS servers should be set in IPCP allowoptions instead of wantoptions. In addition if server mode is enabled we need to disable usepeerdns config flag so we are not asking DNS servers to our client. --- src/netif/ppp/pppos.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/netif/ppp/pppos.c b/src/netif/ppp/pppos.c index 35766fc0..38a2b786 100644 --- a/src/netif/ppp/pppos.c +++ b/src/netif/ppp/pppos.c @@ -337,6 +337,9 @@ pppos_listen(ppp_pcb *ppp, void *ctx, const struct ppp_addrs *addrs) pppos_pcb *pppos = (pppos_pcb *)ctx; #if PPP_IPV4_SUPPORT ipcp_options *ipcp_wo; +#if LWIP_DNS + ipcp_options *ipcp_ao; +#endif /* LWIP_DNS */ #endif /* PPP_IPV4_SUPPORT */ lcp_options *lcp_wo; PPPOS_DECL_PROTECT(lev); @@ -365,8 +368,12 @@ pppos_listen(ppp_pcb *ppp, void *ctx, const struct ppp_addrs *addrs) ipcp_wo->ouraddr = ip4_addr_get_u32(&addrs->our_ipaddr); ipcp_wo->hisaddr = ip4_addr_get_u32(&addrs->his_ipaddr); #if LWIP_DNS - ipcp_wo->dnsaddr[0] = ip4_addr_get_u32(&addrs->dns1); - ipcp_wo->dnsaddr[1] = ip4_addr_get_u32(&addrs->dns2); + /* Don't accept DNS from peer */ + ppp->settings.usepeerdns = 0; + + ipcp_ao = &ppp->ipcp_allowoptions; + ipcp_ao->dnsaddr[0] = ip4_addr_get_u32(&addrs->dns1); + ipcp_ao->dnsaddr[1] = ip4_addr_get_u32(&addrs->dns2); #endif /* LWIP_DNS */ #else /* PPP_IPV4_SUPPORT */ LWIP_UNUSED_ARG(addrs);