Lines Matching refs:rt
817 struct rt_entry *rt; in kern_check_static() local
830 rt = rtget(k->k_dst, k->k_mask); in kern_check_static()
831 if (rt != NULL) { in kern_check_static()
832 if (!(rt->rt_state & RS_STATIC)) in kern_check_static()
833 rtchange(rt, rt->rt_state | RS_STATIC, &new, 0); in kern_check_static()
1561 struct rt_entry *rt; in del_static() local
1580 rt = rtget(dst, mask); in del_static()
1581 if (rt != NULL && (rt->rt_state & RS_STATIC)) in del_static()
1582 rtbad(rt); in del_static()
1670 struct rt_entry *rt; in rtget() local
1675 rt = (struct rt_entry *)rhead->rnh_lookup(&dst_sock,&mask_sock,rhead); in rtget()
1676 if (!rt in rtget()
1677 || rt->rt_dst != dst in rtget()
1678 || rt->rt_mask != mask) in rtget()
1681 return rt; in rtget()
1703 struct rt_entry *rt; in rtadd() local
1708 rt = (struct rt_entry *)rtmalloc(sizeof (*rt), "rtadd"); in rtadd()
1709 memset(rt, 0, sizeof(*rt)); in rtadd()
1710 for (rts = rt->rt_spares, i = NUM_SPARES; i != 0; i--, rts++) in rtadd()
1713 rt->rt_nodes->rn_key = (caddr_t)&rt->rt_dst_sock; in rtadd()
1714 rt->rt_dst = dst; in rtadd()
1715 rt->rt_dst_sock.sin_family = AF_INET; in rtadd()
1717 rt->rt_dst_sock.sin_len = dst_sock.sin_len; in rtadd()
1726 rt->rt_mask = mask; in rtadd()
1727 rt->rt_state = state; in rtadd()
1728 rt->rt_spares[0] = *new; in rtadd()
1729 rt->rt_time = now.tv_sec; in rtadd()
1730 rt->rt_poison_metric = HOPCNT_INFINITY; in rtadd()
1731 rt->rt_seqno = update_seqno; in rtadd()
1736 trace_add_del("Add", rt); in rtadd()
1741 if (0 == rhead->rnh_addaddr(&rt->rt_dst_sock, &mask_sock, in rtadd()
1742 rhead, rt->rt_nodes)) { in rtadd()
1745 free(rt); in rtadd()
1753 rtchange(struct rt_entry *rt, in rtchange() argument
1758 if (rt->rt_metric != new->rts_metric) { in rtchange()
1768 rt->rt_seqno = update_seqno; in rtchange()
1772 if (rt->rt_gate != new->rts_gate) { in rtchange()
1774 rt->rt_seqno = update_seqno; in rtchange()
1778 state |= (rt->rt_state & RS_SUBNET); in rtchange()
1786 trace_change(rt, state, new, in rtchange()
1789 rt->rt_state = state; in rtchange()
1790 rt->rt_spares[0] = *new; in rtchange()
1797 rts_better(struct rt_entry *rt) in rts_better() argument
1803 rts = rt->rt_spares+1; in rts_better()
1805 if (BETTER_LINK(rt,rts1,rts)) in rts_better()
1816 rtswitch(struct rt_entry *rt, in rtswitch() argument
1824 if (0 != (rt->rt_state & (RS_MHOME | RS_STATIC | RS_RDISC in rtswitch()
1830 rts = rts_better(rt); in rtswitch()
1834 if (!BETTER_LINK(rt, rts, rt->rt_spares)) in rtswitch()
1837 swap = rt->rt_spares[0]; in rtswitch()
1838 (void)sprintf(label, "Use #%d", (int)(rts - rt->rt_spares)); in rtswitch()
1839 rtchange(rt, rt->rt_state & ~(RS_NET_SYN | RS_RDISC), rts, label); in rtswitch()
1849 rtdelete(struct rt_entry *rt) in rtdelete() argument
1855 trace_add_del("Del", rt); in rtdelete()
1857 k = kern_find(rt->rt_dst, rt->rt_mask, 0); in rtdelete()
1863 dst_sock.sin_addr.s_addr = rt->rt_dst; in rtdelete()
1864 mask_sock.sin_addr.s_addr = htonl(rt->rt_mask); in rtdelete()
1866 if (rt != (struct rt_entry *)rhead->rnh_deladdr(&dst_sock, &mask_sock, in rtdelete()
1870 free(rt); in rtdelete()
1877 rts_delete(struct rt_entry *rt, in rts_delete() argument
1880 trace_upslot(rt, rts, &rts_empty); in rts_delete()
1888 rtbad(struct rt_entry *rt) in rtbad() argument
1893 new = rt->rt_spares[0]; in rtbad()
1895 rtchange(rt, rt->rt_state & ~(RS_IF | RS_LOCAL | RS_STATIC), &new, 0); in rtbad()
1896 rtswitch(rt, 0); in rtbad()
1904 rtbad_sub(struct rt_entry *rt) in rtbad_sub() argument
1914 if (rt->rt_state & RS_LOCAL) { in rtbad_sub()
1922 if (ifp->int_addr == rt->rt_ifp->int_addr) { in rtbad_sub()
1935 if (rt->rt_state & RS_NET_SYN) { in rtbad_sub()
1938 && rt->rt_mask == ifp->int_std_mask in rtbad_sub()
1939 && rt->rt_dst == ifp->int_std_addr) { in rtbad_sub()
1951 if (intnetp->intnet_addr == rt->rt_dst in rtbad_sub()
1952 && intnetp->intnet_mask == rt->rt_mask) { in rtbad_sub()
1960 struct rt_spare new = rt->rt_spares[0]; in rtbad_sub()
1962 rtchange(rt, ((rt->rt_state & ~(RS_NET_SYN|RS_LOCAL)) | state), in rtbad_sub()
1965 rtbad(rt); in rtbad_sub()