CVS commit: src/external/bsd/ppp/usr.sbin/pppd

2021-01-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jan 11 21:45:22 UTC 2021

Modified Files:
src/external/bsd/ppp/usr.sbin/pppd: sys-bsd.c

Log Message:
Make this compile without -DINET6 (Kurt Schreiner)


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c
diff -u src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c:1.8 src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c:1.9
--- src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c:1.8	Sat Jan  9 11:39:29 2021
+++ src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c	Mon Jan 11 16:45:22 2021
@@ -121,6 +121,8 @@ __RCSID("NetBSD: sys-bsd.c,v 1.68 2013/0
 #endif
 #include 
 
+#ifdef INET6
+
 #define s6_addr32 __u6_addr.__u6_addr32	/* Non-standard */
 
 #define IN6_SOCKADDR_FROM_EUI64(s, eui64) do { \
@@ -146,8 +148,10 @@ __RCSID("NetBSD: sys-bsd.c,v 1.68 2013/0
 	sin6.s6_addr16[0] = htons(0xfe80);			\
 	eui64_copy(eui64, sin6.s6_addr32[2]);			\
 } while (/*CONSTCOND*/0)
-#endif
-#endif
+#endif /* __KAME__ */
+#endif /* IN6_LLADDR_FROM_EUI64 */
+
+#endif /* INET6 */
 
 #if RTM_VERSION >= 3
 #include 
@@ -201,8 +205,9 @@ static int if6_is_up;		/* the interface 
 #endif /* INET6 */
 static u_int32_t ifaddrs[2];	/* local and remote addresses we set */
 static u_int32_t default_route_gateway;	/* gateway addr for default route */
-static eui64_t  default_route_gateway6; /* Gateway for default IPv6 route added
-*/ 
+#ifdef INET6
+static eui64_t  default_route_gateway6; /* Gateway for default IPv6 route added */
+#endif /* INET6 */
 static u_int32_t proxy_arp_addr;	/* remote addr for proxy arp */
 
 /* Prototypes for procedures local to this file. */
@@ -307,8 +312,10 @@ sys_cleanup(void)
 	cifaddr(0, ifaddrs[0], ifaddrs[1]);
 if (default_route_gateway)
 	cifdefaultroute(0, 0, default_route_gateway);
+#ifdef INET6
 if (default_route_gateway6.e32[0] != 0 || default_route_gateway6.e32[1] != 0)
 	cif6defaultroute(0, default_route_gateway6, default_route_gateway6);
+#endif
 if (proxy_arp_addr)
 	cifproxyarp(0, proxy_arp_addr);
 doing_cleanup = 0;
@@ -1659,6 +1666,7 @@ dodefaultroute(u_int32_t g, int cmd)
 }
 
 
+#ifdef INET6
 /*
  * dodefaultroute - assign/clear a default route through the address given.
  */
@@ -1725,6 +1733,8 @@ cif6defaultroute(int u, eui64_t l, eui64
 	return dodefaultroute6(u, l, g, 'c');
 }
 
+#endif
+
 #if RTM_VERSION >= 3
 
 /*



CVS commit: src/external/bsd/ppp/usr.sbin/pppd

2021-01-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jan 11 21:45:22 UTC 2021

Modified Files:
src/external/bsd/ppp/usr.sbin/pppd: sys-bsd.c

Log Message:
Make this compile without -DINET6 (Kurt Schreiner)


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/bsd/ppp/usr.sbin/pppd

2020-09-06 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Sep  6 08:15:04 UTC 2020

Modified Files:
src/external/bsd/ppp/usr.sbin/pppd: sys-bsd.c

Log Message:
use struct zero initialiser and avoid calling memset() on a pointer
of the wrong size.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/bsd/ppp/usr.sbin/pppd

2020-09-06 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Sep  6 08:15:04 UTC 2020

Modified Files:
src/external/bsd/ppp/usr.sbin/pppd: sys-bsd.c

Log Message:
use struct zero initialiser and avoid calling memset() on a pointer
of the wrong size.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c
diff -u src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c:1.6 src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c:1.7
--- src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c:1.6	Fri Oct  4 09:01:59 2019
+++ src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c	Sun Sep  6 08:15:04 2020
@@ -1879,10 +1879,10 @@ get_if_hwaddr(u_char *addr, char *name)
 
 #define IFREQ_SAFE (sizeof(struct ifreq) + sizeof(struct sockaddr_dl))
 /* XXX sockaddr_dl is larger than the sockaddr in struct ifreq! */
-union {			/* XXX */
-	struct ifreq _ifreq;	/* XXX */
-	char _X[IFREQ_SAFE]; 	/* XXX */
-} _ifreq_dontsmashstack;	/* XXX */
+union {/* XXX */
+	struct ifreq _ifreq;		/* XXX */
+	char _X[IFREQ_SAFE]; 		/* XXX */
+} _ifreq_dontsmashstack = {0};	/* XXX */
 #define ifreq_xxx _ifreq_dontsmashstack._ifreq			/* XXX */
 
 struct sockaddr_dl *sdl = (struct sockaddr_dl *) _xxx.ifr_addr;
@@ -1890,7 +1890,6 @@ get_if_hwaddr(u_char *addr, char *name)
 
 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
 	return 0;
-(void)memset(sdl, 0, sizeof(*sdl));
 sdl->sdl_family = AF_LINK;
 (void)strlcpy(ifreq_xxx.ifr_name, name, sizeof(ifreq_xxx.ifr_name));
 if (ioctl(fd, SIOCGIFADDR, _xxx) == -1) {



CVS commit: src/external/bsd/ppp/usr.sbin/pppd

2018-07-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul  8 21:01:21 UTC 2018

Modified Files:
src/external/bsd/ppp/usr.sbin/pppd: sys-bsd.c

Log Message:
New arp code needs RTF_LLDATA for DELETE to work!
XXX: pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/bsd/ppp/usr.sbin/pppd

2018-07-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul  8 21:01:21 UTC 2018

Modified Files:
src/external/bsd/ppp/usr.sbin/pppd: sys-bsd.c

Log Message:
New arp code needs RTF_LLDATA for DELETE to work!
XXX: pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c
diff -u src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c:1.4 src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c:1.5
--- src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c:1.4	Sat Aug  6 01:58:20 2016
+++ src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c	Sun Jul  8 17:01:21 2018
@@ -1679,7 +1679,7 @@ sifproxyarp(int unit, u_int32_t hisaddr)
 }
 
 arpmsg.hdr.rtm_type = RTM_ADD;
-arpmsg.hdr.rtm_flags = RTF_ANNOUNCE | RTF_HOST | RTF_STATIC;
+arpmsg.hdr.rtm_flags = RTF_ANNOUNCE | RTF_HOST | RTF_STATIC | RTF_LLDATA;
 arpmsg.hdr.rtm_version = RTM_VERSION;
 arpmsg.hdr.rtm_seq = ++rtm_seq;
 arpmsg.hdr.rtm_addrs = RTA_DST | RTA_GATEWAY;



CVS commit: src/external/bsd/ppp/usr.sbin/pppd

2016-08-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Aug  6 05:58:20 UTC 2016

Modified Files:
src/external/bsd/ppp/usr.sbin/pppd: sys-bsd.c

Log Message:
Instead of listing cloners, try to create one so that the module autoloads.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c
diff -u src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c:1.3 src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c:1.4
--- src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c:1.3	Sat Dec 20 08:15:48 2014
+++ src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c	Sat Aug  6 01:58:20 2016
@@ -339,58 +339,37 @@ sys_check_options(void)
 
 /*
  * ppp_available - check whether the system has any ppp interfaces
- * (in fact we check whether we can do an ioctl on ppp0).
+ * (in fact we check whether we can create one)
  */
 int
 ppp_available(void)
 {
-struct if_clonereq ifcr;
-char *cp, *buf;
-int idx, s;
+int s;
 extern char *no_ppp_msg;
+struct ifreq ifr;
 
-(void)memset(, 0, sizeof(ifcr));
 
 if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
 	fatal("%s: socket: %m", __func__);
 
-if (ioctl(s, SIOCIFGCLONERS, ) == -1)
-	fatal("%s: ioctl(get cloners): %m", __func__);
-
-buf = malloc(ifcr.ifcr_total * IFNAMSIZ);
-if (buf == NULL)
-	fatal("%s: Unable to allocate cloner name buffer: %m", __func__);
-
-ifcr.ifcr_count = ifcr.ifcr_total;
-ifcr.ifcr_buffer = buf;
-
-if (ioctl(s, SIOCIFGCLONERS, ) == -1)
-	fatal("%s: ioctl(get cloners): %m", __func__);
-(void)close(s);
-
-/*
- * In case some disappeared in the mean time, clamp it down.
- */
-if (ifcr.ifcr_count > ifcr.ifcr_total)
-	ifcr.ifcr_count = ifcr.ifcr_total;
-
-for (cp = buf, idx = 0; idx < ifcr.ifcr_count; idx++, cp += IFNAMSIZ) {
-	if (strcmp(cp, "ppp") == 0)
-	break;
+(void)memset(, 0, sizeof(ifr));
+strlcpy(ifr.ifr_name, "ppp0", sizeof(ifr.ifr_name));
+if (ioctl(s, SIOCIFCREATE, ) == -1) {
+	int notmine = errno == EEXIST;
+	(void)close(s);
+	if (notmine)
+	return 1;
+	goto out;
 }
-free(buf);
+(void)ioctl(s, SIOCIFDESTROY, );
+(void)close(s);
+return 1;
 
-#ifdef __NetBSD__
+out:
 no_ppp_msg = "\
 This system lacks kernel support for PPP.  To include PPP support\n\
 in the kernel, please read the ppp(4) manual page.\n";
-#else
-no_ppp_msg = "\
-This system lacks kernel support for PPP.  To include PPP support\n\
-in the kernel, please follow the steps detailed in the README.bsd\n\
-file in the ppp-2.2 distribution.\n";
-#endif
-return idx != ifcr.ifcr_count;
+return 0;
 }
 
 /*



CVS commit: src/external/bsd/ppp/usr.sbin/pppd

2016-08-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Aug  6 05:58:20 UTC 2016

Modified Files:
src/external/bsd/ppp/usr.sbin/pppd: sys-bsd.c

Log Message:
Instead of listing cloners, try to create one so that the module autoloads.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.