if_ethersubr.c (62838) | if_ethersubr.c (63090) |
---|---|
1/* 2 * Copyright (c) 1982, 1989, 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_ethersubr.c 8.1 (Berkeley) 6/10/93 | 1/* 2 * Copyright (c) 1982, 1989, 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_ethersubr.c 8.1 (Berkeley) 6/10/93 |
34 * $FreeBSD: head/sys/net/if_ethersubr.c 62838 2000-07-09 11:17:17Z itojun $ | 34 * $FreeBSD: head/sys/net/if_ethersubr.c 63090 2000-07-13 22:54:34Z archie $ |
35 */ 36 37#include "opt_atalk.h" 38#include "opt_inet.h" 39#include "opt_inet6.h" 40#include "opt_ipx.h" 41#include "opt_bdg.h" 42#include "opt_netgraph.h" --- 598 unchanged lines hidden (view full) --- 641 IF_ENQUEUE(inq, m); 642 splx(s); 643} 644 645/* 646 * Perform common duties while attaching to interface list 647 */ 648void | 35 */ 36 37#include "opt_atalk.h" 38#include "opt_inet.h" 39#include "opt_inet6.h" 40#include "opt_ipx.h" 41#include "opt_bdg.h" 42#include "opt_netgraph.h" --- 598 unchanged lines hidden (view full) --- 641 IF_ENQUEUE(inq, m); 642 splx(s); 643} 644 645/* 646 * Perform common duties while attaching to interface list 647 */ 648void |
649ether_ifattach(ifp) | 649ether_ifattach(ifp, bpf) |
650 register struct ifnet *ifp; | 650 register struct ifnet *ifp; |
651 int bpf; |
|
651{ 652 register struct ifaddr *ifa; 653 register struct sockaddr_dl *sdl; 654 | 652{ 653 register struct ifaddr *ifa; 654 register struct sockaddr_dl *sdl; 655 |
656 if_attach(ifp); |
|
655 ifp->if_type = IFT_ETHER; 656 ifp->if_addrlen = 6; 657 ifp->if_hdrlen = 14; 658 ifp->if_mtu = ETHERMTU; 659 ifp->if_resolvemulti = ether_resolvemulti; 660 if (ifp->if_baudrate == 0) 661 ifp->if_baudrate = 10000000; 662 ifa = ifnet_addrs[ifp->if_index - 1]; | 657 ifp->if_type = IFT_ETHER; 658 ifp->if_addrlen = 6; 659 ifp->if_hdrlen = 14; 660 ifp->if_mtu = ETHERMTU; 661 ifp->if_resolvemulti = ether_resolvemulti; 662 if (ifp->if_baudrate == 0) 663 ifp->if_baudrate = 10000000; 664 ifa = ifnet_addrs[ifp->if_index - 1]; |
663 if (ifa == 0) { 664 printf("ether_ifattach: no lladdr!\n"); 665 return; 666 } | 665 KASSERT(ifa != NULL, ("%s: no lladdr!\n", __FUNCTION__)); |
667 sdl = (struct sockaddr_dl *)ifa->ifa_addr; 668 sdl->sdl_type = IFT_ETHER; 669 sdl->sdl_alen = ifp->if_addrlen; 670 bcopy((IFP2AC(ifp))->ac_enaddr, LLADDR(sdl), ifp->if_addrlen); | 666 sdl = (struct sockaddr_dl *)ifa->ifa_addr; 667 sdl->sdl_type = IFT_ETHER; 668 sdl->sdl_alen = ifp->if_addrlen; 669 bcopy((IFP2AC(ifp))->ac_enaddr, LLADDR(sdl), ifp->if_addrlen); |
670 if (bpf) 671 bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header)); |
|
671 if (ng_ether_attach_p != NULL) 672 (*ng_ether_attach_p)(ifp); 673} 674 | 672 if (ng_ether_attach_p != NULL) 673 (*ng_ether_attach_p)(ifp); 674} 675 |
676/* 677 * Perform common duties while detaching an Ethernet interface 678 */ 679void 680ether_ifdetach(ifp, bpf) 681 struct ifnet *ifp; 682 int bpf; 683{ 684 if (ng_ether_detach_p != NULL) 685 (*ng_ether_detach_p)(ifp); 686 if (bpf) 687 bpfdetach(ifp); 688 if_detach(ifp); 689} 690 |
|
675SYSCTL_DECL(_net_link); 676SYSCTL_NODE(_net_link, IFT_ETHER, ether, CTLFLAG_RW, 0, "Ethernet"); 677 678int 679ether_ioctl(ifp, command, data) 680 struct ifnet *ifp; 681 int command; 682 caddr_t data; --- 180 unchanged lines hidden --- | 691SYSCTL_DECL(_net_link); 692SYSCTL_NODE(_net_link, IFT_ETHER, ether, CTLFLAG_RW, 0, "Ethernet"); 693 694int 695ether_ioctl(ifp, command, data) 696 struct ifnet *ifp; 697 int command; 698 caddr_t data; --- 180 unchanged lines hidden --- |