Home | History | Annotate | Download | only in routed

Lines Matching refs:ifp

102 #define PREF(p, ifp) ((n_long)(p) <= (n_long)((ifp)->int_metric		\
103 + (ifp)->int_adj_outmetric) \
105 : (p) - ((ifp)->int_metric + (ifp)->int_adj_outmetric))
116 struct interface *ifp,
133 ifp ? ifp->int_name : "?",
150 ifp ? ifp->int_name : "?",
173 set_rdisc_mg(struct interface *ifp,
182 if ((ifp->int_state & IS_NO_RDISC) == IS_NO_RDISC
188 if (!(ifp->int_if_flags & IFF_MULTICAST)) {
189 ifp->int_state &= ~(IS_ALL_HOSTS | IS_ALL_ROUTERS);
194 if (ifp->int_if_flags & IFF_POINTOPOINT)
199 m.imr_interface.s_addr = htonl(ifp->int_index);
201 m.imr_interface.s_addr = ((ifp->int_if_flags & IFF_POINTOPOINT)
202 ? ifp->int_dstaddr
203 : ifp->int_addr);
206 || (ifp->int_state & IS_NO_ADV_IN)
210 if (ifp->int_state & IS_ALL_HOSTS) {
216 ifp->int_state &= ~IS_ALL_HOSTS;
219 } else if (!(ifp->int_state & IS_ALL_HOSTS)) {
227 ifp->int_state |= IS_ALL_HOSTS;
232 || (ifp->int_state & IS_NO_ADV_OUT)
236 if (ifp->int_state & IS_ALL_ROUTERS) {
242 ifp->int_state &= ~IS_ALL_ROUTERS;
245 } else if (!(ifp->int_state & IS_ALL_ROUTERS)) {
253 ifp->int_state |= IS_ALL_ROUTERS;
264 struct interface *ifp;
289 for (ifp = ifnet; ifp; ifp = ifp->int_next) {
290 if (ifp->int_state & IS_BROKE)
292 ifp->int_rdisc_cnt = 0;
293 ifp->int_rdisc_timer.tv_usec = rdisc_timer.tv_usec;
294 ifp->int_rdisc_timer.tv_sec = now.tv_sec+MIN_WAITTIME;
295 set_rdisc_mg(ifp, 1);
369 * This should only be called when !(ifp->int_state & IS_ALIAS)
372 if_bad_rdisc(struct interface *ifp)
377 if (drp->dr_ifp != ifp)
392 if_ok_rdisc(struct interface *ifp)
394 set_rdisc_mg(ifp, 1);
396 ifp->int_rdisc_cnt = 0;
397 ifp->int_rdisc_timer.tv_sec = now.tv_sec + (supplier
400 if (timercmp(&rdisc_timer, &ifp->int_rdisc_timer, >))
401 rdisc_timer = ifp->int_rdisc_timer;
410 struct interface *ifp;
423 ifp = drp->dr_ifp;
426 && drp->dr_ifp == ifp)
437 naddr_ntoa(gate), ifp->int_name, i);
438 } else if (ifp->int_rdisc_cnt >= MAX_SOLICITATIONS) {
441 naddr_ntoa(gate), ifp->int_name);
442 ifp->int_rdisc_cnt = 0;
443 ifp->int_rdisc_timer.tv_sec = 0;
448 naddr_ntoa(gate), ifp->int_name);
462 struct interface *ifp;
473 ifp = drp->dr_ifp;
487 drp->dr_pref = PREF(drp->dr_recv_pref, ifp);
579 struct interface *ifp)
599 if (!on_net(gate, ifp->int_net, ifp->int_mask)) {
633 if ((!(ifp->int_state & IS_SICK)
636 && !((ifp->int_state ^ drp->dr_ifp->int_state)
657 new_drp->dr_ifp = ifp;
663 new_drp->dr_pref = PREF(pref,ifp);
667 if (!(ifp->int_state & IS_SICK))
668 ifp->int_rdisc_cnt = MAX_SOLICITATIONS;
700 struct interface *ifp,
725 if (ifp->int_if_flags & IFF_POINTOPOINT) {
727 rsin.sin_addr.s_addr = ifp->int_dstaddr;
730 rsin.sin_addr.s_addr = ifp->int_brdaddr;
736 if (ifp->int_state & IS_DUP) {
739 ifp->int_name);
742 if (rdisc_sock_mcast != ifp) {
746 tgt_mcast = htonl(ifp->int_index);
756 if (ifp->int_addr == myaddr) {
760 tgt_mcast = ifp->int_addr;
770 rdisc_sock_mcast = ifp;
779 trace_rdisc(msg, ifp ? ifp->int_addr : 0, rsin.sin_addr.s_addr, ifp,
784 if (ifp == 0 || !(ifp->int_state & IS_BROKE))
786 ifp != 0 ? ifp->int_name : "",
787 ifp != 0 ? ", " : "",
790 if (ifp != 0)
791 if_sick(ifp);
799 send_adv(struct interface *ifp,
813 u.ad.icmp_ad_life = stopint ? 0 : htons(ifp->int_rdisc_int*3);
819 pref = UNSIGN_PREF(ifp->int_rdisc_pref);
820 u.ad.icmp_ad_info[0].icmp_ad_pref = htonl(SIGN_PREF(PREF(pref, ifp)));
822 u.ad.icmp_ad_info[0].icmp_ad_addr = ifp->int_addr;
826 send_rdisc(&u, sizeof(u.ad), ifp, dst, type);
835 struct interface *ifp;
842 for (ifp = ifnet; ifp; ifp = ifp->int_next) {
843 if (0 != (ifp->int_state & (IS_NO_ADV_OUT | IS_BROKE)))
846 if (!timercmp(&ifp->int_rdisc_timer, &now, >)
848 send_adv(ifp, htonl(INADDR_ALLHOSTS_GROUP),
849 (ifp->int_state&IS_BCAST_RDISC) ? 1 : 2);
850 ifp->int_rdisc_cnt++;
852 intvl_random(&ifp->int_rdisc_timer,
853 (ifp->int_rdisc_int*3)/4,
854 ifp->int_rdisc_int);
855 if (ifp->int_rdisc_cnt < MAX_INITIAL_ADVERTS
856 && (ifp->int_rdisc_timer.tv_sec
858 ifp->int_rdisc_timer.tv_sec
861 timevaladd(&ifp->int_rdisc_timer, &now);
864 if (timercmp(&rdisc_timer, &ifp->int_rdisc_timer, >))
865 rdisc_timer = ifp->int_rdisc_timer;
875 struct interface *ifp;
884 for (ifp = ifnet; ifp; ifp = ifp->int_next) {
885 if (0 != (ifp->int_state & (IS_NO_SOL_OUT | IS_BROKE))
886 || ifp->int_rdisc_cnt >= MAX_SOLICITATIONS)
889 if (!timercmp(&ifp->int_rdisc_timer, &now, >)) {
894 send_rdisc(&u, sizeof(u.so), ifp,
896 ((ifp->int_state&IS_BCAST_RDISC) ? 1 : 2));
898 if (++ifp->int_rdisc_cnt >= MAX_SOLICITATIONS)
901 ifp->int_rdisc_timer.tv_sec = SOLICITATION_INTERVAL;
902 ifp->int_rdisc_timer.tv_usec = 0;
903 timevaladd(&ifp->int_rdisc_timer, &now);
906 if (timercmp(&rdisc_timer, &ifp->int_rdisc_timer, >))
907 rdisc_timer = ifp->int_rdisc_timer;
916 struct interface *ifp,
939 trace_rdisc(act, from, to, ifp, p, len);
941 if (ifp == 0)
946 return ifp;
974 struct interface *ifp;
1003 ifp = ifwithname(buf.ifname, 0);
1004 if (ifp == 0)
1012 ifp = ((from.sin_addr.s_addr == 0)
1015 ifp = ck_icmp("Recv", from.sin_addr.s_addr, ifp,
1017 if (ifp == 0)
1049 if (ifp->int_state & IS_NO_ADV_IN)
1057 ifp);
1066 if (ifp->int_state & IS_NO_ADV_OUT)
1076 send_adv(ifp, from.sin_addr.s_addr, 0);