Lines 54-66
Link Here
|
54 |
#ifdef INET |
54 |
#ifdef INET |
|
|
55 |
#include <netinet/in_var.h> |
55 |
#ifdef INET6 |
56 |
#ifdef INET6 |
|
|
57 |
#include <netinet/icmp6.h> |
58 |
#include <netinet6/ip6_var.h> |
59 |
#include <netinet6/in6_var.h> |
60 |
#include <netinet6/scope6_var.h> |
61 |
#include <netinet6/nd6.h> |
56 |
#include <net/if_vlan_var.h> |
62 |
#include <net/if_vlan_var.h> |
Lines 746-751
Link Here
|
746 |
switch (dst->sa_family) { |
752 |
switch (dst->sa_family) { |
747 |
case pseudo_AF_HDRCMPLT: |
753 |
case pseudo_AF_HDRCMPLT: |
|
|
754 |
return ((*lp->lp_output)(ifp, m, dst, ro)); |
748 |
case AF_UNSPEC: |
755 |
case AF_UNSPEC: |
749 |
eh = (struct ether_header *)dst->sa_data; |
756 |
eh = (struct ether_header *)dst->sa_data; |
750 |
type = eh->ether_type; |
757 |
type = eh->ether_type; |
Lines 1053-1059
Link Here
|
1053 |
error = EINVAL; |
1060 |
error = EINVAL; |
1054 |
break; |
1061 |
break; |
1055 |
default: |
1062 |
case SIOCSPLAGGPORT: |
|
|
1063 |
|
1064 |
if (rp->rp_portname[0] == '\0' || |
1065 |
(tpif = ifunit(rp->rp_portname)) == NULL) { |
1066 |
error = EINVAL; |
1067 |
break; |
1068 |
} |
1069 |
|
1070 |
LAGG_WLOCK(sc); |
1071 |
if ((lp = (struct lagg_port *)tpif->if_lagg) == NULL || |
1072 |
lp->lp_softc != sc) { |
1073 |
error = ENOENT; |
1074 |
LAGG_WUNLOCK(sc); |
1075 |
break; |
1076 |
} |
1077 |
/* This port is already primary port no need to do any thing */ |
1078 |
if(SLIST_FIRST(&sc->sc_ports)== lp){ |
1079 |
LAGG_WUNLOCK(sc); |
1080 |
return (error); |
1081 |
} |
1082 |
else{ |
1083 |
SLIST_REMOVE(&sc->sc_ports, lp, lagg_port, lp_entries); |
1084 |
SLIST_INSERT_HEAD(&sc->sc_ports, lp, lp_entries); |
1085 |
sc->sc_primary = lp; |
1086 |
lagg_lladdr(sc, lp->lp_lladdr); |
1087 |
sc->sc_ifp->if_mtu = tpif->if_mtu; |
1088 |
SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) |
1089 |
lagg_port_lladdr(lp, IF_LLADDR(ifp)); |
1090 |
LAGG_WUNLOCK(sc); |
1091 |
} |
1092 |
break; |
1093 |
default: |
1056 |
error = ether_ioctl(ifp, cmd, data); |
1094 |
error = ether_ioctl(ifp, cmd, data); |
1057 |
break; |
1095 |
break; |
1058 |
} |
1096 |
} |
Lines 1309-1325
Link Here
|
1309 |
struct lagg_port *lp = (struct lagg_port *)ifp->if_lagg; |
1347 |
struct lagg_port *lp = (struct lagg_port *)ifp->if_lagg; |
1310 |
struct lagg_softc *sc = NULL; |
1348 |
struct lagg_softc *sc = NULL; |
|
|
1349 |
struct ifaddr *ifa ; |
1350 |
struct in6_ifaddr *ia = NULL; |
1351 |
struct in6_addr *in6 = NULL; |
1352 |
struct ifaddrhead ifaddrh; |
1353 |
struct in_ifaddr *laddr = NULL; |
1311 |
|
1354 |
|
1312 |
if (lp != NULL) |
1355 |
if (lp != NULL) |
1313 |
sc = lp->lp_softc; |
1356 |
sc = lp->lp_softc; |
1314 |
if (sc == NULL) |
1357 |
if (sc == NULL) |
1315 |
return; |
1358 |
return; |
1316 |
|
1359 |
|
1317 |
LAGG_WLOCK(sc); |
1360 |
LAGG_WLOCK(sc); |
1318 |
lagg_linkstate(sc); |
1361 |
lagg_linkstate(sc); |
|
|
1362 |
|
1319 |
if (sc->sc_linkstate != NULL) |
1363 |
if (sc->sc_linkstate != NULL) |
1320 |
(*sc->sc_linkstate)(lp); |
1364 |
(*sc->sc_linkstate)(lp); |
|
|
1365 |
|
1321 |
LAGG_WUNLOCK(sc); |
1366 |
LAGG_WUNLOCK(sc); |
|
|
1367 |
|
1368 |
/* If status changed on primary port send gratuitous ARP */ |
1369 |
|
1370 |
if(sc->sc_primary == lp){ |
1371 |
IFP_TO_IA(sc->sc_ifp, laddr); |
1372 |
if (laddr == NULL) |
1373 |
return; |
1374 |
ifaddrh = sc->sc_ifp->if_addrhead; |
1375 |
TAILQ_FOREACH(ifa, &ifaddrh, ifa_link) { |
1376 |
#ifdef INET |
1377 |
if(ifa->ifa_addr->sa_family == AF_INET) |
1378 |
arp_ifinit(sc->sc_ifp,(struct ifaddr *) laddr); |
1379 |
#endif |
1380 |
|
1381 |
#ifdef INET6 |
1382 |
if (ifa->ifa_addr->sa_family == AF_INET6){ |
1383 |
ia = in6ifa_ifpforlinklocal(sc->sc_ifp, 0); |
1384 |
in6 = &ifatoia6(ifa)->ia_addr.sin6_addr; |
1385 |
nd6_ns_output(sc->sc_ifp, NULL,in6, 0, 1); |
1386 |
} |
1387 |
#endif |
1388 |
} |
1389 |
} |
1322 |
struct lagg_port * |
1390 |
struct lagg_port * |