Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net do not clear destination address if there is no save...



details:   https://anonhg.NetBSD.org/src/rev/9489c30b98bc
branches:  trunk
changeset: 379043:9489c30b98bc
user:      yamaguchi <yamaguchi%NetBSD.org@localhost>
date:      Thu May 06 06:18:16 2021 +0000

description:
do not clear destination address if there is no saved address
and add initialization of saved_hisaddr for safety

0.0.0.0 was sometimes configured to destination address when
ipcp close was occurred before ipcp tlu.
Following messages will be appeared when the issue is encountered and
debug for pppoe(4) is enabled.

tc-so:[     1.890005] pppoe0: ipcp close(starting)
(snip)
tc-so:[     1.890005] pppoe0: ipcp_open(): no IP interface

diffstat:

 sys/net/if_spppsubr.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (36 lines):

diff -r c6e13ea0a6fc -r 9489c30b98bc sys/net/if_spppsubr.c
--- a/sys/net/if_spppsubr.c     Thu May 06 02:05:09 2021 +0000
+++ b/sys/net/if_spppsubr.c     Thu May 06 06:18:16 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_spppsubr.c,v 1.229 2021/05/06 02:05:09 yamaguchi Exp $       */
+/*     $NetBSD: if_spppsubr.c,v 1.230 2021/05/06 06:18:16 yamaguchi Exp $       */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.229 2021/05/06 02:05:09 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.230 2021/05/06 06:18:16 yamaguchi Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -3531,6 +3531,7 @@ sppp_ipcp_open(struct sppp *sp, void *xc
                 * remote has no valid address, we need to get one assigned.
                 */
                sp->ipcp.flags |= IPCP_HISADDR_DYN;
+               sp->ipcp.saved_hisaddr = htonl(hisaddr);
        }
 
        if (sp->query_dns & 1) {
@@ -5744,7 +5745,8 @@ sppp_clear_ip_addrs(struct sppp *sp)
 
                if (sp->ipcp.flags & IPCP_MYADDR_DYN)
                        new_sin.sin_addr.s_addr = 0;
-               if (sp->ipcp.flags & IPCP_HISADDR_DYN)
+               if (sp->ipcp.flags & IPCP_HISADDR_DYN &&
+                   ntohl(sp->ipcp.saved_hisaddr) != 0)
                        new_dst.sin_addr.s_addr = sp->ipcp.saved_hisaddr;
 
                in_addrhash_remove(ifatoia(ifa));



Home | Main Index | Thread Index | Old Index