From: pali <7141871+pali@users.noreply.github.com> Date: Tue, 26 Jan 2021 02:52:22 +0000 (+0100) Subject: pppd: Fix demand mode with noremoteip option (#232) X-Git-Tag: ppp-2.5.0~95 X-Git-Url: https://git.ozlabs.org/?p=ppp.git;a=commitdiff_plain;h=99578f2b8bc6592119868e5fbe6f723cf3640bc2 pppd: Fix demand mode with noremoteip option (#232) When noremoteip is set then initial hisaddr (peer address) is zero. So to handle setting correct peer address after establishing connection it is needed to change logic around 'wo->hisaddr != 0' condition. wo->hisaddr needs to be updated from initial zero address to correct peer address. Signed-off-by: Pali Rohár --- diff --git a/pppd/ipcp.c b/pppd/ipcp.c index d95b69b..24452bf 100644 --- a/pppd/ipcp.c +++ b/pppd/ipcp.c @@ -1823,9 +1823,10 @@ ipcp_up(fsm *f) wo->ouraddr = go->ouraddr; } else script_unsetenv("OLDIPLOCAL"); - if (ho->hisaddr != wo->hisaddr && wo->hisaddr != 0) { + if (ho->hisaddr != wo->hisaddr) { warn("Remote IP address changed to %I", ho->hisaddr); - script_setenv("OLDIPREMOTE", ip_ntoa(wo->hisaddr), 0); + if (wo->hisaddr != 0) + script_setenv("OLDIPREMOTE", ip_ntoa(wo->hisaddr), 0); wo->hisaddr = ho->hisaddr; } else script_unsetenv("OLDIPREMOTE");