if.c (128618) | if.c (130416) |
---|---|
1/* 2 * Copyright (c) 1980, 1986, 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 --- 13 unchanged lines hidden (view full) --- 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * @(#)if.c 8.5 (Berkeley) 1/9/95 | 1/* 2 * Copyright (c) 1980, 1986, 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 --- 13 unchanged lines hidden (view full) --- 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * @(#)if.c 8.5 (Berkeley) 1/9/95 |
30 * $FreeBSD: head/sys/net/if.c 128618 2004-04-24 22:24:48Z luigi $ | 30 * $FreeBSD: head/sys/net/if.c 130416 2004-06-13 17:29:10Z mlaier $ |
31 */ 32 33#include "opt_compat.h" 34#include "opt_inet6.h" 35#include "opt_inet.h" 36#include "opt_mac.h" 37 38#include <sys/param.h> --- 38 unchanged lines hidden (view full) --- 77 78static void if_attachdomain(void *); 79static void if_attachdomain1(struct ifnet *); 80static int ifconf(u_long, caddr_t); 81static void if_grow(void); 82static void if_init(void *); 83static void if_check(void *); 84static int if_findindex(struct ifnet *); | 31 */ 32 33#include "opt_compat.h" 34#include "opt_inet6.h" 35#include "opt_inet.h" 36#include "opt_mac.h" 37 38#include <sys/param.h> --- 38 unchanged lines hidden (view full) --- 77 78static void if_attachdomain(void *); 79static void if_attachdomain1(struct ifnet *); 80static int ifconf(u_long, caddr_t); 81static void if_grow(void); 82static void if_init(void *); 83static void if_check(void *); 84static int if_findindex(struct ifnet *); |
85static void if_qflush(struct ifqueue *); | 85static void if_qflush(struct ifaltq *); |
86static void if_route(struct ifnet *, int flag, int fam); 87static void if_slowtimo(void *); 88static void if_unroute(struct ifnet *, int flag, int fam); 89static void link_rtrequest(int, struct rtentry *, struct rt_addrinfo *); 90static int if_rtdel(struct radix_node *, void *); 91static struct if_clone *if_clone_lookup(const char *, int *); 92static int if_clone_list(struct if_clonereq *); 93static int ifhwioctl(u_long, struct ifnet *, caddr_t, struct thread *); --- 342 unchanged lines hidden (view full) --- 436 sdl = (struct sockaddr_dl *)(socksize + (caddr_t)sdl); 437 ifa->ifa_netmask = (struct sockaddr *)sdl; 438 sdl->sdl_len = masklen; 439 while (namelen != 0) 440 sdl->sdl_data[--namelen] = 0xff; 441 ifa->ifa_refcnt = 1; 442 TAILQ_INSERT_HEAD(&ifp->if_addrhead, ifa, ifa_link); 443 ifp->if_broadcastaddr = 0; /* reliably crash if used uninitialized */ | 86static void if_route(struct ifnet *, int flag, int fam); 87static void if_slowtimo(void *); 88static void if_unroute(struct ifnet *, int flag, int fam); 89static void link_rtrequest(int, struct rtentry *, struct rt_addrinfo *); 90static int if_rtdel(struct radix_node *, void *); 91static struct if_clone *if_clone_lookup(const char *, int *); 92static int if_clone_list(struct if_clonereq *); 93static int ifhwioctl(u_long, struct ifnet *, caddr_t, struct thread *); --- 342 unchanged lines hidden (view full) --- 436 sdl = (struct sockaddr_dl *)(socksize + (caddr_t)sdl); 437 ifa->ifa_netmask = (struct sockaddr *)sdl; 438 sdl->sdl_len = masklen; 439 while (namelen != 0) 440 sdl->sdl_data[--namelen] = 0xff; 441 ifa->ifa_refcnt = 1; 442 TAILQ_INSERT_HEAD(&ifp->if_addrhead, ifa, ifa_link); 443 ifp->if_broadcastaddr = 0; /* reliably crash if used uninitialized */ |
444#ifdef ALTQ 445 ifp->if_snd.altq_type = 0; 446 ifp->if_snd.altq_disc = NULL; 447 ifp->if_snd.altq_flags &= ALTQF_CANTCHANGE; 448 ifp->if_snd.altq_tbr = NULL; 449 ifp->if_snd.altq_ifp = ifp; 450#endif |
|
444 445 if (domains) 446 if_attachdomain1(ifp); 447 448 EVENTHANDLER_INVOKE(ifnet_arrival_event, ifp); 449 450 /* Announce the interface. */ 451 rt_ifannouncemsg(ifp, IFAN_ARRIVAL); --- 62 unchanged lines hidden (view full) --- 514 struct domain *dp; 515 516 EVENTHANDLER_INVOKE(ifnet_departure_event, ifp); 517 /* 518 * Remove routes and flush queues. 519 */ 520 s = splnet(); 521 if_down(ifp); | 451 452 if (domains) 453 if_attachdomain1(ifp); 454 455 EVENTHANDLER_INVOKE(ifnet_arrival_event, ifp); 456 457 /* Announce the interface. */ 458 rt_ifannouncemsg(ifp, IFAN_ARRIVAL); --- 62 unchanged lines hidden (view full) --- 521 struct domain *dp; 522 523 EVENTHANDLER_INVOKE(ifnet_departure_event, ifp); 524 /* 525 * Remove routes and flush queues. 526 */ 527 s = splnet(); 528 if_down(ifp); |
529#ifdef ALTQ 530 if (ALTQ_IS_ENABLED(&ifp->if_snd)) 531 altq_disable(&ifp->if_snd); 532 if (ALTQ_IS_ATTACHED(&ifp->if_snd)) 533 altq_detach(&ifp->if_snd); 534#endif |
|
522 523 for (ifa = TAILQ_FIRST(&ifp->if_addrhead); ifa; ifa = next) { 524 next = TAILQ_NEXT(ifa, ifa_link); 525 526 if (ifa->ifa_addr->sa_family == AF_LINK) 527 continue; 528#ifdef INET 529 /* XXX: Ugly!! ad hoc just for INET */ --- 654 unchanged lines hidden (view full) --- 1184 1185 if_route(ifp, IFF_UP, AF_UNSPEC); 1186} 1187 1188/* 1189 * Flush an interface queue. 1190 */ 1191static void | 535 536 for (ifa = TAILQ_FIRST(&ifp->if_addrhead); ifa; ifa = next) { 537 next = TAILQ_NEXT(ifa, ifa_link); 538 539 if (ifa->ifa_addr->sa_family == AF_LINK) 540 continue; 541#ifdef INET 542 /* XXX: Ugly!! ad hoc just for INET */ --- 654 unchanged lines hidden (view full) --- 1197 1198 if_route(ifp, IFF_UP, AF_UNSPEC); 1199} 1200 1201/* 1202 * Flush an interface queue. 1203 */ 1204static void |
1192if_qflush(struct ifqueue *ifq) | 1205if_qflush(struct ifaltq *ifq) |
1193{ 1194 struct mbuf *m, *n; 1195 | 1206{ 1207 struct mbuf *m, *n; 1208 |
1209#ifdef ALTQ 1210 if (ALTQ_IS_ENABLED(ifq)) 1211 ALTQ_PURGE(ifq); 1212#endif |
|
1196 n = ifq->ifq_head; 1197 while ((m = n) != 0) { 1198 n = m->m_act; 1199 m_freem(m); 1200 } 1201 ifq->ifq_head = 0; 1202 ifq->ifq_tail = 0; 1203 ifq->ifq_len = 0; --- 864 unchanged lines hidden --- | 1213 n = ifq->ifq_head; 1214 while ((m = n) != 0) { 1215 n = m->m_act; 1216 m_freem(m); 1217 } 1218 ifq->ifq_head = 0; 1219 ifq->ifq_tail = 0; 1220 ifq->ifq_len = 0; --- 864 unchanged lines hidden --- |