summaryrefslogtreecommitdiff
path: root/usr.sbin/arp
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2017-04-15 11:50:25 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2017-04-15 11:50:25 +0000
commitebe657daf57c4002ab769776d85da62de20c1802 (patch)
tree3e02db17c1b0feefc8a51f290689d6810075771f /usr.sbin/arp
parent6d0f13e38679074596aec4d724a2e20a1a6aacb5 (diff)
Name global variable for routing socket rtsock like in ndp(8).
OK florian@
Diffstat (limited to 'usr.sbin/arp')
-rw-r--r--usr.sbin/arp/arp.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/usr.sbin/arp/arp.c b/usr.sbin/arp/arp.c
index 27146dd8be8..48d3aa95cdc 100644
--- a/usr.sbin/arp/arp.c
+++ b/usr.sbin/arp/arp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: arp.c,v 1.77 2016/11/29 08:55:06 mpi Exp $ */
+/* $OpenBSD: arp.c,v 1.78 2017/04/15 11:50:24 bluhm Exp $ */
/* $NetBSD: arp.c,v 1.12 1995/04/24 13:25:18 cgd Exp $ */
/*
@@ -86,7 +86,7 @@ static pid_t pid;
static int replace; /* replace entries when adding */
static int nflag; /* no reverse dns lookups */
static int aflag; /* do it for all entries */
-static int s = -1;
+static int rtsock = -1;
static int rdomain;
extern int h_errno;
@@ -243,12 +243,12 @@ getsocket(void)
{
socklen_t len = sizeof(rdomain);
- if (s >= 0)
+ if (rtsock >= 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)
+ rtsock = socket(PF_ROUTE, SOCK_RAW, 0);
+ if (rtsock < 0)
+ err(1, "routing socket");
+ if (setsockopt(rtsock, PF_ROUTE, ROUTE_TABLEFILTER, &rdomain, len) < 0)
err(1, "ROUTE_TABLEFILTER");
if (pledge("stdio dns", NULL) == -1)
@@ -668,14 +668,14 @@ doit:
l = rtm->rtm_msglen;
rtm->rtm_seq = ++seq;
rtm->rtm_type = cmd;
- if (write(s, (char *)&m_rtmsg, l) < 0)
+ if (write(rtsock, (char *)&m_rtmsg, l) < 0)
if (errno != ESRCH || cmd != RTM_DELETE) {
warn("writing to routing socket");
return (-1);
}
do {
- l = read(s, (char *)&m_rtmsg, sizeof(m_rtmsg));
+ l = read(rtsock, (char *)&m_rtmsg, sizeof(m_rtmsg));
} while (l > 0 && (rtm->rtm_version != RTM_VERSION ||
rtm->rtm_seq != seq || rtm->rtm_pid != pid));