summaryrefslogtreecommitdiff
path: root/usr.sbin/arp/arp.c
diff options
context:
space:
mode:
authorMike Belopuhov <mikeb@cvs.openbsd.org>2014-03-18 14:18:23 +0000
committerMike Belopuhov <mikeb@cvs.openbsd.org>2014-03-18 14:18:23 +0000
commit03a4aaabf9b0fbfac344d08f8836955837141f91 (patch)
tree0054c623b0b4b547e379a957af6151c32d45a992 /usr.sbin/arp/arp.c
parent46656a2fffe97dca9c2dd5e5b73a9a6278d10e8a (diff)
Put AF_ROUTE socket that arp(8) operates on into the appropriate rdomain.
Previously "arp -V 1 -d 10.0.0.1" would hang forever since while the target rdomain was passed in the rtm, the AF_ROUTE socket was always created in the rdomain 0. Due to the logic in route_input (rtsock.c) route socket's rdomain is compared against the target rdomain of the request and reply is generated only when they match. In our case rdomains were different which cased arp(8) to hang waiting for the reply that would never be sent. ok deraadt
Diffstat (limited to 'usr.sbin/arp/arp.c')
-rw-r--r--usr.sbin/arp/arp.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.sbin/arp/arp.c b/usr.sbin/arp/arp.c
index a4e37b6634d..055b6e8dff7 100644
--- a/usr.sbin/arp/arp.c
+++ b/usr.sbin/arp/arp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: arp.c,v 1.55 2014/02/26 20:50:17 claudio Exp $ */
+/* $OpenBSD: arp.c,v 1.56 2014/03/18 14:18:22 mikeb Exp $ */
/* $NetBSD: arp.c,v 1.12 1995/04/24 13:25:18 cgd Exp $ */
/*
@@ -238,11 +238,15 @@ file(char *name)
void
getsocket(void)
{
+ socklen_t len = sizeof(rdomain);
+
if (s >= 0)
return;
s = socket(PF_ROUTE, SOCK_RAW, 0);
if (s < 0)
err(1, "socket");
+ if (setsockopt(s, PF_ROUTE, ROUTE_TABLEFILTER, &rdomain, len) < 0)
+ err(1, "ROUTE_TABLEFILTER");
}
struct sockaddr_in so_mask = { 8, 0, 0, { 0xffffffff } };