summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2015-10-13 10:21:28 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2015-10-13 10:21:28 +0000
commit06d3df2be1bc50a846a38f4f248c9b16718bc1e8 (patch)
treedb6290a6e64d0b296ddf1a54cc55bbd7182d143a
parent2e665a38e0c8fc4de1103c85a029361c246751c9 (diff)
Simplify arptfree() to no longer look at the route entry's refcounter.
ARP entries with an expired timeout are now removed from the tree even if they are cached somehwere else. This also reduces differences with NDP. ok bluhm@
-rw-r--r--sys/netinet/if_ether.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c
index 9c9f617c54e..1b834ef2238 100644
--- a/sys/netinet/if_ether.c
+++ b/sys/netinet/if_ether.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ether.c,v 1.171 2015/10/07 08:58:01 mpi Exp $ */
+/* $OpenBSD: if_ether.c,v 1.172 2015/10/13 10:21:27 mpi Exp $ */
/* $NetBSD: if_ether.c,v 1.31 1996/05/11 12:59:58 mycroft Exp $ */
/*
@@ -91,7 +91,7 @@ int arpt_prune = (5*60*1); /* walk list every 5 minutes */
int arpt_keep = (20*60); /* once resolved, good for 20 more minutes */
int arpt_down = 20; /* once declared down, don't send for 20 secs */
-void arptfree(struct llinfo_arp *);
+void arptfree(struct rtentry *);
void arptimer(void *);
struct rtentry *arplookup(u_int32_t, int, int, u_int);
void in_arpinput(struct mbuf *);
@@ -133,7 +133,7 @@ arptimer(void *arg)
nla = LIST_NEXT(la, la_list);
if (rt->rt_expire && rt->rt_expire <= time_second)
- arptfree(la); /* timer has expired; clear */
+ arptfree(rt); /* timer has expired; clear */
}
splx(s);
}
@@ -772,26 +772,17 @@ out:
* Free an arp entry.
*/
void
-arptfree(struct llinfo_arp *la)
+arptfree(struct rtentry *rt)
{
- struct rtentry *rt = la->la_rt;
- struct sockaddr_dl *sdl;
- u_int tid = 0;
+ struct llinfo_arp *la = (struct llinfo_arp *)rt->rt_llinfo;
+ struct sockaddr_dl *sdl = SDL(rt->rt_gateway);
- if (rt == NULL)
- panic("arptfree");
- if (rt->rt_refcnt > 0 && (sdl = SDL(rt->rt_gateway)) &&
- sdl->sdl_family == AF_LINK) {
+ if ((sdl != NULL) && (sdl->sdl_family == AF_LINK)) {
sdl->sdl_alen = 0;
la->la_asked = 0;
- rt->rt_flags &= ~RTF_REJECT;
- return;
}
- if (rt->rt_ifp)
- tid = rt->rt_ifp->if_rdomain;
-
- rtdeletemsg(rt, tid);
+ rtdeletemsg(rt, rt->rt_ifp->if_rdomain);
}
/*