summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2009-01-28 17:05:54 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2009-01-28 17:05:54 +0000
commit6b2c2b39f1604a9e6733df499ad0a07c98092f82 (patch)
treed50965f90a9981476ad0047bb27a941246f7c50b /sbin
parentcc7c4ef58d7919198478623eea5cb52e629990e2 (diff)
use claudios new rtsocket filters to restrict which messages on the route
socket dhclient will get. ja ja claudio@
Diffstat (limited to 'sbin')
-rw-r--r--sbin/dhclient/dhclient.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c
index 41aba9870c2..e39fd301a70 100644
--- a/sbin/dhclient/dhclient.c
+++ b/sbin/dhclient/dhclient.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhclient.c,v 1.121 2009/01/10 16:33:47 claudio Exp $ */
+/* $OpenBSD: dhclient.c,v 1.122 2009/01/28 17:05:53 dlg Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
@@ -263,6 +263,7 @@ main(int argc, char *argv[])
/* Initially, log errors to stderr as well as to syslogd. */
openlog(__progname, LOG_PID | LOG_NDELAY, DHCPD_LOG_FACILITY);
setlogmask(LOG_UPTO(LOG_INFO));
+ int rtfilter;
while ((ch = getopt(argc, argv, "c:dl:qu")) != -1)
switch (ch) {
@@ -378,6 +379,15 @@ main(int argc, char *argv[])
if ((routefd = socket(PF_ROUTE, SOCK_RAW, 0)) == -1)
error("socket(PF_ROUTE, SOCK_RAW): %m");
+ ROUTE_SETFILTER(rtfilter, RTM_NEWADDR);
+ ROUTE_SETFILTER(rtfilter, RTM_DELADDR);
+ ROUTE_SETFILTER(rtfilter, RTM_IFINFO);
+ ROUTE_SETFILTER(rtfilter, RTM_IFANNOUNCE);
+
+ if (setsockopt(routefd, PF_ROUTE, ROUTE_MSGFILTER,
+ &rtfilter, sizeof(rtfilter)) == -1)
+ error("setsockopt(ROUTE_MSGFILTER): %m");
+
/* set up the interface */
discover_interface();