Deleted Added
full compact
if_ether.c (32350) if_ether.c (34961)
1/*
2 * Copyright (c) 1982, 1986, 1988, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)if_ether.c 8.1 (Berkeley) 6/10/93
1/*
2 * Copyright (c) 1982, 1986, 1988, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)if_ether.c 8.1 (Berkeley) 6/10/93
34 * $Id: if_ether.c,v 1.42 1997/12/20 00:07:11 bde Exp $
34 * $Id: if_ether.c,v 1.43 1998/01/08 23:41:43 eivind Exp $
35 */
36
37/*
38 * Ethernet address resolution protocol.
39 * TODO:
40 * add "inuse/lock" bit (or ref. count) along with valid bit
41 */
42

--- 82 unchanged lines hidden (view full) ---

125 int s = splnet();
126 register struct llinfo_arp *la = llinfo_arp.lh_first;
127 struct llinfo_arp *ola;
128
129 timeout(arptimer, (caddr_t)0, arpt_prune * hz);
130 while ((ola = la) != 0) {
131 register struct rtentry *rt = la->la_rt;
132 la = la->la_le.le_next;
35 */
36
37/*
38 * Ethernet address resolution protocol.
39 * TODO:
40 * add "inuse/lock" bit (or ref. count) along with valid bit
41 */
42

--- 82 unchanged lines hidden (view full) ---

125 int s = splnet();
126 register struct llinfo_arp *la = llinfo_arp.lh_first;
127 struct llinfo_arp *ola;
128
129 timeout(arptimer, (caddr_t)0, arpt_prune * hz);
130 while ((ola = la) != 0) {
131 register struct rtentry *rt = la->la_rt;
132 la = la->la_le.le_next;
133 if (rt->rt_expire && rt->rt_expire <= time.tv_sec)
133 if (rt->rt_expire && rt->rt_expire <= time_second)
134 arptfree(ola); /* timer has expired, clear */
135 }
136 splx(s);
137}
138
139/*
140 * Parallel to llc_rtrequest.
141 */

--- 30 unchanged lines hidden (view full) ---

172 /*
173 * Case 1: This route should come from a route to iface.
174 */
175 rt_setgate(rt, rt_key(rt),
176 (struct sockaddr *)&null_sdl);
177 gate = rt->rt_gateway;
178 SDL(gate)->sdl_type = rt->rt_ifp->if_type;
179 SDL(gate)->sdl_index = rt->rt_ifp->if_index;
134 arptfree(ola); /* timer has expired, clear */
135 }
136 splx(s);
137}
138
139/*
140 * Parallel to llc_rtrequest.
141 */

--- 30 unchanged lines hidden (view full) ---

172 /*
173 * Case 1: This route should come from a route to iface.
174 */
175 rt_setgate(rt, rt_key(rt),
176 (struct sockaddr *)&null_sdl);
177 gate = rt->rt_gateway;
178 SDL(gate)->sdl_type = rt->rt_ifp->if_type;
179 SDL(gate)->sdl_index = rt->rt_ifp->if_index;
180 rt->rt_expire = time.tv_sec;
180 rt->rt_expire = time_second;
181 break;
182 }
183 /* Announce a new entry if requested. */
184 if (rt->rt_flags & RTF_ANNOUNCE)
185 arprequest((struct arpcom *)rt->rt_ifp,
186 &SIN(rt_key(rt))->sin_addr.s_addr,
187 &SIN(rt_key(rt))->sin_addr.s_addr,
188 (u_char *)LLADDR(SDL(gate)));

--- 160 unchanged lines hidden (view full) ---

349 m_freem(m);
350 return (0);
351 }
352 sdl = SDL(rt->rt_gateway);
353 /*
354 * Check the address family and length is valid, the address
355 * is resolved; otherwise, try to resolve.
356 */
181 break;
182 }
183 /* Announce a new entry if requested. */
184 if (rt->rt_flags & RTF_ANNOUNCE)
185 arprequest((struct arpcom *)rt->rt_ifp,
186 &SIN(rt_key(rt))->sin_addr.s_addr,
187 &SIN(rt_key(rt))->sin_addr.s_addr,
188 (u_char *)LLADDR(SDL(gate)));

--- 160 unchanged lines hidden (view full) ---

349 m_freem(m);
350 return (0);
351 }
352 sdl = SDL(rt->rt_gateway);
353 /*
354 * Check the address family and length is valid, the address
355 * is resolved; otherwise, try to resolve.
356 */
357 if ((rt->rt_expire == 0 || rt->rt_expire > time.tv_sec) &&
357 if ((rt->rt_expire == 0 || rt->rt_expire > time_second) &&
358 sdl->sdl_family == AF_LINK && sdl->sdl_alen != 0) {
359 bcopy(LLADDR(sdl), desten, sdl->sdl_alen);
360 return 1;
361 }
362 /*
363 * There is an arptab entry, but no ethernet address
364 * response yet. Replace the held mbuf with this
365 * latest one.
366 */
367 if (la->la_hold)
368 m_freem(la->la_hold);
369 la->la_hold = m;
370 if (rt->rt_expire) {
371 rt->rt_flags &= ~RTF_REJECT;
358 sdl->sdl_family == AF_LINK && sdl->sdl_alen != 0) {
359 bcopy(LLADDR(sdl), desten, sdl->sdl_alen);
360 return 1;
361 }
362 /*
363 * There is an arptab entry, but no ethernet address
364 * response yet. Replace the held mbuf with this
365 * latest one.
366 */
367 if (la->la_hold)
368 m_freem(la->la_hold);
369 la->la_hold = m;
370 if (rt->rt_expire) {
371 rt->rt_flags &= ~RTF_REJECT;
372 if (la->la_asked == 0 || rt->rt_expire != time.tv_sec) {
373 rt->rt_expire = time.tv_sec;
372 if (la->la_asked == 0 || rt->rt_expire != time_second) {
373 rt->rt_expire = time_second;
374 if (la->la_asked++ < arp_maxtries)
375 arprequest(ac,
376 &(SIN(rt->rt_ifa->ifa_addr)->sin_addr.s_addr),
377 &(SIN(dst)->sin_addr.s_addr),
378 ac->ac_enaddr);
379 else {
380 rt->rt_flags |= RTF_REJECT;
381 rt->rt_expire += arpt_down;

--- 114 unchanged lines hidden (view full) ---

496 if (sdl->sdl_alen &&
497 bcmp((caddr_t)ea->arp_sha, LLADDR(sdl), sdl->sdl_alen))
498 log(LOG_INFO, "arp: %s moved from %6D to %6D\n",
499 inet_ntoa(isaddr), (u_char *)LLADDR(sdl), ":",
500 ea->arp_sha, ":");
501 (void)memcpy(LLADDR(sdl), ea->arp_sha, sizeof(ea->arp_sha));
502 sdl->sdl_alen = sizeof(ea->arp_sha);
503 if (rt->rt_expire)
374 if (la->la_asked++ < arp_maxtries)
375 arprequest(ac,
376 &(SIN(rt->rt_ifa->ifa_addr)->sin_addr.s_addr),
377 &(SIN(dst)->sin_addr.s_addr),
378 ac->ac_enaddr);
379 else {
380 rt->rt_flags |= RTF_REJECT;
381 rt->rt_expire += arpt_down;

--- 114 unchanged lines hidden (view full) ---

496 if (sdl->sdl_alen &&
497 bcmp((caddr_t)ea->arp_sha, LLADDR(sdl), sdl->sdl_alen))
498 log(LOG_INFO, "arp: %s moved from %6D to %6D\n",
499 inet_ntoa(isaddr), (u_char *)LLADDR(sdl), ":",
500 ea->arp_sha, ":");
501 (void)memcpy(LLADDR(sdl), ea->arp_sha, sizeof(ea->arp_sha));
502 sdl->sdl_alen = sizeof(ea->arp_sha);
503 if (rt->rt_expire)
504 rt->rt_expire = time.tv_sec + arpt_keep;
504 rt->rt_expire = time_second + arpt_keep;
505 rt->rt_flags &= ~RTF_REJECT;
506 la->la_asked = 0;
507 if (la->la_hold) {
508 (*ac->ac_if.if_output)(&ac->ac_if, la->la_hold,
509 rt_key(rt), rt);
510 la->la_hold = 0;
511 }
512 }

--- 136 unchanged lines hidden ---
505 rt->rt_flags &= ~RTF_REJECT;
506 la->la_asked = 0;
507 if (la->la_hold) {
508 (*ac->ac_if.if_output)(&ac->ac_if, la->la_hold,
509 rt_key(rt), rt);
510 la->la_hold = 0;
511 }
512 }

--- 136 unchanged lines hidden ---