Source-Changes-HG archive

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

[src/trunk]: src/sys/net Introduct a new flag to accept different authenticat...



details:   https://anonhg.NetBSD.org/src/rev/64b1ea4a0ba2
branches:  trunk
changeset: 1020707:64b1ea4a0ba2
user:      yamaguchi <yamaguchi%NetBSD.org@localhost>
date:      Fri Apr 23 01:13:25 2021 +0000

description:
Introduct a new flag to accept different authentication protocol
in myauthproto and hisauthproto

When the flag is enabled, a authentication protocol notified
at LCP negotiation is used as my authentication protocol.
When the flags is NOT enabled, my authentication protoco is
not changed at LCP negotiation.

diffstat:

 sys/net/if_sppp.h     |   3 ++-
 sys/net/if_spppsubr.c |  12 ++++++++++--
 2 files changed, 12 insertions(+), 3 deletions(-)

diffs (57 lines):

diff -r ea8e4919f616 -r 64b1ea4a0ba2 sys/net/if_sppp.h
--- a/sys/net/if_sppp.h Thu Apr 22 22:43:26 2021 +0000
+++ b/sys/net/if_sppp.h Fri Apr 23 01:13:25 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_sppp.h,v 1.30 2020/12/02 14:20:20 wiz Exp $ */
+/*     $NetBSD: if_sppp.h,v 1.31 2021/04/23 01:13:25 yamaguchi Exp $   */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -44,6 +44,7 @@
 #define SPPP_AUTHFLAG_NOCALLOUT                1       /* do not require authentication on */
                                                /* callouts */
 #define SPPP_AUTHFLAG_NORECHALLENGE    2       /* do not re-challenge CHAP */
+#define SPPP_AUTHFLAG_PASSIVEAUTHPROTO 4       /* use authproto proposed by peer */
 
 struct spppauthcfg {
        char    ifname[IFNAMSIZ];       /* pppoe interface name */
diff -r ea8e4919f616 -r 64b1ea4a0ba2 sys/net/if_spppsubr.c
--- a/sys/net/if_spppsubr.c     Thu Apr 22 22:43:26 2021 +0000
+++ b/sys/net/if_spppsubr.c     Fri Apr 23 01:13:25 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_spppsubr.c,v 1.217 2021/04/16 02:12:00 yamaguchi Exp $       */
+/*     $NetBSD: if_spppsubr.c,v 1.218 2021/04/23 01:13:25 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.217 2021/04/16 02:12:00 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.218 2021/04/23 01:13:25 yamaguchi Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -2701,6 +2701,10 @@
                                        addlog(" [invalid chap len]");
                                break;
                        }
+                       if (ISSET(sp->myauth.flags, SPPP_AUTHFLAG_PASSIVEAUTHPROTO)) {
+                               if (authproto == PPP_PAP || authproto == PPP_CHAP)
+                                       sp->myauth.proto = authproto;
+                       }
                        if (sp->myauth.proto == 0) {
                                /* we are not configured to do auth */
                                if (debug)
@@ -2831,6 +2835,10 @@
 
                case LCP_OPT_AUTH_PROTO:
                        authproto = (p[2] << 8) + p[3];
+                       if (ISSET(sp->myauth.flags, SPPP_AUTHFLAG_PASSIVEAUTHPROTO)) {
+                               if (authproto == PPP_PAP || authproto == PPP_CHAP)
+                                       sp->myauth.proto = authproto;
+                       }
                        if (sp->myauth.proto != authproto) {
                                /* not agreed, nak */
                                if (debug)



Home | Main Index | Thread Index | Old Index