Source-Changes-HG archive

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

[src/trunk]: src/sys/net Ignore 0.0.0.0 offered from PPPoE server



details:   https://anonhg.NetBSD.org/src/rev/7a2cd7b8a67d
branches:  trunk
changeset: 378848:7a2cd7b8a67d
user:      yamaguchi <yamaguchi%NetBSD.org@localhost>
date:      Mon Apr 26 08:31:21 2021 +0000

description:
Ignore 0.0.0.0 offered from PPPoE server

diffstat:

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

diffs (61 lines):

diff -r 835178f7e451 -r 7a2cd7b8a67d sys/net/if_spppsubr.c
--- a/sys/net/if_spppsubr.c     Mon Apr 26 07:27:24 2021 +0000
+++ b/sys/net/if_spppsubr.c     Mon Apr 26 08:31:21 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_spppsubr.c,v 1.221 2021/04/26 02:36:45 yamaguchi Exp $       */
+/*     $NetBSD: if_spppsubr.c,v 1.222 2021/04/26 08:31:21 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.221 2021/04/26 02:36:45 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.222 2021/04/26 08:31:21 yamaguchi Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -3825,10 +3825,15 @@ sppp_ipcp_confnak(struct sppp *sp, struc
                                 * our already existing value.
                                 */
                                if (sp->ipcp.flags & IPCP_MYADDR_DYN) {
-                                       if (debug)
-                                               addlog(" [agree]");
-                                       sp->ipcp.flags |= IPCP_MYADDR_SEEN;
-                                       sp->ipcp.req_myaddr = wantaddr;
+                                       if (ntohl(wantaddr) != INADDR_ANY) {
+                                               if (debug)
+                                                       addlog(" [agree]");
+                                               sp->ipcp.flags |= IPCP_MYADDR_SEEN;
+                                               sp->ipcp.req_myaddr = wantaddr;
+                                       } else {
+                                               if (debug)
+                                                       addlog(" [not agreed]");
+                                       }
                                }
                        }
                        break;
@@ -3865,9 +3870,20 @@ static void
 sppp_ipcp_tlu(struct sppp *sp)
 {
 #ifdef INET
+       struct ifnet *ifp;
+
+       ifp = &sp->pp_if;
        KASSERT(SPPP_WLOCKED(sp));
-       /* we are up. Set addresses and notify anyone interested */
-       sppp_set_ip_addrs(sp);
+       if ((sp->ipcp.flags & IPCP_MYADDR_DYN) &&
+           ((sp->ipcp.flags & IPCP_MYADDR_SEEN) == 0)) {
+               log(LOG_WARNING, "%s: no IP address, closing IPCP\n",
+                   ifp->if_xname);
+               sppp_wq_add(sp->wq_cp,
+                   &sp->scp[IDX_IPCP].work_close);
+       } else {
+               /* we are up. Set addresses and notify anyone interested */
+               sppp_set_ip_addrs(sp);
+       }
 #endif
 }
 



Home | Main Index | Thread Index | Old Index