From 57a4434c4472a5200b5b6bab18070cc6c60b4c6e Mon Sep 17 00:00:00 2001 From: David Gwynne Date: Tue, 31 Mar 2009 01:31:27 +0000 Subject: claudio has spent too much time with the mbuf macros. switch the rtsocket message filter specification so you can or the macros converting the routing socket message types into the mask used by the filter. ie: - ROUTE_SETFILTER(rtfilter, RTM_NEWADDR); - ROUTE_SETFILTER(rtfilter, RTM_DELADDR); - ROUTE_SETFILTER(rtfilter, RTM_IFINFO); - ROUTE_SETFILTER(rtfilter, RTM_IFANNOUNCE); + rtfilter = ROUTE_FILTER(RTM_NEWADDR) | ROUTE_FILTER(RTM_DELADDR) | + ROUTE_FILTER(RTM_IFINFO) | ROUTE_FILTER(RTM_IFANNOUNCE); there's a manpage change coming. ok claudio@ --- sbin/dhclient/dhclient.c | 8 +++----- sys/net/route.h | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index 5e7726cc39a..f5f134c9cd8 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.124 2009/03/10 23:19:36 krw Exp $ */ +/* $OpenBSD: dhclient.c,v 1.125 2009/03/31 01:31:26 dlg Exp $ */ /* * Copyright 2004 Henning Brauer @@ -379,10 +379,8 @@ 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); + rtfilter = ROUTE_FILTER(RTM_NEWADDR) | ROUTE_FILTER(RTM_DELADDR) | + ROUTE_FILTER(RTM_IFINFO) | ROUTE_FILTER(RTM_IFANNOUNCE); if (setsockopt(routefd, PF_ROUTE, ROUTE_MSGFILTER, &rtfilter, sizeof(rtfilter)) == -1) diff --git a/sys/net/route.h b/sys/net/route.h index 5fc0d2fb751..b24598624ab 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -1,4 +1,4 @@ -/* $OpenBSD: route.h,v 1.59 2009/02/03 16:42:54 michele Exp $ */ +/* $OpenBSD: route.h,v 1.60 2009/03/31 01:31:26 dlg Exp $ */ /* $NetBSD: route.h,v 1.9 1996/02/13 22:00:49 christos Exp $ */ /* @@ -301,7 +301,7 @@ struct rt_omsghdr { #define ROUTE_MSGFILTER 1 /* bitmask to specifiy which types should be sent to the client. */ -#define ROUTE_SETFILTER(x, m) (x) |= (1 << (m)) +#define ROUTE_FILTER(m) (1 << (m)) struct rt_addrinfo { int rti_addrs; -- cgit v1.2.3