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/c552009fd1b6
branches: trunk
changeset: 352815:c552009fd1b6
user: roy <roy%NetBSD.org@localhost>
date: Tue Apr 11 14:15:08 2017 +0000
description:
Use RO_MSGFILTER.
diffstat:
external/bsd/ntp/dist/ntpd/ntp_io.c | 51 +++++++++++++++++++++++++-
external/bsd/wpa/dist/src/drivers/driver_bsd.c | 15 +++++++
usr.sbin/ifwatchd/ifwatchd.c | 11 ++++-
3 files changed, 74 insertions(+), 3 deletions(-)
diffs (137 lines):
diff -r 8e5092355b30 -r c552009fd1b6 external/bsd/ntp/dist/ntpd/ntp_io.c
--- a/external/bsd/ntp/dist/ntpd/ntp_io.c Tue Apr 11 14:13:01 2017 +0000
+++ b/external/bsd/ntp/dist/ntpd/ntp_io.c Tue Apr 11 14:15:08 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ntp_io.c,v 1.23 2016/06/03 20:39:02 christos Exp $ */
+/* $NetBSD: ntp_io.c,v 1.24 2017/04/11 14:17:34 roy Exp $ */
/*
* ntp_io.c - input/output routines for ntpd. The socket-opening code
@@ -4795,6 +4795,50 @@
#else
int fd = socket(PF_ROUTE, SOCK_RAW, 0);
#endif
+#ifdef RO_MSGFILTER
+ unsigned char msgfilter[] = {
+#ifdef RTM_NEWADDR
+ RTM_NEWADDR,
+#endif
+#ifdef RTM_DELADDR
+ RTM_DELADDR,
+#endif
+#ifdef RTM_ADD
+ RTM_ADD,
+#endif
+#ifdef RTM_DELETE
+ RTM_DELETE,
+#endif
+#ifdef RTM_REDIRECT
+ RTM_REDIRECT,
+#endif
+#ifdef RTM_CHANGE
+ RTM_CHANGE,
+#endif
+#ifdef RTM_LOSING
+ RTM_LOSING,
+#endif
+#ifdef RTM_IFINFO
+ RTM_IFINFO,
+#endif
+#ifdef RTM_IFANNOUNCE
+ RTM_IFANNOUNCE,
+#endif
+#ifdef RTM_NEWLINK
+ RTM_NEWLINK,
+#endif
+#ifdef RTM_DELLINK
+ RTM_DELLINK,
+#endif
+#ifdef RTM_NEWROUTE
+ RTM_NEWROUTE,
+#endif
+#ifdef RTM_DELROUTE
+ RTM_DELROUTE,
+#endif
+ };
+#endif /* !RO_MSGFILTER */
+
if (fd < 0) {
msyslog(LOG_ERR,
"unable to open routing socket (%m) - using polled interface update");
@@ -4815,6 +4859,11 @@
return;
}
#endif
+#ifdef RO_MSGFILTER
+ if (setsockopt(fd, PF_ROUTE, RO_MSGFILTER,
+ &msgfilter, sizeof(msgfilter)) == -1)
+ msyslog(LOG_ERR, "RO_MSGFILTER: %m");
+#endif
make_socket_nonblocking(fd);
#if defined(HAVE_SIGNALED_IO)
init_socket_sig(fd);
diff -r 8e5092355b30 -r c552009fd1b6 external/bsd/wpa/dist/src/drivers/driver_bsd.c
--- a/external/bsd/wpa/dist/src/drivers/driver_bsd.c Tue Apr 11 14:13:01 2017 +0000
+++ b/external/bsd/wpa/dist/src/drivers/driver_bsd.c Tue Apr 11 14:15:08 2017 +0000
@@ -1696,6 +1696,14 @@
bsd_global_init(void *ctx)
{
struct bsd_driver_global *global;
+#ifdef RO_MSGFILTER
+ unsigned char msgfilter[] = {
+ RTM_IEEE80211,
+#ifndef HOSTAPD
+ RTM_IFINFO, RTM_IFANNOUNCE,
+#endif
+ };
+#endif
global = os_zalloc(sizeof(*global));
if (global == NULL)
@@ -1718,6 +1726,13 @@
goto fail;
}
+#ifdef RO_MSGFILTER
+ if (setsockopt(global->route, PF_ROUTE, RO_MSGFILTER,
+ &msgfilter, sizeof(msgfilter)) < 0)
+ wpa_printf(MSG_ERROR, "setsockopt[PF_ROUTE,RO_MSGFILTER]: %s",
+ strerror(errno));
+#endif
+
#ifdef HOSTAPD
eloop_register_read_sock(global->route, bsd_wireless_event_receive,
NULL, global);
diff -r 8e5092355b30 -r c552009fd1b6 usr.sbin/ifwatchd/ifwatchd.c
--- a/usr.sbin/ifwatchd/ifwatchd.c Tue Apr 11 14:13:01 2017 +0000
+++ b/usr.sbin/ifwatchd/ifwatchd.c Tue Apr 11 14:15:08 2017 +0000
@@ -1,6 +1,6 @@
-/* $NetBSD: ifwatchd.c,v 1.41 2016/10/07 15:49:58 christos Exp $ */
+/* $NetBSD: ifwatchd.c,v 1.42 2017/04/11 14:21:35 roy Exp $ */
#include <sys/cdefs.h>
-__RCSID("$NetBSD: ifwatchd.c,v 1.41 2016/10/07 15:49:58 christos Exp $");
+__RCSID("$NetBSD: ifwatchd.c,v 1.42 2017/04/11 14:21:35 roy Exp $");
/*-
* Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
@@ -108,6 +108,10 @@
struct msghdr msg;
struct iovec iov[1];
char buf[2048];
+ unsigned char msgfilter[] = {
+ RTM_IFINFO, RTM_IFANNOUNCE,
+ RTM_NEWADDR, RTM_DELADDR,
+ };
openlog(argv[0], LOG_PID|LOG_CONS, LOG_DAEMON);
while ((c = getopt(argc, argv, "qvhic:n:u:d:A:D:")) != -1) {
@@ -191,6 +195,9 @@
syslog(LOG_ERR, "error opening routing socket: %m");
exit(EXIT_FAILURE);
}
+ if (setsockopt(s, PF_ROUTE, RO_MSGFILTER,
+ &msgfilter, sizeof(msgfilter)) < 0)
+ syslog(LOG_ERR, "RO_MSGFILTER: %m");
if (!inhibit_initial)
run_initial_ups();
Home |
Main Index |
Thread Index |
Old Index