summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2009-03-11 11:53:11 +0000
committerRoy Marples <roy@marples.name>2009-03-11 11:53:11 +0000
commita4f6339ebd949920e432f814d5bb3304113daaea (patch)
tree16cf88b51c8c7d5e1ca4d9071a72a5c48bd94d6b
parentce6b39df64069a367cf62fd2bf450613ea54fc1a (diff)
downloaddhcpcd-a4f6339ebd949920e432f814d5bb3304113daaea.tar.xz
We shouldn't need to flush arp entires ourself on BSD platforms.
-rw-r--r--configure.c7
-rw-r--r--if-bsd.c37
-rw-r--r--if-linux.c7
-rw-r--r--net.h1
4 files changed, 3 insertions, 49 deletions
diff --git a/configure.c b/configure.c
index f8120503..d41b03ed 100644
--- a/configure.c
+++ b/configure.c
@@ -446,8 +446,9 @@ c_route(struct rt *ort, struct rt *nrt, const struct interface *iface)
return -1;
desc_route("changing", nrt, iface->name);
- /* We don't call change_route because it doesn't work when something
- * has already used it. */
+ /* We delete and add the route so that we can change metric.
+ * This also has the nice side effect of flushing ARP entries so
+ * we don't have to do that manually. */
del_route(ort->iface, &ort->dest, &ort->net, &ort->gate,
ort->iface->metric);
if (!add_route(iface, &nrt->dest, &nrt->net, &nrt->gate,
@@ -658,8 +659,6 @@ configure(struct interface *iface)
}
build_routes();
- if (arp_flush() == -1)
- syslog(LOG_ERR, "arp_flush: %m");
if (!iface->state->lease.frominfo &&
!(iface->state->options->options & DHCPCD_INFORM))
if (write_lease(iface, dhcp) == -1)
diff --git a/if-bsd.c b/if-bsd.c
index d5681487..542ed6c6 100644
--- a/if-bsd.c
+++ b/if-bsd.c
@@ -256,43 +256,6 @@ if_route(const struct interface *iface, const struct in_addr *dest,
}
int
-arp_flush(void)
-{
- int mib[6], retval = 0;
- size_t buffer_len = 0;
- char *buffer, *e, *p;
- struct rt_msghdr *rtm;
-
- mib[0] = CTL_NET;
- mib[1] = PF_ROUTE;
- mib[2] = 0;
- mib[3] = AF_INET;
- mib[4] = NET_RT_FLAGS;
- mib[5] = RTF_LLINFO;
- if (sysctl(mib, 6, NULL, &buffer_len, NULL, 0) == -1)
- return -1;
- if (buffer_len == 0)
- return 0;
- buffer = xmalloc(buffer_len);
- if (sysctl(mib, 6, buffer, &buffer_len, NULL, 0) == -1)
- return -1;
- e = buffer + buffer_len;
- for (p = buffer; p < e; p += rtm->rtm_msglen) {
- rtm = (struct rt_msghdr *)(void *)p;
- /* Don't delete manually added entries. */
- if (rtm->rtm_flags & RTF_STATIC)
- continue;
- rtm->rtm_type = RTM_DELETE;
- if (write(r_fd, rtm, rtm->rtm_msglen) == -1) {
- retval = -1;
- break;
- }
- }
- free(buffer);
- return retval;
-}
-
-int
open_link_socket(void)
{
int fd;
diff --git a/if-linux.c b/if-linux.c
index 2bb1854d..0f4a3ab4 100644
--- a/if-linux.c
+++ b/if-linux.c
@@ -472,13 +472,6 @@ if_route(const struct interface *iface,
return retval;
}
-/* No need to explicity flush arp on Linux */
-int
-arp_flush(void)
-{
- return 0;
-}
-
struct interface *
discover_interfaces(int argc, char * const *argv)
{
diff --git a/net.h b/net.h
index 19abb91d..cbac54b5 100644
--- a/net.h
+++ b/net.h
@@ -129,7 +129,6 @@ int if_route(const struct interface *, const struct in_addr *,
if_route(iface, dest, mask, gate, metric, -1)
#define del_src_route(iface, dest, mask, gate, metric) \
if_route(iface, dest, mask, gate, metric, -2)
-int arp_flush(void);
void free_routes(struct rt *);
int open_udp_socket(struct interface *);