Lines Matching refs:ifp

90 #define PREF(p, ifp) ((int)(p) <= ((ifp)->int_metric+(ifp)->int_adj_outmetric)\  argument
92 : (p) - ((ifp)->int_metric+(ifp)->int_adj_outmetric))
103 struct interface *ifp, in trace_rdisc() argument
120 ifp ? ifp->int_name : "?", in trace_rdisc()
137 ifp ? ifp->int_name : "?", in trace_rdisc()
160 set_rdisc_mg(struct interface *ifp, in set_rdisc_mg() argument
166 assert(ifp != NULL); in set_rdisc_mg()
172 if ((ifp->int_state & IS_NO_RDISC) == IS_NO_RDISC in set_rdisc_mg()
178 if (!(ifp->int_if_flags & IFF_MULTICAST)) { in set_rdisc_mg()
179 ifp->int_state &= ~(IS_ALL_HOSTS | IS_ALL_ROUTERS); in set_rdisc_mg()
184 gr.gr_interface = ifp->int_index; in set_rdisc_mg()
192 || (ifp->int_state & IS_NO_ADV_IN) in set_rdisc_mg()
196 if (ifp->int_state & IS_ALL_HOSTS) { in set_rdisc_mg()
202 ifp->int_state &= ~IS_ALL_HOSTS; in set_rdisc_mg()
205 } else if (!(ifp->int_state & IS_ALL_HOSTS)) { in set_rdisc_mg()
213 ifp->int_state |= IS_ALL_HOSTS; in set_rdisc_mg()
218 || (ifp->int_state & IS_NO_ADV_OUT) in set_rdisc_mg()
222 if (ifp->int_state & IS_ALL_ROUTERS) { in set_rdisc_mg()
228 ifp->int_state &= ~IS_ALL_ROUTERS; in set_rdisc_mg()
231 } else if (!(ifp->int_state & IS_ALL_ROUTERS)) { in set_rdisc_mg()
239 ifp->int_state |= IS_ALL_ROUTERS; in set_rdisc_mg()
250 struct interface *ifp; in set_supplier() local
275 LIST_FOREACH(ifp, &ifnet, int_list) { in set_supplier()
276 if (ifp->int_state & IS_BROKE) in set_supplier()
278 ifp->int_rdisc_cnt = 0; in set_supplier()
279 ifp->int_rdisc_timer.tv_usec = rdisc_timer.tv_usec; in set_supplier()
280 ifp->int_rdisc_timer.tv_sec = now.tv_sec+MIN_WAITTIME; in set_supplier()
281 set_rdisc_mg(ifp, 1); in set_supplier()
358 if_bad_rdisc(struct interface *ifp) in if_bad_rdisc() argument
363 if (drp->dr_ifp != ifp) in if_bad_rdisc()
378 if_ok_rdisc(struct interface *ifp) in if_ok_rdisc() argument
380 set_rdisc_mg(ifp, 1); in if_ok_rdisc()
382 ifp->int_rdisc_cnt = 0; in if_ok_rdisc()
383 ifp->int_rdisc_timer.tv_sec = now.tv_sec + (supplier in if_ok_rdisc()
386 if (timercmp(&rdisc_timer, &ifp->int_rdisc_timer, >)) in if_ok_rdisc()
387 rdisc_timer = ifp->int_rdisc_timer; in if_ok_rdisc()
396 struct interface *ifp; in del_rdisc() local
409 ifp = drp->dr_ifp; in del_rdisc()
412 && drp->dr_ifp == ifp) in del_rdisc()
423 naddr_ntoa(gate), ifp->int_name, i); in del_rdisc()
424 } else if (ifp->int_rdisc_cnt >= MAX_SOLICITATIONS) { in del_rdisc()
427 naddr_ntoa(gate), ifp->int_name); in del_rdisc()
428 ifp->int_rdisc_cnt = 0; in del_rdisc()
429 ifp->int_rdisc_timer.tv_sec = 0; in del_rdisc()
434 naddr_ntoa(gate), ifp->int_name); in del_rdisc()
448 struct interface *ifp; in rdisc_sort() local
459 ifp = drp->dr_ifp; in rdisc_sort()
473 drp->dr_pref = PREF(drp->dr_recv_pref, ifp); in rdisc_sort()
565 struct interface *ifp) in parse_ad() argument
585 if (!on_net(gate, ifp->int_net, ifp->int_mask)) { in parse_ad()
619 if ((!(ifp->int_state & IS_SICK) in parse_ad()
622 && !((ifp->int_state ^ drp->dr_ifp->int_state) in parse_ad()
643 new_drp->dr_ifp = ifp; in parse_ad()
649 new_drp->dr_pref = PREF(pref,ifp); in parse_ad()
653 if (!(ifp->int_state & IS_SICK)) in parse_ad()
654 ifp->int_rdisc_cnt = MAX_SOLICITATIONS; in parse_ad()
686 struct interface *ifp, in send_rdisc() argument
710 if (ifp->int_if_flags & IFF_POINTOPOINT) { in send_rdisc()
712 rsin.sin_addr.s_addr = ifp->int_dstaddr; in send_rdisc()
715 rsin.sin_addr.s_addr = ifp->int_brdaddr; in send_rdisc()
721 if (ifp->int_state & IS_DUP) { in send_rdisc()
724 ifp->int_name); in send_rdisc()
727 if (rdisc_sock_mcast != ifp) { in send_rdisc()
732 mreqn.imr_ifindex = ifp->int_index; in send_rdisc()
742 rdisc_sock_mcast = ifp; in send_rdisc()
751 trace_rdisc(msg, (ifp ? ifp->int_addr : 0), rsin.sin_addr.s_addr, ifp, in send_rdisc()
756 if (ifp == NULL || !(ifp->int_state & IS_BROKE)) in send_rdisc()
758 ifp != NULL ? ifp->int_name : "", in send_rdisc()
759 ifp != NULL ? ", " : "", in send_rdisc()
762 if (ifp != NULL) in send_rdisc()
763 if_sick(ifp); in send_rdisc()
771 send_adv(struct interface *ifp, in send_adv() argument
785 u.ad.icmp_ad_life = stopint ? 0 : htons(ifp->int_rdisc_int*3); in send_adv()
791 pref = UNSIGN_PREF(ifp->int_rdisc_pref); in send_adv()
792 u.ad.icmp_ad_info[0].icmp_ad_pref = htonl(SIGN_PREF(PREF(pref, ifp))); in send_adv()
794 u.ad.icmp_ad_info[0].icmp_ad_addr = ifp->int_addr; in send_adv()
798 send_rdisc(&u, sizeof(u.ad), ifp, dst, type); in send_adv()
807 struct interface *ifp; in rdisc_adv() local
814 LIST_FOREACH(ifp, &ifnet, int_list) { in rdisc_adv()
815 if (0 != (ifp->int_state & (IS_NO_ADV_OUT | IS_BROKE))) in rdisc_adv()
818 if (!timercmp(&ifp->int_rdisc_timer, &now, >) in rdisc_adv()
820 send_adv(ifp, htonl(INADDR_ALLHOSTS_GROUP), in rdisc_adv()
821 (ifp->int_state&IS_BCAST_RDISC) ? 1 : 2); in rdisc_adv()
822 ifp->int_rdisc_cnt++; in rdisc_adv()
824 intvl_random(&ifp->int_rdisc_timer, in rdisc_adv()
825 (ifp->int_rdisc_int*3)/4, in rdisc_adv()
826 ifp->int_rdisc_int); in rdisc_adv()
827 if (ifp->int_rdisc_cnt < MAX_INITIAL_ADVERTS in rdisc_adv()
828 && (ifp->int_rdisc_timer.tv_sec in rdisc_adv()
830 ifp->int_rdisc_timer.tv_sec in rdisc_adv()
833 timevaladd(&ifp->int_rdisc_timer, &now); in rdisc_adv()
836 if (timercmp(&rdisc_timer, &ifp->int_rdisc_timer, >)) in rdisc_adv()
837 rdisc_timer = ifp->int_rdisc_timer; in rdisc_adv()
847 struct interface *ifp; in rdisc_sol() local
856 LIST_FOREACH(ifp, &ifnet, int_list) { in rdisc_sol()
857 if (0 != (ifp->int_state & (IS_NO_SOL_OUT | IS_BROKE)) in rdisc_sol()
858 || ifp->int_rdisc_cnt >= MAX_SOLICITATIONS) in rdisc_sol()
861 if (!timercmp(&ifp->int_rdisc_timer, &now, >)) { in rdisc_sol()
866 send_rdisc(&u, sizeof(u.so), ifp, in rdisc_sol()
868 ((ifp->int_state&IS_BCAST_RDISC) ? 1 : 2)); in rdisc_sol()
870 if (++ifp->int_rdisc_cnt >= MAX_SOLICITATIONS) in rdisc_sol()
873 ifp->int_rdisc_timer.tv_sec = SOLICITATION_INTERVAL; in rdisc_sol()
874 ifp->int_rdisc_timer.tv_usec = 0; in rdisc_sol()
875 timevaladd(&ifp->int_rdisc_timer, &now); in rdisc_sol()
878 if (timercmp(&rdisc_timer, &ifp->int_rdisc_timer, >)) in rdisc_sol()
879 rdisc_timer = ifp->int_rdisc_timer; in rdisc_sol()
888 struct interface *ifp, in ck_icmp() argument
911 trace_rdisc(act, from, to, ifp, p, len); in ck_icmp()
913 if (ifp == NULL) in ck_icmp()
918 return ifp; in ck_icmp()
944 struct interface *ifp; in read_d() local
973 ifp = ifwithname(buf.ifname, 0); in read_d()
974 if (ifp == NULL) in read_d()
982 ifp = ((from.sin_addr.s_addr == 0) in read_d()
985 ifp = ck_icmp("Recv", from.sin_addr.s_addr, ifp, in read_d()
987 if (ifp == NULL) in read_d()
1019 if (ifp->int_state & IS_NO_ADV_IN) in read_d()
1027 ifp); in read_d()
1036 if (ifp->int_state & IS_NO_ADV_OUT) in read_d()
1046 send_adv(ifp, from.sin_addr.s_addr, 0); in read_d()