if.c (67164) | if.c (69152) |
---|---|
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 --- 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.c 8.3 (Berkeley) 1/4/94 | 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 --- 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.c 8.3 (Berkeley) 1/4/94 |
34 * $FreeBSD: head/sys/net/if.c 67164 2000-10-15 14:19:01Z phk $ | 34 * $FreeBSD: head/sys/net/if.c 69152 2000-11-25 07:35:38Z jlemon $ |
35 */ 36 37#include "opt_compat.h" 38#include "opt_inet6.h" 39#include "opt_inet.h" 40 41#include <sys/param.h> 42#include <sys/malloc.h> --- 62 unchanged lines hidden (view full) --- 105void 106ifinit(dummy) 107 void *dummy; 108{ 109 struct ifnet *ifp; 110 int s; 111 112 s = splimp(); | 35 */ 36 37#include "opt_compat.h" 38#include "opt_inet6.h" 39#include "opt_inet.h" 40 41#include <sys/param.h> 42#include <sys/malloc.h> --- 62 unchanged lines hidden (view full) --- 105void 106ifinit(dummy) 107 void *dummy; 108{ 109 struct ifnet *ifp; 110 int s; 111 112 s = splimp(); |
113 for (ifp = ifnet.tqh_first; ifp; ifp = ifp->if_link.tqe_next) | 113 for (ifp = ifnet.tqh_first; ifp; ifp = ifp->if_link.tqe_next) { |
114 if (ifp->if_snd.ifq_maxlen == 0) { 115 printf("%s%d XXX: driver didn't set ifq_maxlen\n", 116 ifp->if_name, ifp->if_unit); 117 ifp->if_snd.ifq_maxlen = ifqmaxlen; 118 } | 114 if (ifp->if_snd.ifq_maxlen == 0) { 115 printf("%s%d XXX: driver didn't set ifq_maxlen\n", 116 ifp->if_name, ifp->if_unit); 117 ifp->if_snd.ifq_maxlen = ifqmaxlen; 118 } |
119 if (ifp->if_snd.ifq_mtx.mtx_description == NULL) { 120 printf("%s%d XXX: driver didn't initialize queue mtx\n", 121 ifp->if_name, ifp->if_unit); 122 mtx_init(&ifp->if_snd.ifq_mtx, "unknown", MTX_DEF); 123 } 124 } |
|
119 splx(s); 120 if_slowtimo(0); 121} 122 123int if_index = 0; 124struct ifaddr **ifnet_addrs; 125struct ifnet **ifindex2ifnet = NULL; 126 --- 50 unchanged lines hidden (view full) --- 177 bcopy((caddr_t)ifindex2ifnet, q, n/2); 178 free((caddr_t)ifindex2ifnet, M_IFADDR); 179 } 180 ifindex2ifnet = (struct ifnet **)q; 181 } 182 183 ifindex2ifnet[if_index] = ifp; 184 | 125 splx(s); 126 if_slowtimo(0); 127} 128 129int if_index = 0; 130struct ifaddr **ifnet_addrs; 131struct ifnet **ifindex2ifnet = NULL; 132 --- 50 unchanged lines hidden (view full) --- 183 bcopy((caddr_t)ifindex2ifnet, q, n/2); 184 free((caddr_t)ifindex2ifnet, M_IFADDR); 185 } 186 ifindex2ifnet = (struct ifnet **)q; 187 } 188 189 ifindex2ifnet[if_index] = ifp; 190 |
191 mtx_init(&ifp->if_snd.ifq_mtx, ifp->if_name, MTX_DEF); 192 |
|
185 /* 186 * create a Link Level name for this device 187 */ 188 namelen = snprintf(workbuf, sizeof(workbuf), 189 "%s%d", ifp->if_name, ifp->if_unit); 190#define _offsetof(t, m) ((int)((caddr_t)&((t *)0)->m)) 191 masklen = _offsetof(struct sockaddr_dl, sdl_data[0]) + namelen; 192 socksize = masklen + ifp->if_addrlen; --- 92 unchanged lines hidden (view full) --- 285 } 286 287#ifdef INET6 288 /* nuke all IPv6 kernel structs related to ifp */ 289 in6_ifdetach(ifp); 290#endif 291 292 TAILQ_REMOVE(&ifnet, ifp, if_link); | 193 /* 194 * create a Link Level name for this device 195 */ 196 namelen = snprintf(workbuf, sizeof(workbuf), 197 "%s%d", ifp->if_name, ifp->if_unit); 198#define _offsetof(t, m) ((int)((caddr_t)&((t *)0)->m)) 199 masklen = _offsetof(struct sockaddr_dl, sdl_data[0]) + namelen; 200 socksize = masklen + ifp->if_addrlen; --- 92 unchanged lines hidden (view full) --- 293 } 294 295#ifdef INET6 296 /* nuke all IPv6 kernel structs related to ifp */ 297 in6_ifdetach(ifp); 298#endif 299 300 TAILQ_REMOVE(&ifnet, ifp, if_link); |
301 mtx_destroy(&ifp->if_snd.ifq_mtx); |
|
293 splx(s); 294} 295 296/* 297 * Delete Routes for a Network Interface 298 * 299 * Called for each routing entry via the rnh->rnh_walktree() call above 300 * to delete all route entries referencing a detaching network interface. --- 1087 unchanged lines hidden --- | 302 splx(s); 303} 304 305/* 306 * Delete Routes for a Network Interface 307 * 308 * Called for each routing entry via the rnh->rnh_walktree() call above 309 * to delete all route entries referencing a detaching network interface. --- 1087 unchanged lines hidden --- |