Module Name:    src
Committed By:   roy
Date:           Sun Dec 16 08:47:43 UTC 2018

Modified Files:
        src/usr.sbin/ndp: ndp.c

Log Message:
ndp: SIOCSPFXFLUSH_IN6 and SIOCSRTRFLUSH_IN6 expect struct in6_ifreq

And not just a character string of the interface name.
This only worked before because the interface name is the first member
of the structure.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/usr.sbin/ndp/ndp.c

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

Modified files:

Index: src/usr.sbin/ndp/ndp.c
diff -u src/usr.sbin/ndp/ndp.c:1.54 src/usr.sbin/ndp/ndp.c:1.55
--- src/usr.sbin/ndp/ndp.c:1.54	Thu Jul 12 08:20:49 2018
+++ src/usr.sbin/ndp/ndp.c	Sun Dec 16 08:47:43 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ndp.c,v 1.54 2018/07/12 08:20:49 nonaka Exp $	*/
+/*	$NetBSD: ndp.c,v 1.55 2018/12/16 08:47:43 roy Exp $	*/
 /*	$KAME: ndp.c,v 1.121 2005/07/13 11:30:13 keiichi Exp $	*/
 
 /*
@@ -1400,13 +1400,14 @@ plist(void)
 static void
 pfx_flush(void)
 {
-	char dummyif[IFNAMSIZ+8];
 	int s;
+	struct in6_ifreq ifr;
 
 	if ((s = prog_socket(AF_INET6, SOCK_DGRAM, 0)) < 0)
 		err(1, "socket");
-	(void)strlcpy(dummyif, "lo0", sizeof(dummyif)); /* dummy */
-	if (prog_ioctl(s, SIOCSPFXFLUSH_IN6, (caddr_t)&dummyif) < 0)
+	memset(&ifr, 0, sizeof(ifr));
+	strcpy(ifr.ifr_name, "lo0");
+	if (prog_ioctl(s, SIOCSPFXFLUSH_IN6, &ifr) < 0)
 		err(1, "ioctl(SIOCSPFXFLUSH_IN6)");
 	(void)prog_close(s);
 }
@@ -1414,15 +1415,15 @@ pfx_flush(void)
 static void
 rtr_flush(void)
 {
-	char dummyif[IFNAMSIZ+8];
 	int s;
+	struct in6_ifreq ifr;
 
 	if ((s = prog_socket(AF_INET6, SOCK_DGRAM, 0)) < 0)
 		err(1, "socket");
-	(void)strlcpy(dummyif, "lo0", sizeof(dummyif)); /* dummy */
-	if (prog_ioctl(s, SIOCSRTRFLUSH_IN6, (caddr_t)&dummyif) < 0)
+	memset(&ifr, 0, sizeof(ifr));
+	strcpy(ifr.ifr_name, "lo0");
+	if (prog_ioctl(s, SIOCSRTRFLUSH_IN6, &ifr) < 0)
 		err(1, "ioctl(SIOCSRTRFLUSH_IN6)");
-
 	(void)prog_close(s);
 }
 

Reply via email to