Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/ndp ndp: SIOCSPFXFLUSH_IN6 and SIOCSRTRFLUSH_IN6 ex...
details: https://anonhg.NetBSD.org/src/rev/b19ba431e79e
branches: trunk
changeset: 995329:b19ba431e79e
user: roy <roy%NetBSD.org@localhost>
date: Sun Dec 16 08:47:43 2018 +0000
description:
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.
diffstat:
usr.sbin/ndp/ndp.c | 17 +++++++++--------
1 files changed, 9 insertions(+), 8 deletions(-)
diffs (47 lines):
diff -r 970ddc3d177c -r b19ba431e79e usr.sbin/ndp/ndp.c
--- a/usr.sbin/ndp/ndp.c Sun Dec 16 08:19:51 2018 +0000
+++ b/usr.sbin/ndp/ndp.c Sun Dec 16 08:47:43 2018 +0000
@@ -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 @@
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 @@
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);
}
Home |
Main Index |
Thread Index |
Old Index