diff options
author | Michael Tokarev <mjt@tls.msk.ru> | 2014-07-28 10:05:41 +0400 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2014-11-17 19:35:41 +0100 |
commit | 1a1143907c84308781e23f07d0c6c597bfd13abb (patch) | |
tree | 0d09393eb53fecfa4ef702f2d55f24c52055e21e | |
parent | 628f134fe7f1f868c60f8bd18645a626e9c5487f (diff) | |
download | busybox-w32-1a1143907c84308781e23f07d0c6c597bfd13abb.tar.gz busybox-w32-1a1143907c84308781e23f07d0c6c597bfd13abb.tar.bz2 busybox-w32-1a1143907c84308781e23f07d0c6c597bfd13abb.zip |
iproute: support onelink route option and print route flags
function old new delta
print_route 1797 1865 +68
do_iproute 2097 2112 +15
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 83/0) Total: 83 bytes
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | networking/libiproute/iproute.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c index ec4d8ba03..170c67b30 100644 --- a/networking/libiproute/iproute.c +++ b/networking/libiproute/iproute.c | |||
@@ -298,6 +298,19 @@ static int FAST_FUNC print_route(const struct sockaddr_nl *who UNUSED_PARAM, | |||
298 | if (tb[RTA_PRIORITY]) { | 298 | if (tb[RTA_PRIORITY]) { |
299 | printf(" metric %d ", *(uint32_t*)RTA_DATA(tb[RTA_PRIORITY])); | 299 | printf(" metric %d ", *(uint32_t*)RTA_DATA(tb[RTA_PRIORITY])); |
300 | } | 300 | } |
301 | if (r->rtm_flags & RTNH_F_DEAD) { | ||
302 | printf("dead "); | ||
303 | } | ||
304 | if (r->rtm_flags & RTNH_F_ONLINK) { | ||
305 | printf("onlink "); | ||
306 | } | ||
307 | if (r->rtm_flags & RTNH_F_PERVASIVE) { | ||
308 | printf("pervasive "); | ||
309 | } | ||
310 | if (r->rtm_flags & RTM_F_NOTIFY) { | ||
311 | printf("notify "); | ||
312 | } | ||
313 | |||
301 | if (r->rtm_family == AF_INET6) { | 314 | if (r->rtm_family == AF_INET6) { |
302 | struct rta_cacheinfo *ci = NULL; | 315 | struct rta_cacheinfo *ci = NULL; |
303 | if (tb[RTA_CACHEINFO]) { | 316 | if (tb[RTA_CACHEINFO]) { |
@@ -330,7 +343,7 @@ static int iproute_modify(int cmd, unsigned flags, char **argv) | |||
330 | { | 343 | { |
331 | static const char keywords[] ALIGN1 = | 344 | static const char keywords[] ALIGN1 = |
332 | "src\0""via\0""mtu\0""lock\0""protocol\0"IF_FEATURE_IP_RULE("table\0") | 345 | "src\0""via\0""mtu\0""lock\0""protocol\0"IF_FEATURE_IP_RULE("table\0") |
333 | "dev\0""oif\0""to\0""metric\0"; | 346 | "dev\0""oif\0""to\0""metric\0""onlink\0"; |
334 | enum { | 347 | enum { |
335 | ARG_src, | 348 | ARG_src, |
336 | ARG_via, | 349 | ARG_via, |
@@ -341,6 +354,7 @@ IF_FEATURE_IP_RULE(ARG_table,) | |||
341 | ARG_oif, | 354 | ARG_oif, |
342 | ARG_to, | 355 | ARG_to, |
343 | ARG_metric, | 356 | ARG_metric, |
357 | ARG_onlink, | ||
344 | }; | 358 | }; |
345 | enum { | 359 | enum { |
346 | gw_ok = 1 << 0, | 360 | gw_ok = 1 << 0, |
@@ -431,6 +445,8 @@ IF_FEATURE_IP_RULE(ARG_table,) | |||
431 | NEXT_ARG(); | 445 | NEXT_ARG(); |
432 | metric = get_u32(*argv, "metric"); | 446 | metric = get_u32(*argv, "metric"); |
433 | addattr32(&req.n, sizeof(req), RTA_PRIORITY, metric); | 447 | addattr32(&req.n, sizeof(req), RTA_PRIORITY, metric); |
448 | } else if (arg == ARG_onlink) { | ||
449 | req.r.rtm_flags |= RTNH_F_ONLINK; | ||
434 | } else { | 450 | } else { |
435 | int type; | 451 | int type; |
436 | inet_prefix dst; | 452 | inet_prefix dst; |