Lines Matching defs:rt

112 	struct rtentry		*rt, *nrt;
116 rt = calloc(1, sizeof(*rt));
117 if (rt == NULL)
119 refcnt_init(&rt->rt_refcnt);
131 if ((error = rtable_insert(rid, ndst, mask, NULL, 0, rt)) != 0) {
136 if (nrt != rt) {
137 inet_net_satop(af, rt_key(rt), plen, ip, sizeof(ip));
140 rtfree(rt);
153 struct rtentry *rt, *nrt;
161 rt = rtable_lookup(0, dst, mask, NULL, RTP_ANY);
162 if (rt == NULL) {
167 assert(memcmp(rt_key(rt), dst, dst->sa_len) == 0);
168 assert(rt_plen(rt) == rtable_satoplen(af, mask));
170 if ((error = rtable_delete(0, dst, mask, rt)) != 0) {
179 inet_net_satop(af, rt_key(rt), plen, ip0, sizeof(ip0));
183 rtfree(rt);
184 assert(refcnt_read(&rt->rt_refcnt) == 0);
186 free(rt_key(rt));
187 free(rt);
199 struct rtentry *rt;
207 rt = rtable_lookup(0, dst, mask, NULL, RTP_ANY);
208 if (rt == NULL) {
212 assert(memcmp(rt_key(rt), dst, dst->sa_len) == 0);
213 assert(rt_plen(rt) == rtable_satoplen(af, mask));
215 rtfree(rt);
243 rtentry_dump(struct rtentry *rt, void *w, unsigned int rid)
246 sa_family_t af = rt_key(rt)->sa_family;
248 inet_net_satop(af, rt_key(rt), rt_plen(rt), dest, sizeof(dest));
255 rtentry_delete(struct rtentry *rt, void *w, unsigned int rid)
258 sa_family_t af = rt_key(rt)->sa_family;
260 struct sockaddr *mask = rt_plen2mask(rt, &sa_mask);
263 assert(rt_plen(rt) == rtable_satoplen(af, mask));
265 if ((error = rtable_delete(0, rt_key(rt), mask, rt)) != 0) {
266 inet_net_satop(af, rt_key(rt), rt_plen(rt), dest, sizeof(dest));
269 assert(refcnt_read(&rt->rt_refcnt) == 0);
295 rtref(struct rtentry *rt)
297 refcnt_take(&rt->rt_refcnt);
301 rtfree(struct rtentry *rt)
303 if (refcnt_rele(&rt->rt_refcnt) == 0)
399 rt_plen2mask(struct rtentry *rt, struct sockaddr_in6 *sa_mask)
401 return (rt_plentosa(rt_key(rt)->sa_family, rt_plen(rt), sa_mask));
519 rt_hash(struct rtentry *rt, const struct sockaddr *dst, uint32_t *src)