From 756d704724e8420320989a6b8927290c96ca81e6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Pali=20Roh=C3=A1r?= Date: Sat, 5 Jun 2021 18:51:52 +0200 Subject: [PATCH] ipv6cp: Add support for ipv6cp-nosend option MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This new option cause that pppd would not send our local IPv6 interface identifier to peer during IPv6 interface identifier negotiation. Like nosendip option for IPv4. Signed-off-by: Pali Rohár --- pppd/ipv6cp.c | 7 +++++-- pppd/pppd.8 | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/pppd/ipv6cp.c b/pppd/ipv6cp.c index 6059c76..decaa67 100644 --- a/pppd/ipv6cp.c +++ b/pppd/ipv6cp.c @@ -268,6 +268,8 @@ static option_t ipv6cp_option_list[] = { { "ipv6cp-noremote", o_bool, &ipv6cp_noremote, "Allow peer to have no interface identifier", 1 }, #endif + { "ipv6cp-nosend", o_bool, &ipv6cp_wantoptions[0].neg_ifaceid, + "Don't send local interface identifier to peer", OPT_A2CLR }, { "ipv6cp-restart", o_int, &ipv6cp_fsm[0].timeouttime, "Set timeout for IPv6CP", OPT_PRIO }, @@ -684,6 +686,7 @@ bad: static int ipv6cp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) { + ipv6cp_options *wo = &ipv6cp_wantoptions[f->unit]; ipv6cp_options *go = &ipv6cp_gotoptions[f->unit]; u_char citype, cilen, *next; u_short cishort; @@ -732,7 +735,7 @@ ipv6cp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) try.neg_ifaceid = 0; } else if (go->accept_local && !eui64_iszero(ifaceid) && !eui64_equals(ifaceid, go->hisid)) { try.ourid = ifaceid; - } else if (eui64_iszero(ifaceid) && !go->opt_local) { + } else if (eui64_iszero(ifaceid) && !go->opt_local && wo->neg_ifaceid) { while (eui64_iszero(ifaceid) || eui64_equals(ifaceid, go->hisid)) /* bad luck */ eui64_magic(ifaceid); @@ -786,7 +789,7 @@ ipv6cp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) eui64_get(ifaceid, p); if (go->accept_local && !eui64_iszero(ifaceid) && !eui64_equals(ifaceid, go->hisid)) { try.ourid = ifaceid; - } else if (eui64_iszero(ifaceid) && !go->opt_local) { + } else if (eui64_iszero(ifaceid) && !go->opt_local && wo->neg_ifaceid) { while (eui64_iszero(ifaceid) || eui64_equals(ifaceid, go->hisid)) /* bad luck */ eui64_magic(ifaceid); diff --git a/pppd/pppd.8 b/pppd/pppd.8 index f70e053..229bab5 100644 --- a/pppd/pppd.8 +++ b/pppd/pppd.8 @@ -549,6 +549,10 @@ be addressed directly for IPv6 traffic until the peer starts announcing ICMPv6 Router Advertisement or ICMPv6 Neighbor Advertisement packets. Note that IPv6 router must announce ICMPv6 Router Advertisement packets. .TP +.B ipv6cp\-nosendip +Don't send our local IPv6 interface identifier to peer during IPv6 interface +identifier negotiation. +.TP .B ipv6cp\-max\-configure \fIn Set the maximum number of IPv6CP configure-request transmissions to \fIn\fR (default 10). -- 2.39.2