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.
This commit is contained in:
parent
66445508cf
commit
ba783f9d03
|
@ -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 */
|
||||
|
|
|
@ -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 @@ sppp_lcp_confreq(struct sppp *sp, struct lcp_header *h, int origlen,
|
|||
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 @@ sppp_lcp_confreq(struct sppp *sp, struct lcp_header *h, int origlen,
|
|||
|
||||
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)
|
||||
|
|
Loading…
Reference in New Issue