Lines Matching refs:ifp
129 void if_rtproto_del(struct ifnet *ifp, int protocol);
174 struct ifnet *ifp,
177 ifnet_lock_assert(ifp, LCK_MTX_ASSERT_OWNED);
183 TAILQ_INSERT_TAIL(&ifp->if_addrhead, ifa, ifa_link);
188 struct ifnet *ifp,
191 ifnet_lock_assert(ifp, LCK_MTX_ASSERT_OWNED);
200 TAILQ_FOREACH(ifa2, &ifp->if_addrhead, ifa_link) {
209 TAILQ_REMOVE(&ifp->if_addrhead, ifa, ifa_link);
225 * ifindex2ifnet[] is indexed by ifp->if_index. That requires us to
359 struct ifnet *ifp;
370 ifp = ifunit(name);
371 if (ifp == NULL)
377 (*ifc->ifc_destroy)(ifp);
524 struct ifnet *ifp;
530 for (ifp = ifnet_head.tqh_first; ifp && !result; ifp = ifp->if_link.tqe_next) {
531 ifnet_lock_shared(ifp);
532 for (ifa = ifp->if_addrhead.tqh_first; ifa;
543 ifnet_lock_done(ifp);
554 ifa_ifpgetprimary(struct ifnet *ifp, int family)
558 ifnet_lock_shared(ifp);
559 TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
567 ifnet_lock_done(ifp);
580 struct ifnet *ifp;
588 for (ifp = ifnet_head.tqh_first; ifp && !result; ifp = ifp->if_link.tqe_next) {
589 ifnet_lock_shared(ifp);
590 for (ifa = ifp->if_addrhead.tqh_first; ifa;
598 if ((ifp->if_flags & IFF_BROADCAST) && ifa->ifa_broadaddr &&
608 ifnet_lock_done(ifp);
622 struct ifnet *ifp;
627 for (ifp = ifnet_head.tqh_first; ifp && !result; ifp = ifp->if_link.tqe_next) {
628 if (ifp->if_flags & IFF_POINTOPOINT) {
629 ifnet_lock_shared(ifp);
630 for (ifa = ifp->if_addrhead.tqh_first; ifa;
641 ifnet_lock_done(ifp);
655 struct ifnet *ifp;
666 ifp = ifindex2ifnet[ifscope];
667 if (ifp != NULL) {
674 ifnet_lock_shared(ifp);
675 for (ifa = ifp->if_addrhead.tqh_first; ifa != NULL;
683 if ((ifp->if_flags & IFF_BROADCAST) &&
694 ifnet_lock_done(ifp);
720 struct ifnet *ifp;
751 for (ifp = ifnet_head.tqh_first; ifp; ifp = ifp->if_link.tqe_next) {
752 ifnet_lock_shared(ifp);
753 for (ifa = ifp->if_addrhead.tqh_first; ifa;
769 ifp->if_flags & IFF_POINTOPOINT) {
790 ifp->if_index != ifscope)
847 * releasing the ifp lock
849 ifnet_lock_done(ifp);
872 struct ifnet *ifp)
884 ifnet_lock_shared(ifp);
885 for (ifa = ifp->if_addrhead.tqh_first; ifa;
897 if (ifp->if_flags & IFF_POINTOPOINT) {
930 ifnet_lock_done(ifp);
946 struct ifnet *ifp;
949 ((ifp = ifa->ifa_ifp) == 0) || ((dst = rt_key(rt)) == 0))
951 ifa = ifaof_ifpforaddr(dst, ifp);
973 struct ifnet *ifp,
981 while ((ifp->if_eflags & IFEF_UPDOWNCHANGE) != 0) {
984 ifnet_lock_done(ifp);
985 msleep(&ifp->if_eflags, NULL, 0, "if_updown", &tv);
986 ifnet_lock_exclusive(ifp);
990 if ((!up && (ifp->if_flags & IFF_UP) == 0) ||
991 (up && (ifp->if_flags & IFF_UP) == IFF_UP)) {
996 ifp->if_eflags |= IFEF_UPDOWNCHANGE;
1000 ifp->if_flags |= IFF_UP;
1003 ifp->if_flags &= ~IFF_UP;
1006 ifnet_touch_lastchange(ifp);
1009 ifnet_lock_done(ifp);
1010 if (ifnet_get_address_list(ifp, &ifa) == 0) {
1016 rt_ifmsg(ifp);
1019 ifnet_lock_exclusive(ifp);
1021 if_qflush(&ifp->if_snd);
1022 ifp->if_eflags &= ~IFEF_UPDOWNCHANGE;
1023 wakeup(&ifp->if_eflags);
1034 struct ifnet *ifp)
1036 ifnet_lock_exclusive(ifp);
1037 if_updown(ifp, 0);
1038 ifnet_lock_done(ifp);
1047 struct ifnet *ifp)
1049 ifnet_lock_exclusive(ifp);
1050 if_updown(ifp, 1);
1051 ifnet_lock_done(ifp);
1081 struct ifnet *ifp;
1111 TAILQ_FOREACH(ifp, &ifnet_head, if_link) {
1112 if (strncmp(ifp->if_name, namebuf, len))
1114 if (unit == ifp->if_unit)
1118 return (ifp);
1155 struct ifnet *ifp;
1201 ifp = ifunit(ifr->ifr_name);
1202 if (ifp == 0)
1207 ifnet_lock_shared(ifp);
1208 ifr->ifr_flags = ifp->if_flags;
1209 ifnet_lock_done(ifp);
1214 error = mac_ifnet_label_get(kauth_cred_get(), ifr, ifp);
1220 ifnet_lock_shared(ifp);
1221 ifr->ifr_metric = ifp->if_metric;
1222 ifnet_lock_done(ifp);
1226 ifnet_lock_shared(ifp);
1227 ifr->ifr_mtu = ifp->if_mtu;
1228 ifnet_lock_done(ifp);
1232 ifnet_lock_shared(ifp);
1233 ifr->ifr_phys = ifp->if_physical;
1234 ifnet_lock_done(ifp);
1242 ifnet_set_flags(ifp, ifr->ifr_flags, (u_int16_t)~IFF_CANTCHANGE);
1244 error = ifnet_ioctl(ifp, so->so_proto->pr_domain->dom_family,
1253 strlcpy(&ev_data.if_name[0], ifp->if_name, IFNAMSIZ);
1254 ev_data.if_family = ifp->if_family;
1255 ev_data.if_unit = (unsigned long) ifp->if_unit;
1261 ifnet_touch_lastchange(ifp);
1266 error = mac_ifnet_label_set(kauth_cred_get(), ifr, ifp);
1275 ifp->if_metric = ifr->ifr_metric;
1283 strlcpy(&ev_data.if_name[0], ifp->if_name, IFNAMSIZ);
1284 ev_data.if_family = ifp->if_family;
1285 ev_data.if_unit = (unsigned long) ifp->if_unit;
1292 ifnet_touch_lastchange(ifp);
1300 error = ifnet_ioctl(ifp, so->so_proto->pr_domain->dom_family,
1309 strlcpy(&ev_data.if_name[0], ifp->if_name, IFNAMSIZ);
1310 ev_data.if_family = ifp->if_family;
1311 ev_data.if_unit = (unsigned long) ifp->if_unit;
1317 ifnet_touch_lastchange(ifp);
1323 u_long oldmtu = ifp->if_mtu;
1328 if (ifp->if_ioctl == NULL)
1333 error = ifnet_ioctl(ifp, so->so_proto->pr_domain->dom_family,
1342 strlcpy(&ev_data.if_name[0], ifp->if_name, IFNAMSIZ);
1343 ev_data.if_family = ifp->if_family;
1344 ev_data.if_unit = (unsigned long) ifp->if_unit;
1350 ifnet_touch_lastchange(ifp);
1351 rt_ifmsg(ifp);
1358 if (error == 0 && ifp->if_mtu != oldmtu) {
1359 if_rtmtu_update(ifp);
1361 nd6_setmtu(ifp);
1374 if ((ifp->if_flags & IFF_MULTICAST) == 0)
1384 error = if_addmulti(ifp, &ifr->ifr_addr, NULL);
1387 error = if_delmulti(ifp, &ifr->ifr_addr);
1394 strlcpy(&ev_data.if_name[0], ifp->if_name, IFNAMSIZ);
1396 ev_data.if_family = ifp->if_family;
1397 ev_data.if_unit = (unsigned long) ifp->if_unit;
1403 ifnet_touch_lastchange(ifp);
1423 error = ifnet_ioctl(ifp, so->so_proto->pr_domain->dom_family,
1427 ifnet_touch_lastchange(ifp);
1440 return ifnet_ioctl(ifp, so->so_proto->pr_domain->dom_family,
1444 return ifnet_ioctl(ifp, so->so_proto->pr_domain->dom_family,
1448 oif_flags = ifp->if_flags;
1489 data, ifp, p));
1508 error = ifnet_ioctl(ifp, so->so_proto->pr_domain->dom_family,
1528 * Set/clear promiscuous mode on interface ifp based on the truth value
1535 ifnet_t ifp,
1544 ifnet_lock_exclusive(ifp);
1546 oldflags = ifp->if_flags;
1552 if ((ifp->if_flags & IFF_UP) == 0) {
1556 if (ifp->if_pcount++ != 0) {
1559 ifp->if_flags |= IFF_PROMISC;
1561 if (--ifp->if_pcount > 0)
1563 ifp->if_flags &= ~IFF_PROMISC;
1565 ifr.ifr_flags = ifp->if_flags;
1567 ifnet_lock_done(ifp);
1568 error = ifnet_ioctl(ifp, 0, SIOCSIFFLAGS, &ifr);
1570 rt_ifmsg(ifp);
1572 ifp->if_flags = oldflags;
1574 if (locked) ifnet_lock_done(ifp);
1577 ifp->if_name, ifp->if_unit,
1593 struct ifnet *ifp = NULL;
1607 for (ifp = ifnet_head.tqh_first; space > sizeof(ifr) && ifp; ifp = ifp->if_link.tqe_next) {
1612 "%s%d", ifp->if_name, ifp->if_unit);
1620 ifnet_lock_shared(ifp);
1623 ifa = ifp->if_addrhead.tqh_first;
1659 ifnet_lock_done(ifp);
1681 if_allmulti(struct ifnet *ifp, int onswitch)
1686 ifnet_lock_exclusive(ifp);
1689 if (ifp->if_amcount++ == 0) {
1690 ifp->if_flags |= IFF_ALLMULTI;
1694 if (ifp->if_amcount > 1) {
1695 ifp->if_amcount--;
1697 ifp->if_amcount = 0;
1698 ifp->if_flags &= ~IFF_ALLMULTI;
1702 ifnet_lock_done(ifp);
1705 error = ifnet_ioctl(ifp, 0, SIOCSIFFLAGS, NULL);
1708 rt_ifmsg(ifp);
1752 struct ifnet *ifp,
1757 for (ifma = ifp->if_multiaddrs.lh_first; ifma;
1843 struct ifnet *ifp, /* interface to manipulate */
1863 ifnet_lock_exclusive(ifp);
1864 error = if_addmulti_doesexist(ifp, sa, retifma);
1865 ifnet_lock_done(ifp);
1876 error = dlil_resolve_multi(ifp, sa, (struct sockaddr*)&storage,
1914 ifnet_lock_exclusive(ifp);
1918 if ((error = if_addmulti_doesexist(ifp, sa, retifma)) == 0) {
1919 ifnet_lock_done(ifp);
1925 ifma->ifma_ifp = ifp;
1930 if (if_addmulti_doesexist(ifp, llsa, &ifma->ifma_ll) == 0) {
1936 llifma->ifma_ifp = ifp;
1939 LIST_INSERT_HEAD(&ifp->if_multiaddrs, llifma, ifma_link);
1946 LIST_INSERT_HEAD(&ifp->if_multiaddrs, ifma, ifma_link);
1953 ifnet_lock_done(ifp);
1962 ifnet_ioctl(ifp, 0, SIOCADDMULTI, NULL);
1984 struct ifnet *ifp;
1987 ifp = ifma->ifma_ifp;
1989 if (!locked && ifp) {
1990 ifnet_lock_exclusive(ifp);
2001 if (ifp)
2007 if (ifp)
2008 ifnet_lock_done(ifp);
2010 if (ifp)
2011 ifnet_lock_exclusive(ifp);
2019 if (ifp && ifma->ifma_addr->sa_family == AF_LINK)
2024 if (ifp)
2030 if (!locked && ifp) {
2032 ifnet_lock_done(ifp);
2037 ifnet_lock_done(ifp);
2038 ifnet_ioctl(ifp, 0, SIOCDELMULTI, NULL);
2040 ifnet_lock_exclusive(ifp);
2052 struct ifnet *ifp,
2067 ifnet_lock_exclusive(ifp);
2068 for (ifma = ifp->if_multiaddrs.lh_first; ifma;
2073 ifnet_lock_done(ifp);
2080 ifnet_lock_done(ifp);
2094 if_setlladdr(struct ifnet *ifp, const u_char *lladdr, int len)
2101 ifmaof_ifpforaddr(const struct sockaddr *sa, struct ifnet *ifp)
2105 ifnet_lock_shared(ifp);
2106 for (ifma = ifp->if_multiaddrs.lh_first; ifma;
2110 ifnet_lock_done(ifp);
2126 struct ifnet **ifp;
2130 if (ifnet_list_get_all(IFNET_FAMILY_ANY, &ifp, &count) == 0) {
2132 if_down(ifp[i]);
2133 dlil_proto_unplumb_all(ifp[i]);
2135 ifnet_list_free(ifp);
2162 struct ifnet *ifp = arg;
2165 if (rt != NULL && rt->rt_ifp == ifp) {
2189 void if_rtproto_del(struct ifnet *ifp, int protocol)
2195 ((rnh = rt_tables[protocol]) != NULL) && (ifp != NULL)) {
2197 (void) rnh->rnh_walktree(rnh, if_rtdel, ifp);
2206 struct ifnet *ifp = arg;
2208 if (rt->rt_ifp == ifp) {
2215 rt->rt_rmx.rmx_mtu = ifp->if_mtu;
2227 void if_rtmtu_update(struct ifnet *ifp)
2237 (void) rnh->rnh_walktree(rnh, if_rtmtu, ifp);
2247 struct ifnet *ifp,
2252 if ((thread = ifp->if_input_thread) == NULL || (dlil_multithreaded_input == 0))
2305 struct ifnet *ifp,
2310 if ((thread = ifp->if_input_thread) == NULL || (dlil_multithreaded_input == 0))