78 |
return hz_internal; |
return hz_internal; |
79 |
} |
} |
80 |
|
|
81 |
static int print_route(const struct sockaddr_nl *who UNUSED_PARAM, |
static int FAST_FUNC print_route(const struct sockaddr_nl *who UNUSED_PARAM, |
82 |
struct nlmsghdr *n, void *arg UNUSED_PARAM) |
struct nlmsghdr *n, void *arg UNUSED_PARAM) |
83 |
{ |
{ |
84 |
struct rtmsg *r = NLMSG_DATA(n); |
struct rtmsg *r = NLMSG_DATA(n); |
196 |
printf("Deleted "); |
printf("Deleted "); |
197 |
} |
} |
198 |
if (r->rtm_type != RTN_UNICAST && !filter.type) { |
if (r->rtm_type != RTN_UNICAST && !filter.type) { |
199 |
printf("%s ", rtnl_rtntype_n2a(r->rtm_type, b1, sizeof(b1))); |
printf("%s ", rtnl_rtntype_n2a(r->rtm_type, b1)); |
200 |
} |
} |
201 |
|
|
202 |
if (tb[RTA_DST]) { |
if (tb[RTA_DST]) { |
203 |
if (r->rtm_dst_len != host_len) { |
if (r->rtm_dst_len != host_len) { |
204 |
printf("%s/%u ", rt_addr_n2a(r->rtm_family, |
printf("%s/%u ", rt_addr_n2a(r->rtm_family, |
|
RTA_PAYLOAD(tb[RTA_DST]), |
|
205 |
RTA_DATA(tb[RTA_DST]), |
RTA_DATA(tb[RTA_DST]), |
206 |
abuf, sizeof(abuf)), |
abuf, sizeof(abuf)), |
207 |
r->rtm_dst_len |
r->rtm_dst_len |
221 |
if (tb[RTA_SRC]) { |
if (tb[RTA_SRC]) { |
222 |
if (r->rtm_src_len != host_len) { |
if (r->rtm_src_len != host_len) { |
223 |
printf("from %s/%u ", rt_addr_n2a(r->rtm_family, |
printf("from %s/%u ", rt_addr_n2a(r->rtm_family, |
|
RTA_PAYLOAD(tb[RTA_SRC]), |
|
224 |
RTA_DATA(tb[RTA_SRC]), |
RTA_DATA(tb[RTA_SRC]), |
225 |
abuf, sizeof(abuf)), |
abuf, sizeof(abuf)), |
226 |
r->rtm_src_len |
r->rtm_src_len |
250 |
and symbolic name will not be useful. |
and symbolic name will not be useful. |
251 |
*/ |
*/ |
252 |
printf(" src %s ", rt_addr_n2a(r->rtm_family, |
printf(" src %s ", rt_addr_n2a(r->rtm_family, |
|
RTA_PAYLOAD(tb[RTA_PREFSRC]), |
|
253 |
RTA_DATA(tb[RTA_PREFSRC]), |
RTA_DATA(tb[RTA_PREFSRC]), |
254 |
abuf, sizeof(abuf))); |
abuf, sizeof(abuf))); |
255 |
} |
} |
287 |
static int iproute_modify(int cmd, unsigned flags, char **argv) |
static int iproute_modify(int cmd, unsigned flags, char **argv) |
288 |
{ |
{ |
289 |
static const char keywords[] ALIGN1 = |
static const char keywords[] ALIGN1 = |
290 |
"src\0""via\0""mtu\0""lock\0""protocol\0"USE_FEATURE_IP_RULE("table\0") |
"src\0""via\0""mtu\0""lock\0""protocol\0"IF_FEATURE_IP_RULE("table\0") |
291 |
"dev\0""oif\0""to\0""metric\0"; |
"dev\0""oif\0""to\0""metric\0"; |
292 |
enum { |
enum { |
293 |
ARG_src, |
ARG_src, |
294 |
ARG_via, |
ARG_via, |
295 |
ARG_mtu, PARM_lock, |
ARG_mtu, PARM_lock, |
296 |
ARG_protocol, |
ARG_protocol, |
297 |
USE_FEATURE_IP_RULE(ARG_table,) |
IF_FEATURE_IP_RULE(ARG_table,) |
298 |
ARG_dev, |
ARG_dev, |
299 |
ARG_oif, |
ARG_oif, |
300 |
ARG_to, |
ARG_to, |
364 |
mxlock |= (1 << RTAX_MTU); |
mxlock |= (1 << RTAX_MTU); |
365 |
NEXT_ARG(); |
NEXT_ARG(); |
366 |
} |
} |
367 |
if (get_unsigned(&mtu, *argv, 0)) |
mtu = get_unsigned(*argv, "mtu"); |
|
invarg(*argv, "mtu"); |
|
368 |
rta_addattr32(mxrta, sizeof(mxbuf), RTAX_MTU, mtu); |
rta_addattr32(mxrta, sizeof(mxbuf), RTAX_MTU, mtu); |
369 |
} else if (arg == ARG_protocol) { |
} else if (arg == ARG_protocol) { |
370 |
uint32_t prot; |
uint32_t prot; |
387 |
} else if (arg == ARG_metric) { |
} else if (arg == ARG_metric) { |
388 |
uint32_t metric; |
uint32_t metric; |
389 |
NEXT_ARG(); |
NEXT_ARG(); |
390 |
if (get_u32(&metric, *argv, 0)) |
metric = get_u32(*argv, "metric"); |
|
invarg(*argv, "metric"); |
|
391 |
addattr32(&req.n, sizeof(req), RTA_PRIORITY, metric); |
addattr32(&req.n, sizeof(req), RTA_PRIORITY, metric); |
392 |
} else { |
} else { |
393 |
int type; |
int type; |
499 |
} |
} |
500 |
|
|
501 |
if (write(flush_fd, "-1", 2) < 2) { |
if (write(flush_fd, "-1", 2) < 2) { |
502 |
bb_perror_msg("cannot flush routing cache"); |
bb_perror_msg("can't flush routing cache"); |
503 |
return; |
return; |
504 |
} |
} |
505 |
close(flush_fd); |
close(flush_fd); |
681 |
if (filter.tb != -1) { |
if (filter.tb != -1) { |
682 |
xrtnl_wilddump_request(&rth, do_ipv6, RTM_GETROUTE); |
xrtnl_wilddump_request(&rth, do_ipv6, RTM_GETROUTE); |
683 |
} else if (rtnl_rtcache_request(&rth, do_ipv6) < 0) { |
} else if (rtnl_rtcache_request(&rth, do_ipv6) < 0) { |
684 |
bb_perror_msg_and_die("cannot send dump request"); |
bb_perror_msg_and_die("can't send dump request"); |
685 |
} |
} |
686 |
xrtnl_dump_filter(&rth, print_route, NULL); |
xrtnl_dump_filter(&rth, print_route, NULL); |
687 |
|
|