Subject: bin/9245: IPv6/INET6 support for /usr/sbin/pppd
To: None <gnats-bugs@gnats.netbsd.org>
From: Feico Dillema <dillema@acm.org>
List: netbsd-bugs
Date: 01/19/2000 10:34:02
>Number:         9245
>Category:       bin
>Synopsis:       ip6 support in pppd doesn't compile/work
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jan 19 10:33:01 2000
>Last-Modified:
>Originator:     Feico Dillema
>Organization:
University of Tromso
>Release:        Jan 12 2000
>Environment:
System: NetBSD drifter.dillema.net 1.4P NetBSD 1.4P (DRIFTER) #12: Wed Jan 12 19:11:47 CET 2000 dillema@drifter.dillema.net:/home/dillema/cvs/src/sys/arch/i386/compile/DRIFTER i386

>Description:

		pppd does not compile nor run with INET6 option
		defined in Makefile. INET6 is disabled for this 
		reason and because it hadn't been tested yet.

>How-To-Repeat:
		try compile pppd with INET6 defined in Makefile.
		also ipv6 ppp options are not parsed correctly

>Fix:

		The included patch fixes the compilætion error and
		a bug in processing ipv6 options in config file.
		It also enables the IPv6 protocol in the ppp code.

		Did initial testing of pppd with IPv6 over virtual
		link; two pppd's with a socket(1) connection between
		them. IPv6 with pppd works fine in that setup, so I
		have good reason to believe that it would work fine
		over a real tty too. (If not, I'll test that soon
		and report problems again ;).

		With this little patch I think the INET6 in
		src/usr.sbin/pppd/pppd/Makefile can be safely
		uncommented/enabled.

--9Ek0hoCL9XbhcSqy
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="pppd.diff"

--- ipv6cp.c.orig	Wed Jan 19 15:32:50 2000
+++ ipv6cp.c	Tue Jan 18 22:28:01 2000
@@ -119,7 +119,7 @@
 /*
  * Command-line options.
  */
-static int setifaceid __P((char *arg));
+static int setifaceid __P((char **arg));
 
 static option_t ipv6cp_option_list[] = {
     { "ipv6", o_special, setifaceid,
@@ -174,7 +174,7 @@
     ipv6cp_close,
     ipv6cp_printpkt,
     NULL,
-    0,
+    1,
     "IPV6CP",
     "IPV6",
     ipv6cp_option_list,
@@ -212,26 +212,27 @@
  */
 static int
 setifaceid(arg)
-    char *arg;
+    char **arg;
 {
-    char *comma;
+    char *p, *comma;
     ipv6cp_options *wo = &ipv6cp_wantoptions[0];
     struct in6_addr addr;
-    
+
+#define s6_addr32 __u6_addr.__u6_addr32 /* non-standard */
 #define VALIDID(a) ( (((a).s6_addr32[0] == 0) && ((a).s6_addr32[1] == 0)) && \
 			(((a).s6_addr32[2] != 0) || ((a).s6_addr32[3] != 0)) )
-    
-    if ((comma = strchr(arg, ',')) == NULL)
-	comma = arg + strlen(arg);
+    p = *arg; 
+    if ((comma = strchr(p, ',')) == NULL)
+	comma = p + strlen(p);
     
     /* 
      * If comma first character, then no local identifier
      */
-    if (comma != arg) {
+    if (comma != p) {
 	*comma = '\0';
 
-	if (inet_pton(AF_INET6, arg, &addr) == 0 || !VALIDID(addr)) {
-	    option_error("Illegal interface identifier: %s", arg);
+	if (inet_pton(AF_INET6, p, &addr) == 0 || !VALIDID(addr)) {
+	    option_error("Illegal interface identifier: %s", p);
 	    return 0;
 	}
 	

--9Ek0hoCL9XbhcSqy--
>Audit-Trail:
>Unformatted:
--9Ek0hoCL9XbhcSqy
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit