]> git.ozlabs.org Git - ppp.git/commitdiff
ipv6cp: Add support for ipv6cp-nosend option
authorPali Rohár <pali@kernel.org>
Sat, 5 Jun 2021 16:51:52 +0000 (18:51 +0200)
committerPali Rohár <pali@kernel.org>
Tue, 21 Dec 2021 14:43:56 +0000 (15:43 +0100)
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 <pali@kernel.org>
pppd/ipv6cp.c
pppd/pppd.8

index 6059c764ca49745220c0a3ad8a39631a37f45aaa..decaa6705e6cf335e7271fd55d3a08712bb87736 100644 (file)
@@ -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-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 },
 
     { "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)
 {
 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;
     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;
                     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);
                     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;
            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);
                while (eui64_iszero(ifaceid) || 
                       eui64_equals(ifaceid, go->hisid)) /* bad luck */
                    eui64_magic(ifaceid);
index f70e05389c29ff89ae0635d8d8d80c66bdbfb997..229bab5520b2716be68ae396d6f6f5f9a5a7a963 100644 (file)
@@ -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
 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).
 .B ipv6cp\-max\-configure \fIn
 Set the maximum number of IPv6CP configure-request transmissions to
 \fIn\fR (default 10).