summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorQing Li <qingli@FreeBSD.org>2009-10-20 17:44:50 +0000
committerQing Li <qingli@FreeBSD.org>2009-10-20 17:44:50 +0000
commit6f99a646e4ec4d6d84eaad984f308aec561f20b8 (patch)
tree946333973ba066d8615aee86e4976e3af18ec558 /sys
parentea95296ce8ac9d8490aa2b09b1a6e4ce208ebeb0 (diff)
Notes
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet/if_ether.c17
-rw-r--r--sys/netinet/in.c11
2 files changed, 18 insertions, 10 deletions
diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c
index 5aa2c59c88c7..922b5b8d51b4 100644
--- a/sys/netinet/if_ether.c
+++ b/sys/netinet/if_ether.c
@@ -87,10 +87,13 @@ VNET_DEFINE(int, useloopback) = 1; /* use loopback interface for
/* timer values */
static VNET_DEFINE(int, arpt_keep) = (20*60); /* once resolved, good for 20
* minutes */
+static VNET_DEFINE(int, arpt_down) = 20; /* keep incomplete entries for
+ * 20 seconds */
static VNET_DEFINE(int, arp_maxtries) = 5;
static VNET_DEFINE(int, arp_proxyall);
#define V_arpt_keep VNET(arpt_keep)
+#define V_arpt_down VNET(arpt_down)
#define V_arp_maxtries VNET(arp_maxtries)
#define V_arp_proxyall VNET(arp_proxyall)
@@ -299,7 +302,7 @@ retry:
}
if ((la->la_flags & LLE_VALID) &&
- ((la->la_flags & LLE_STATIC) || la->la_expire > time_uptime)) {
+ ((la->la_flags & LLE_STATIC) || la->la_expire > time_second)) {
bcopy(&la->ll_addr, desten, ifp->if_addrlen);
/*
* If entry has an expiry time and it is approaching,
@@ -307,7 +310,7 @@ retry:
* arpt_down interval.
*/
if (!(la->la_flags & LLE_STATIC) &&
- time_uptime + la->la_preempt > la->la_expire) {
+ time_second + la->la_preempt > la->la_expire) {
arprequest(ifp, NULL,
&SIN(dst)->sin_addr, IF_LLADDR(ifp));
@@ -327,7 +330,7 @@ retry:
goto done;
}
- renew = (la->la_asked == 0 || la->la_expire != time_uptime);
+ renew = (la->la_asked == 0 || la->la_expire != time_second);
if ((renew || m != NULL) && (flags & LLE_EXCLUSIVE) == 0) {
flags |= LLE_EXCLUSIVE;
LLE_RUNLOCK(la);
@@ -358,12 +361,12 @@ retry:
error = EWOULDBLOCK; /* First request. */
else
error =
- (rt0->rt_flags & RTF_GATEWAY) ? EHOSTDOWN : EHOSTUNREACH;
+ (rt0->rt_flags & RTF_GATEWAY) ? EHOSTUNREACH : EHOSTDOWN;
if (renew) {
LLE_ADDREF(la);
- la->la_expire = time_uptime;
- callout_reset(&la->la_timer, hz, arptimer, la);
+ la->la_expire = time_second;
+ callout_reset(&la->la_timer, hz * V_arpt_down, arptimer, la);
la->la_asked++;
LLE_WUNLOCK(la);
arprequest(ifp, NULL, &SIN(dst)->sin_addr,
@@ -668,7 +671,7 @@ match:
la->la_flags |= LLE_VALID;
if (!(la->la_flags & LLE_STATIC)) {
- la->la_expire = time_uptime + V_arpt_keep;
+ la->la_expire = time_second + V_arpt_keep;
callout_reset(&la->la_timer, hz * V_arpt_keep,
arptimer, la);
}
diff --git a/sys/netinet/in.c b/sys/netinet/in.c
index ae8e2f40d3de..1b0a6746e342 100644
--- a/sys/netinet/in.c
+++ b/sys/netinet/in.c
@@ -1439,7 +1439,7 @@ in_lltable_dump(struct lltable *llt, struct sysctl_req *wr)
struct sockaddr_dl *sdl;
/* skip deleted entries */
- if ((lle->la_flags & (LLE_DELETED|LLE_VALID)) != LLE_VALID)
+ if ((lle->la_flags & LLE_DELETED) == LLE_DELETED)
continue;
/* Skip if jailed and not a valid IP of the prison. */
if (prison_if(wr->td->td_ucred, L3_ADDR(lle)) != 0)
@@ -1471,10 +1471,15 @@ in_lltable_dump(struct lltable *llt, struct sysctl_req *wr)
sdl = &arpc.sdl;
sdl->sdl_family = AF_LINK;
sdl->sdl_len = sizeof(*sdl);
- sdl->sdl_alen = ifp->if_addrlen;
sdl->sdl_index = ifp->if_index;
sdl->sdl_type = ifp->if_type;
- bcopy(&lle->ll_addr, LLADDR(sdl), ifp->if_addrlen);
+ if ((lle->la_flags & LLE_VALID) == LLE_VALID) {
+ sdl->sdl_alen = ifp->if_addrlen;
+ bcopy(&lle->ll_addr, LLADDR(sdl), ifp->if_addrlen);
+ } else {
+ sdl->sdl_alen = 0;
+ bzero(LLADDR(sdl), ifp->if_addrlen);
+ }
arpc.rtm.rtm_rmx.rmx_expire =
lle->la_flags & LLE_STATIC ? 0 : lle->la_expire;