Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Use RO_MSGFILTER.
details: https://anonhg.NetBSD.org/src/rev/4042bd4df19b
branches: trunk
changeset: 352851:4042bd4df19b
user: roy <roy%NetBSD.org@localhost>
date: Wed Apr 12 16:47:39 2017 +0000
description:
Use RO_MSGFILTER.
diffstat:
crypto/dist/ipsec-tools/src/racoon/grabmyaddr.c | 12 +++++++++++-
usr.sbin/rarpd/mkarp.c | 13 +++++++++++--
2 files changed, 22 insertions(+), 3 deletions(-)
diffs (74 lines):
diff -r c110573fd69a -r 4042bd4df19b crypto/dist/ipsec-tools/src/racoon/grabmyaddr.c
--- a/crypto/dist/ipsec-tools/src/racoon/grabmyaddr.c Wed Apr 12 15:12:55 2017 +0000
+++ b/crypto/dist/ipsec-tools/src/racoon/grabmyaddr.c Wed Apr 12 16:47:39 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: grabmyaddr.c,v 1.34 2014/06/14 22:39:36 christos Exp $ */
+/* $NetBSD: grabmyaddr.c,v 1.35 2017/04/12 16:47:39 roy Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* Copyright (C) 2008 Timo Teras <timo.teras%iki.fi@localhost>.
@@ -827,6 +827,9 @@
kernel_open_socket()
{
int fd;
+#ifdef RO_MSGFILTER
+ unsigned char msgfilter[] = { RTM_NEWADDR, RTM_DELADDR };
+#endif
fd = socket(PF_ROUTE, SOCK_RAW, 0);
if (fd < 0) {
@@ -835,6 +838,13 @@
strerror(errno));
return -1;
}
+#ifdef RO_MSGFILTER
+ if (setsockopt(fd, PF_ROUTE, RO_MSGFILTER,
+ &msgfilter, sizeof(msgfilter)) < 0)
+ plog(LLV_WARNING, LOCATION, NULL,
+ "setsockopt(RO_MSGFILER) failed: %s",
+ strerror(errno));
+#endif
close_on_exec(fd);
if (fcntl(fd, F_SETFL, O_NONBLOCK) == -1)
plog(LLV_WARNING, LOCATION, NULL,
diff -r c110573fd69a -r 4042bd4df19b usr.sbin/rarpd/mkarp.c
--- a/usr.sbin/rarpd/mkarp.c Wed Apr 12 15:12:55 2017 +0000
+++ b/usr.sbin/rarpd/mkarp.c Wed Apr 12 16:47:39 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mkarp.c,v 1.11 2016/04/04 07:37:08 ozaki-r Exp $ */
+/* $NetBSD: mkarp.c,v 1.12 2017/04/12 16:57:14 roy Exp $ */
/*
* Copyright (c) 1984, 1993
@@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)arp.c 8.3 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: mkarp.c,v 1.11 2016/04/04 07:37:08 ozaki-r Exp $");
+__RCSID("$NetBSD: mkarp.c,v 1.12 2017/04/12 16:57:14 roy Exp $");
#endif
#endif /* not lint */
@@ -132,6 +132,10 @@
struct sockaddr_inarp sin_m;
struct sockaddr_dl sdl_m;
+#ifdef RO_MSGFILTER
+ unsigned char msgfilter[] = { RTM_GET, RTM_ADD };
+#endif
+
sin = &sin_m;
rtm = &(m_rtmsg.m_rtm);
@@ -158,6 +162,11 @@
s = socket(PF_ROUTE, SOCK_RAW, 0);
if (s < 0)
err(1, "socket");
+#ifdef RO_MSGFILTER
+ if (setsockopt(s, PF_ROUTE, RO_MSGFILTER,
+ &msgfilter, sizeof(msgfilter)) < 0)
+ warn("RO_MSGFILTER");
+#endif
rtm->rtm_flags = 0;
Home |
Main Index |
Thread Index |
Old Index