if_ef.c (106939) | if_ef.c (108172) |
---|---|
1/*- 2 * Copyright (c) 1999, 2000 Boris Popov 3 * 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 --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 1999, 2000 Boris Popov 3 * 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 --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/sys/net/if_ef.c 106939 2002-11-15 00:00:15Z sam $ | 26 * $FreeBSD: head/sys/net/if_ef.c 108172 2002-12-22 05:35:03Z hsu $ |
27 */ 28 29#include "opt_inet.h" 30#include "opt_ipx.h" 31#include "opt_ef.h" 32 33#include <sys/param.h> 34#include <sys/systm.h> --- 123 unchanged lines hidden (view full) --- 158 if (ifp->if_flags & IFF_RUNNING) { 159 /* find internet addresses and delete routes */ 160 register struct ifaddr *ifa; 161 TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { 162 rtinit(ifa, (int)RTM_DELETE, 0); 163 } 164 } 165 } | 27 */ 28 29#include "opt_inet.h" 30#include "opt_ipx.h" 31#include "opt_ef.h" 32 33#include <sys/param.h> 34#include <sys/systm.h> --- 123 unchanged lines hidden (view full) --- 158 if (ifp->if_flags & IFF_RUNNING) { 159 /* find internet addresses and delete routes */ 160 register struct ifaddr *ifa; 161 TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { 162 rtinit(ifa, (int)RTM_DELETE, 0); 163 } 164 } 165 } |
166 | 166 IFNET_WLOCK(); |
167 TAILQ_REMOVE(&ifnet, ifp, if_link); | 167 TAILQ_REMOVE(&ifnet, ifp, if_link); |
168 IFNET_WUNLOCK(); |
|
168 splx(s); 169 return 0; 170} 171 172static void 173ef_init(void *foo) { 174 return; 175} --- 327 unchanged lines hidden (view full) --- 503static int 504ef_load(void) 505{ 506 struct ifnet *ifp; 507 struct efnet *efp; 508 struct ef_link *efl = NULL; 509 int error = 0, d; 510 | 169 splx(s); 170 return 0; 171} 172 173static void 174ef_init(void *foo) { 175 return; 176} --- 327 unchanged lines hidden (view full) --- 504static int 505ef_load(void) 506{ 507 struct ifnet *ifp; 508 struct efnet *efp; 509 struct ef_link *efl = NULL; 510 int error = 0, d; 511 |
512 IFNET_RLOCK(); |
|
511 TAILQ_FOREACH(ifp, &ifnet, if_link) { 512 if (ifp->if_type != IFT_ETHER) continue; 513 EFDEBUG("Found interface %s%d\n", ifp->if_name, ifp->if_unit); 514 efl = (struct ef_link*)malloc(sizeof(struct ef_link), 515 M_IFADDR, M_WAITOK | M_ZERO); 516 if (efl == NULL) { 517 error = ENOMEM; 518 break; --- 14 unchanged lines hidden (view full) --- 533#endif 534#ifdef ETHER_SNAP 535 error = ef_clone(efl, ETHER_FT_SNAP); 536 if (error) break; 537#endif 538 efcount++; 539 SLIST_INSERT_HEAD(&efdev, efl, el_next); 540 } | 513 TAILQ_FOREACH(ifp, &ifnet, if_link) { 514 if (ifp->if_type != IFT_ETHER) continue; 515 EFDEBUG("Found interface %s%d\n", ifp->if_name, ifp->if_unit); 516 efl = (struct ef_link*)malloc(sizeof(struct ef_link), 517 M_IFADDR, M_WAITOK | M_ZERO); 518 if (efl == NULL) { 519 error = ENOMEM; 520 break; --- 14 unchanged lines hidden (view full) --- 535#endif 536#ifdef ETHER_SNAP 537 error = ef_clone(efl, ETHER_FT_SNAP); 538 if (error) break; 539#endif 540 efcount++; 541 SLIST_INSERT_HEAD(&efdev, efl, el_next); 542 } |
543 IFNET_RUNLOCK(); |
|
541 if (error) { 542 if (efl) 543 SLIST_INSERT_HEAD(&efdev, efl, el_next); 544 SLIST_FOREACH(efl, &efdev, el_next) { 545 for (d = 0; d < EF_NFT; d++) 546 if (efl->el_units[d]) 547 free(efl->el_units[d], M_IFADDR); 548 free(efl, M_IFADDR); --- 56 unchanged lines hidden --- | 544 if (error) { 545 if (efl) 546 SLIST_INSERT_HEAD(&efdev, efl, el_next); 547 SLIST_FOREACH(efl, &efdev, el_next) { 548 for (d = 0; d < EF_NFT; d++) 549 if (efl->el_units[d]) 550 free(efl->el_units[d], M_IFADDR); 551 free(efl, M_IFADDR); --- 56 unchanged lines hidden --- |