netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net-next,iproute2] netconf: add support for ignore route attribute
@ 2016-03-14  4:55 Zhang Shengju
  2016-03-14  6:15 ` Stephen Hemminger
  0 siblings, 1 reply; 3+ messages in thread
From: Zhang Shengju @ 2016-03-14  4:55 UTC (permalink / raw)
  To: stephen; +Cc: netdev

Add support for ignore_routes_with_linkdown attribute.

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
---
 ip/ipnetconf.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/ip/ipnetconf.c b/ip/ipnetconf.c
index eca6eee..6fec818 100644
--- a/ip/ipnetconf.c
+++ b/ip/ipnetconf.c
@@ -119,6 +119,10 @@ int print_netconf(const struct sockaddr_nl *who, struct rtnl_ctrl_data *ctrl,
 		fprintf(fp, "proxy_neigh %s ",
 			*(int *)RTA_DATA(tb[NETCONFA_PROXY_NEIGH])?"on":"off");
 
+	if (tb[NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN])
+		fprintf(fp, "ignore_routes_with_linkdown %s ",
+			*(int *)RTA_DATA(tb[NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN])?"on":"off");
+
 	fprintf(fp, "\n");
 	fflush(fp);
 	return 0;
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [net-next,iproute2] netconf: add support for ignore route attribute
  2016-03-14  4:55 [net-next,iproute2] netconf: add support for ignore route attribute Zhang Shengju
@ 2016-03-14  6:15 ` Stephen Hemminger
  0 siblings, 0 replies; 3+ messages in thread
From: Stephen Hemminger @ 2016-03-14  6:15 UTC (permalink / raw)
  To: Zhang Shengju; +Cc: netdev

On Mon, 14 Mar 2016 04:55:36 +0000
Zhang Shengju <zhangshengju@cmss.chinamobile.com> wrote:

> Add support for ignore_routes_with_linkdown attribute.
> 
> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
> ---
>  ip/ipnetconf.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/ip/ipnetconf.c b/ip/ipnetconf.c
> index eca6eee..6fec818 100644
> --- a/ip/ipnetconf.c
> +++ b/ip/ipnetconf.c
> @@ -119,6 +119,10 @@ int print_netconf(const struct sockaddr_nl *who, struct rtnl_ctrl_data *ctrl,
>  		fprintf(fp, "proxy_neigh %s ",
>  			*(int *)RTA_DATA(tb[NETCONFA_PROXY_NEIGH])?"on":"off");
>  
> +	if (tb[NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN])
> +		fprintf(fp, "ignore_routes_with_linkdown %s ",
> +			*(int *)RTA_DATA(tb[NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN])?"on":"off");

This is a good idea.

But the option name is too long, and the code does not follow current best practices.
  1. Lines are too long
  2. There needs to be whitespace around ? :
  3. There are helper routines (rte_getattr_XXX) which should be used rather than
     cast RTE_DATA directly.

Also, help and man page??

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [net-next,iproute2] netconf: add support for ignore route attribute
@ 2016-03-14  8:31 张胜举
  0 siblings, 0 replies; 3+ messages in thread
From: 张胜举 @ 2016-03-14  8:31 UTC (permalink / raw)
  To: 'Stephen Hemminger'; +Cc: netdev

> On Mon, 14 Mar 2016 04:55:36 +0000
> Zhang Shengju <zhangshengju@cmss.chinamobile.com> wrote:
> 
> > Add support for ignore_routes_with_linkdown attribute.
> >
> > Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
> > ---
> >  ip/ipnetconf.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/ip/ipnetconf.c b/ip/ipnetconf.c index eca6eee..6fec818
> > 100644
> > --- a/ip/ipnetconf.c
> > +++ b/ip/ipnetconf.c
> > @@ -119,6 +119,10 @@ int print_netconf(const struct sockaddr_nl *who,
> struct rtnl_ctrl_data *ctrl,
> >  		fprintf(fp, "proxy_neigh %s ",
> >  			*(int
> *)RTA_DATA(tb[NETCONFA_PROXY_NEIGH])?"on":"off");
> >
> > +	if (tb[NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN])
> > +		fprintf(fp, "ignore_routes_with_linkdown %s ",
> > +			*(int
> >
> +*)RTA_DATA(tb[NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN])?"on":"
> off");
> 
> This is a good idea.
> 
> But the option name is too long, and the code does not follow current best
> practices.
I agree with you that the name is too long, but I can't figure out a shorter
name. 
Any good suggestion? What about "ignore_routes" ? 

>   1. Lines are too long
>   2. There needs to be whitespace around ? :
>   3. There are helper routines (rte_getattr_XXX) which should be used
rather
> than
>      cast RTE_DATA directly.
> 
> Also, help and man page??
Yes, man page need to be enhanced.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-03-14  8:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-14  4:55 [net-next,iproute2] netconf: add support for ignore route attribute Zhang Shengju
2016-03-14  6:15 ` Stephen Hemminger
  -- strict thread matches above, loose matches on Subject: below --
2016-03-14  8:31 张胜举

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).