naccyde / rpms / iproute

Forked from rpms/iproute 10 months ago
Clone
Blob Blame History Raw
From 002cfe8913c88232569f316c7446834f985d52ff Mon Sep 17 00:00:00 2001
From: Phil Sutter <psutter@redhat.com>
Date: Tue, 28 Feb 2017 16:10:39 +0100
Subject: [PATCH] route: label externally offloaded routes

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289
Upstream Status: iproute2.git commit 655444bdadfcf

commit 655444bdadfcf348d4e668476f493e542587446b
Author: Scott Feldman <sfeldma@gmail.com>
Date:   Sat Mar 7 22:15:35 2015 -0800

    route: label externally offloaded routes

    On ip route print dump, label externally offloaded routes with "external".
    Offloaded routes are flagged with RTNH_F_EXTERNAL, a recent additon to
    net-next.  For example:

    $ ip route
    default via 192.168.0.2 dev eth0
    11.0.0.0/30 dev swp1  proto kernel  scope link  src 11.0.0.2 external
    11.0.0.4/30 via 11.0.0.1 dev swp1  proto zebra  metric 20 external
    11.0.0.8/30 dev swp2  proto kernel  scope link  src 11.0.0.10 external
    11.0.0.12/30 via 11.0.0.9 dev swp2  proto zebra  metric 20 external
    12.0.0.2  proto zebra  metric 30 external
            nexthop via 11.0.0.1  dev swp1 weight 1
            nexthop via 11.0.0.9  dev swp2 weight 1
    12.0.0.3 via 11.0.0.1 dev swp1  proto zebra  metric 20 external
    12.0.0.4 via 11.0.0.9 dev swp2  proto zebra  metric 20 external
    192.168.0.0/24 dev eth0  proto kernel  scope link  src 192.168.0.15

    Signed-off-by: Scott Feldman <sfeldma@gmail.com>
    Reviewed-by: Jiri Pirko <jiri@resnulli.us>
---
 ip/iproute.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ip/iproute.c b/ip/iproute.c
index 9dcfd19..6d64469 100644
--- a/ip/iproute.c
+++ b/ip/iproute.c
@@ -438,6 +438,8 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
 		fprintf(fp, "onlink ");
 	if (r->rtm_flags & RTNH_F_PERVASIVE)
 		fprintf(fp, "pervasive ");
+	if (r->rtm_flags & RTNH_F_EXTERNAL)
+		fprintf(fp, "external ");
 	if (r->rtm_flags & RTM_F_NOTIFY)
 		fprintf(fp, "notify ");
 	if (tb[RTA_MARK]) {
-- 
1.8.3.1