Lines Matching refs:rt
165 struct rtentry *const rt = (void *)rt_buf; in INET_setroute() local
179 memset(rt, 0, sizeof(*rt)); in INET_setroute()
191 mask_in_addr(*rt) = htonl( ~(0xffffffffUL >> prefix_len)); in INET_setroute()
194 rt->rt_genmask.sa_family = AF_INET; in INET_setroute()
201 isnet = INET_resolve(target, (struct sockaddr_in *) &rt->rt_dst, in INET_setroute()
217 rt->rt_flags = ((isnet) ? RTF_UP : (RTF_UP | RTF_HOST)); in INET_setroute()
224 rt->rt_flags |= flags_ipvx[k & 3]; in INET_setroute()
230 rt->rt_metric = xatoul(args_m1) + 1; in INET_setroute()
238 if (mask_in_addr(*rt)) { in INET_setroute()
247 rt->rt_genmask = full_mask(mask); in INET_setroute()
252 if (rt->rt_flags & RTF_GATEWAY) { in INET_setroute()
257 (struct sockaddr_in *) &rt->rt_gateway, 1); in INET_setroute()
258 rt->rt_flags |= RTF_GATEWAY; in INET_setroute()
270 rt->rt_flags |= RTF_MSS; in INET_setroute()
271 rt->rt_mss = xatoul_range(args_m1, 64, 32768); in INET_setroute()
276 rt->rt_flags |= RTF_WINDOW; in INET_setroute()
277 rt->rt_window = xatoul_range(args_m1, 128, INT_MAX); in INET_setroute()
283 rt->rt_flags |= RTF_IRTT; in INET_setroute()
284 rt->rt_irtt = xatoul(args_m1); in INET_setroute()
285 rt->rt_irtt *= (bb_clk_tck() / 100); /* FIXME */ in INET_setroute()
287 if (rt->rt_irtt < 1 || rt->rt_irtt > (120 * HZ)) { in INET_setroute()
297 if (!rt->rt_dev && ((k == KW_IPVx_DEVICE) || (!k && !*++args))) { in INET_setroute()
299 rt->rt_dev = args[-1]; in INET_setroute()
308 if ((rt->rt_flags & RTF_REJECT) && !rt->rt_dev) { in INET_setroute()
309 rt->rt_dev = (char*)"lo"; in INET_setroute()
314 if (mask_in_addr(*rt)) { in INET_setroute()
315 uint32_t mask = mask_in_addr(*rt); in INET_setroute()
318 if ((rt->rt_flags & RTF_HOST) && mask != 0xffffffff) { in INET_setroute()
325 mask = ((struct sockaddr_in *) &rt->rt_dst)->sin_addr.s_addr; in INET_setroute()
326 if (mask & ~(uint32_t)mask_in_addr(*rt)) { in INET_setroute()
332 if ((action == RTACTION_ADD) && (rt->rt_flags & RTF_HOST)) { in INET_setroute()
333 mask_in_addr(*rt) = 0xffffffff; in INET_setroute()
340 xioctl(skfd, SIOCADDRT, rt); in INET_setroute()
342 xioctl(skfd, SIOCDELRT, rt); in INET_setroute()
352 struct in6_rtmsg rt; in INET6_setroute() local
377 memset(&rt, 0, sizeof(rt)); in INET6_setroute()
379 memcpy(&rt.rtmsg_dst, sa6.sin6_addr.s6_addr, sizeof(struct in6_addr)); in INET6_setroute()
382 rt.rtmsg_dst_len = prefix_len; in INET6_setroute()
383 rt.rtmsg_flags = ((prefix_len == 128) ? (RTF_UP|RTF_HOST) : RTF_UP); in INET6_setroute()
384 rt.rtmsg_metric = 1; in INET6_setroute()
393 rt.rtmsg_flags |= flags_ipvx[k & 3]; in INET6_setroute()
398 rt.rtmsg_metric = xatoul(args_m1); in INET6_setroute()
403 if (rt.rtmsg_flags & RTF_GATEWAY) { in INET6_setroute()
410 memcpy(&rt.rtmsg_gateway, sa6.sin6_addr.s6_addr, in INET6_setroute()
412 rt.rtmsg_flags |= RTF_GATEWAY; in INET6_setroute()
431 rt.rtmsg_ifindex = 0; in INET6_setroute()
438 rt.rtmsg_ifindex = ifr.ifr_ifindex; in INET6_setroute()
443 xioctl(skfd, SIOCADDRT, &rt); in INET6_setroute()
445 xioctl(skfd, SIOCDELRT, &rt); in INET6_setroute()