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 21:35:41 +0300 |
commit | 1a1143907c84308781e23f07d0c6c597bfd13abb (patch) | |
tree | 0d09393eb53fecfa4ef702f2d55f24c52055e21e /networking/libiproute | |
parent | 628f134fe7f1f868c60f8bd18645a626e9c5487f (diff) |
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>
Diffstat (limited to 'networking/libiproute')
-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, if (tb[RTA_PRIORITY]) { printf(" metric %d ", *(uint32_t*)RTA_DATA(tb[RTA_PRIORITY])); } + if (r->rtm_flags & RTNH_F_DEAD) { + printf("dead "); + } + if (r->rtm_flags & RTNH_F_ONLINK) { + printf("onlink "); + } + if (r->rtm_flags & RTNH_F_PERVASIVE) { + printf("pervasive "); + } + if (r->rtm_flags & RTM_F_NOTIFY) { + printf("notify "); + } + if (r->rtm_family == AF_INET6) { struct rta_cacheinfo *ci = NULL; if (tb[RTA_CACHEINFO]) { @@ -330,7 +343,7 @@ static int iproute_modify(int cmd, unsigned flags, char **argv) { static const char keywords[] ALIGN1 = "src\0""via\0""mtu\0""lock\0""protocol\0"IF_FEATURE_IP_RULE("table\0") - "dev\0""oif\0""to\0""metric\0"; + "dev\0""oif\0""to\0""metric\0""onlink\0"; enum { ARG_src, ARG_via, @@ -341,6 +354,7 @@ IF_FEATURE_IP_RULE(ARG_table,) ARG_oif, ARG_to, ARG_metric, + ARG_onlink, }; enum { gw_ok = 1 << 0, @@ -431,6 +445,8 @@ IF_FEATURE_IP_RULE(ARG_table,) NEXT_ARG(); metric = get_u32(*argv, "metric"); addattr32(&req.n, sizeof(req), RTA_PRIORITY, metric); + } else if (arg == ARG_onlink) { + req.r.rtm_flags |= RTNH_F_ONLINK; } else { int type; inet_prefix dst; |