if.c (44144) | if.c (45720) |
---|---|
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 * $Id: if.c,v 1.65 1999/02/01 20:03:27 phk Exp $ | 34 * $Id: if.c,v 1.66 1999/02/19 13:41:35 phk Exp $ |
35 */ 36 37#include "opt_compat.h" 38 39#include <sys/param.h> 40#include <sys/malloc.h> 41#include <sys/mbuf.h> 42#include <sys/systm.h> --- 130 unchanged lines hidden (view full) --- 173 sdl = (struct sockaddr_dl *)(socksize + (caddr_t)sdl); 174 ifa->ifa_netmask = (struct sockaddr *)sdl; 175 sdl->sdl_len = masklen; 176 while (namelen != 0) 177 sdl->sdl_data[--namelen] = 0xff; 178 TAILQ_INSERT_HEAD(&ifp->if_addrhead, ifa, ifa_link); 179 } 180} | 35 */ 36 37#include "opt_compat.h" 38 39#include <sys/param.h> 40#include <sys/malloc.h> 41#include <sys/mbuf.h> 42#include <sys/systm.h> --- 130 unchanged lines hidden (view full) --- 173 sdl = (struct sockaddr_dl *)(socksize + (caddr_t)sdl); 174 ifa->ifa_netmask = (struct sockaddr *)sdl; 175 sdl->sdl_len = masklen; 176 while (namelen != 0) 177 sdl->sdl_data[--namelen] = 0xff; 178 TAILQ_INSERT_HEAD(&ifp->if_addrhead, ifa, ifa_link); 179 } 180} |
181 |
|
181/* | 182/* |
183 * Detach an interface, removing it from the 184 * list of "active" interfaces. 185 */ 186void 187if_detach(ifp) 188 struct ifnet *ifp; 189{ 190 struct ifaddr *ifa; 191 192 /* 193 * Remove routes and flush queues. 194 */ 195 if_down(ifp); 196 197 /* 198 * Remove address from ifnet_addrs[] and maybe decrement if_index. 199 * Clean up all addresses. 200 */ 201 ifnet_addrs[ifp->if_index] = 0; 202 while (ifnet_addrs[if_index] == 0) 203 if_index--; 204 205 for (ifa = TAILQ_FIRST(&ifp->if_addrhead); ifa; 206 ifa = TAILQ_FIRST(&ifp->if_addrhead)) { 207 TAILQ_REMOVE(&ifp->if_addrhead, ifa, ifa_link); 208 IFAFREE(ifa); 209 } 210 211 TAILQ_REMOVE(&ifnet, ifp, if_link); 212} 213 214/* |
|
182 * Locate an interface based on a complete address. 183 */ 184/*ARGSUSED*/ 185struct ifaddr * 186ifa_ifwithaddr(addr) 187 register struct sockaddr *addr; 188{ 189 register struct ifnet *ifp; --- 904 unchanged lines hidden --- | 215 * Locate an interface based on a complete address. 216 */ 217/*ARGSUSED*/ 218struct ifaddr * 219ifa_ifwithaddr(addr) 220 register struct sockaddr *addr; 221{ 222 register struct ifnet *ifp; --- 904 unchanged lines hidden --- |