]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
ipmroute: add support for RTNH_F_UNRESOLVED
authorNikolay Aleksandrov <nikolay@cumulusnetworks.com>
Fri, 20 Jan 2017 14:15:21 +0000 (15:15 +0100)
committerStephen Hemminger <stephen@networkplumber.org>
Fri, 20 Jan 2017 17:41:26 +0000 (09:41 -0800)
This patch adds a new field that is printed in the end of the line which
denotes the real entry state. Before this patch an entry's IIF could
disappear and it would look like an unresolved one (iif = unresolved):
(3.0.16.1, 225.11.16.1)          Iif: unresolved

with no way to really distinguish it from an unresolved entry.
After the patch if the dumped entry has RTNH_F_UNRESOLVED set we get:
(3.0.16.1, 225.11.16.1)          Iif: unresolved  State: unresolved

for unresolved entries and:
(0.0.0.0, 225.11.11.11)          Iif: eth4       Oifs: eth3  State: resolved

for resolved entries after the OIF list. Note that "State:" has ':' in
it so it cannot be mistaken for an interface name.

And for the example above, we'd get:
(0.0.0.0, 225.11.11.11)          Iif: unresolved     State: resolved

Also when dumping all routes via ip route show table all,
 it will show up as:
multicast 225.11.16.1/32 from 3.0.16.1/32 table default proto 17 unresolved

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
ip/ipmroute.c
ip/iproute.c

index 512afcd2086eb6b4706fc1860dbdfc05e9f2d581..593ce3a1bd95457033e55669ffdce707da8317e7 100644 (file)
@@ -159,6 +159,8 @@ int print_mroute(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
                        nh = RTNH_NEXT(nh);
                }
        }
+       fprintf(fp, " State: %s",
+               r->rtm_flags & RTNH_F_UNRESOLVED ? "unresolved" : "resolved");
        if (show_stats && tb[RTA_MFC_STATS]) {
                struct rta_mfc_stats *mfcs = RTA_DATA(tb[RTA_MFC_STATS]);
 
index e433de8be189e1a100289c1148f4f4ac1d0292c0..c19578337f71e654a78499ad888c9320c4d4b42d 100644 (file)
@@ -448,6 +448,8 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
                fprintf(fp, "notify ");
        if (r->rtm_flags & RTNH_F_LINKDOWN)
                fprintf(fp, "linkdown ");
+       if (r->rtm_flags & RTNH_F_UNRESOLVED)
+               fprintf(fp, "unresolved ");
        if (tb[RTA_MARK]) {
                unsigned int mark = *(unsigned int *)RTA_DATA(tb[RTA_MARK]);