diff mbox

[net-next,3/3,v3] iproute2: add support to print 'linkdown' nexthop flag

Message ID 1433990233-958-4-git-send-email-gospo@cumulusnetworks.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Andy Gospodarek June 11, 2015, 2:37 a.m. UTC
Signed-off-by: Andy Gospodaerk <gospo@cumulusnetworks.com>
Signed-off-by: Dinesh Dutt <ddutt@cumulusnetworks.com>

---
 ip/iproute.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Scott Feldman June 11, 2015, 3:02 a.m. UTC | #1
On Wed, Jun 10, 2015 at 7:37 PM, Andy Gospodarek
<gospo@cumulusnetworks.com> wrote:
> Signed-off-by: Andy Gospodaerk <gospo@cumulusnetworks.com>
> Signed-off-by: Dinesh Dutt <ddutt@cumulusnetworks.com>
>
> ---
>  ip/iproute.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/ip/iproute.c b/ip/iproute.c
> index 3795baf..3369c49 100644
> --- a/ip/iproute.c
> +++ b/ip/iproute.c
> @@ -451,6 +451,8 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
>                 fprintf(fp, "offload ");
>         if (r->rtm_flags & RTM_F_NOTIFY)
>                 fprintf(fp, "notify ");
> +       if (r->rtm_flags & RTNH_F_LINKDOWN)
> +               fprintf(fp, "linkdown ");

This seems confusing for ECMP case where only some nexthop devs are
RTNH_F_LINKDOWN?   Why mark entire route "linkdown" when it still has
viable nexthop devs for ECMP?


>         if (tb[RTA_MARK]) {
>                 unsigned int mark = *(unsigned int*)RTA_DATA(tb[RTA_MARK]);
>                 if (mark) {
> @@ -670,6 +672,8 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
>                                 fprintf(fp, " onlink");
>                         if (nh->rtnh_flags & RTNH_F_PERVASIVE)
>                                 fprintf(fp, " pervasive");
> +                       if (nh->rtnh_flags & RTNH_F_LINKDOWN)
> +                               fprintf(fp, " linkdown");
>                         len -= NLMSG_ALIGN(nh->rtnh_len);
>                         nh = RTNH_NEXT(nh);
>                 }
> --
> 1.9.3
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andy Gospodarek June 11, 2015, 3:13 a.m. UTC | #2
On Wed, Jun 10, 2015 at 08:02:26PM -0700, Scott Feldman wrote:
> On Wed, Jun 10, 2015 at 7:37 PM, Andy Gospodarek
> <gospo@cumulusnetworks.com> wrote:
> > Signed-off-by: Andy Gospodaerk <gospo@cumulusnetworks.com>
> > Signed-off-by: Dinesh Dutt <ddutt@cumulusnetworks.com>
> >
> > ---
> >  ip/iproute.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/ip/iproute.c b/ip/iproute.c
> > index 3795baf..3369c49 100644
> > --- a/ip/iproute.c
> > +++ b/ip/iproute.c
> > @@ -451,6 +451,8 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
> >                 fprintf(fp, "offload ");
> >         if (r->rtm_flags & RTM_F_NOTIFY)
> >                 fprintf(fp, "notify ");
> > +       if (r->rtm_flags & RTNH_F_LINKDOWN)
> > +               fprintf(fp, "linkdown ");
> 
> This seems confusing for ECMP case where only some nexthop devs are
> RTNH_F_LINKDOWN?   Why mark entire route "linkdown" when it still has
> viable nexthop devs for ECMP?

This is no different than what happens when nexthops are marked dead
today.  This situation happens when a route's nexthop has IFF_UP
cleared.

> 
> 
> >         if (tb[RTA_MARK]) {
> >                 unsigned int mark = *(unsigned int*)RTA_DATA(tb[RTA_MARK]);
> >                 if (mark) {
> > @@ -670,6 +672,8 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
> >                                 fprintf(fp, " onlink");
> >                         if (nh->rtnh_flags & RTNH_F_PERVASIVE)
> >                                 fprintf(fp, " pervasive");
> > +                       if (nh->rtnh_flags & RTNH_F_LINKDOWN)
> > +                               fprintf(fp, " linkdown");
> >                         len -= NLMSG_ALIGN(nh->rtnh_len);
> >                         nh = RTNH_NEXT(nh);
> >                 }
> > --
> > 1.9.3
> >
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/ip/iproute.c b/ip/iproute.c
index 3795baf..3369c49 100644
--- a/ip/iproute.c
+++ b/ip/iproute.c
@@ -451,6 +451,8 @@  int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
 		fprintf(fp, "offload ");
 	if (r->rtm_flags & RTM_F_NOTIFY)
 		fprintf(fp, "notify ");
+	if (r->rtm_flags & RTNH_F_LINKDOWN)
+		fprintf(fp, "linkdown ");
 	if (tb[RTA_MARK]) {
 		unsigned int mark = *(unsigned int*)RTA_DATA(tb[RTA_MARK]);
 		if (mark) {
@@ -670,6 +672,8 @@  int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
 				fprintf(fp, " onlink");
 			if (nh->rtnh_flags & RTNH_F_PERVASIVE)
 				fprintf(fp, " pervasive");
+			if (nh->rtnh_flags & RTNH_F_LINKDOWN)
+				fprintf(fp, " linkdown");
 			len -= NLMSG_ALIGN(nh->rtnh_len);
 			nh = RTNH_NEXT(nh);
 		}