Deleted Added
full compact
if.c (146620) if.c (146986)
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 146620 2005-05-25 13:52:03Z peadar $
30 * $FreeBSD: head/sys/net/if.c 146986 2005-06-05 03:13:13Z thompsa $
31 */
32
33#include "opt_compat.h"
34#include "opt_inet6.h"
35#include "opt_inet.h"
36#include "opt_mac.h"
37#include "opt_carp.h"
38

--- 49 unchanged lines hidden (view full) ---

88
89/* Log link state change events */
90static int log_link_state_change = 1;
91
92SYSCTL_INT(_net_link, OID_AUTO, log_link_state_change, CTLFLAG_RW,
93 &log_link_state_change, 0,
94 "log interface link state change events");
95
31 */
32
33#include "opt_compat.h"
34#include "opt_inet6.h"
35#include "opt_inet.h"
36#include "opt_mac.h"
37#include "opt_carp.h"
38

--- 49 unchanged lines hidden (view full) ---

88
89/* Log link state change events */
90static int log_link_state_change = 1;
91
92SYSCTL_INT(_net_link, OID_AUTO, log_link_state_change, CTLFLAG_RW,
93 &log_link_state_change, 0,
94 "log interface link state change events");
95
96void (*bstp_linkstate_p)(struct ifnet *ifp, int state);
96void (*ng_ether_link_state_p)(struct ifnet *ifp, int state);
97
98struct mbuf *(*tbr_dequeue_ptr)(struct ifaltq *, int) = NULL;
99
100static void if_attachdomain(void *);
101static void if_attachdomain1(struct ifnet *);
102static int ifconf(u_long, caddr_t);
103static void if_grow(void);

--- 228 unchanged lines hidden (view full) ---

332 const char *name, *p;
333
334 switch (ifp->if_type) {
335 case IFT_ETHER: /* these types use struct arpcom */
336 case IFT_FDDI:
337 case IFT_XETHER:
338 case IFT_ISO88025:
339 case IFT_L2VLAN:
97void (*ng_ether_link_state_p)(struct ifnet *ifp, int state);
98
99struct mbuf *(*tbr_dequeue_ptr)(struct ifaltq *, int) = NULL;
100
101static void if_attachdomain(void *);
102static void if_attachdomain1(struct ifnet *);
103static int ifconf(u_long, caddr_t);
104static void if_grow(void);

--- 228 unchanged lines hidden (view full) ---

333 const char *name, *p;
334
335 switch (ifp->if_type) {
336 case IFT_ETHER: /* these types use struct arpcom */
337 case IFT_FDDI:
338 case IFT_XETHER:
339 case IFT_ISO88025:
340 case IFT_L2VLAN:
341 case IFT_BRIDGE:
340 snprintf(eaddr, 18, "%6D", IFP2AC(ifp)->ac_enaddr, ":");
341 break;
342 default:
343 eaddr[0] = '\0';
344 break;
345 }
346 strlcpy(devname, ifp->if_xname, sizeof(devname));
347 name = net_cdevsw.d_name;

--- 696 unchanged lines hidden (view full) ---

1044
1045 if ((ifp->if_type == IFT_ETHER || ifp->if_type == IFT_L2VLAN) &&
1046 IFP2AC(ifp)->ac_netgraph != NULL)
1047 (*ng_ether_link_state_p)(ifp, link_state);
1048#ifdef DEV_CARP
1049 if (ifp->if_carp)
1050 carp_carpdev_state(ifp->if_carp);
1051#endif
342 snprintf(eaddr, 18, "%6D", IFP2AC(ifp)->ac_enaddr, ":");
343 break;
344 default:
345 eaddr[0] = '\0';
346 break;
347 }
348 strlcpy(devname, ifp->if_xname, sizeof(devname));
349 name = net_cdevsw.d_name;

--- 696 unchanged lines hidden (view full) ---

1046
1047 if ((ifp->if_type == IFT_ETHER || ifp->if_type == IFT_L2VLAN) &&
1048 IFP2AC(ifp)->ac_netgraph != NULL)
1049 (*ng_ether_link_state_p)(ifp, link_state);
1050#ifdef DEV_CARP
1051 if (ifp->if_carp)
1052 carp_carpdev_state(ifp->if_carp);
1053#endif
1054 if (ifp->if_bridge) {
1055 KASSERT(bstp_linkstate_p != NULL,("if_bridge bstp not loaded!"));
1056 (*bstp_linkstate_p)(ifp, link_state);
1057 }
1058
1052 if (pending > 1)
1053 if_printf(ifp, "%d link states coalesced\n", pending);
1054 if (log_link_state_change)
1055 log(LOG_NOTICE, "%s: link state changed to %s\n", ifp->if_xname,
1056 (link_state == LINK_STATE_UP) ? "UP" : "DOWN" );
1057}
1058
1059/*

--- 867 unchanged lines hidden (view full) ---

1927 if (len != sdl->sdl_alen) /* don't allow length to change */
1928 return (EINVAL);
1929 switch (ifp->if_type) {
1930 case IFT_ETHER: /* these types use struct arpcom */
1931 case IFT_FDDI:
1932 case IFT_XETHER:
1933 case IFT_ISO88025:
1934 case IFT_L2VLAN:
1059 if (pending > 1)
1060 if_printf(ifp, "%d link states coalesced\n", pending);
1061 if (log_link_state_change)
1062 log(LOG_NOTICE, "%s: link state changed to %s\n", ifp->if_xname,
1063 (link_state == LINK_STATE_UP) ? "UP" : "DOWN" );
1064}
1065
1066/*

--- 867 unchanged lines hidden (view full) ---

1934 if (len != sdl->sdl_alen) /* don't allow length to change */
1935 return (EINVAL);
1936 switch (ifp->if_type) {
1937 case IFT_ETHER: /* these types use struct arpcom */
1938 case IFT_FDDI:
1939 case IFT_XETHER:
1940 case IFT_ISO88025:
1941 case IFT_L2VLAN:
1942 case IFT_BRIDGE:
1935 bcopy(lladdr, IFP2AC(ifp)->ac_enaddr, len);
1936 /*
1937 * XXX We also need to store the lladdr in LLADDR(sdl),
1938 * which is done below. This is a pain because we must
1939 * remember to keep the info in sync.
1940 */
1941 /* FALLTHROUGH */
1942 case IFT_ARCNET:

--- 144 unchanged lines hidden ---
1943 bcopy(lladdr, IFP2AC(ifp)->ac_enaddr, len);
1944 /*
1945 * XXX We also need to store the lladdr in LLADDR(sdl),
1946 * which is done below. This is a pain because we must
1947 * remember to keep the info in sync.
1948 */
1949 /* FALLTHROUGH */
1950 case IFT_ARCNET:

--- 144 unchanged lines hidden ---