From 99578f2b8bc6592119868e5fbe6f723cf3640bc2 Mon Sep 17 00:00:00 2001 From: pali <7141871+pali@users.noreply.github.com> Date: Tue, 26 Jan 2021 03:52:22 +0100 Subject: [PATCH] pppd: Fix demand mode with noremoteip option (#232) MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- pppd/ipcp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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"); -- 2.39.2