All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tc: parse attributes with NLA_F_NESTED flag
@ 2020-01-16 15:57 Leslie Monis
  2020-01-16 16:01 ` Leslie Monis
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Leslie Monis @ 2020-01-16 15:57 UTC (permalink / raw)
  To: Linux NetDev; +Cc: David Ahern, Stephen Hemminger

The kernel now requires all new nested attributes to set the
NLA_F_NESTED flag. Enable tc {qdisc,class,filter} to parse
attributes that have the NLA_F_NESTED flag set.

Signed-off-by: Leslie Monis <lesliemonis@gmail.com>
---
 tc/tc_class.c  | 6 +++---
 tc/tc_filter.c | 2 +-
 tc/tc_qdisc.c  | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/tc/tc_class.c b/tc/tc_class.c
index c7e3cfdf..39bea971 100644
--- a/tc/tc_class.c
+++ b/tc/tc_class.c
@@ -246,8 +246,8 @@ static void graph_cls_show(FILE *fp, char *buf, struct hlist_head *root_list,
 			 "+---(%s)", cls_id_str);
 		strcat(buf, str);
 
-		parse_rtattr(tb, TCA_MAX, (struct rtattr *)cls->data,
-				cls->data_len);
+		parse_rtattr_flags(tb, TCA_MAX, (struct rtattr *)cls->data,
+				   cls->data_len, NLA_F_NESTED);
 
 		if (tb[TCA_KIND] == NULL) {
 			strcat(buf, " [unknown qdisc kind] ");
@@ -327,7 +327,7 @@ int print_class(struct nlmsghdr *n, void *arg)
 	if (filter_classid && t->tcm_handle != filter_classid)
 		return 0;
 
-	parse_rtattr(tb, TCA_MAX, TCA_RTA(t), len);
+	parse_rtattr_flags(tb, TCA_MAX, TCA_RTA(t), len, NLA_F_NESTED);
 
 	if (tb[TCA_KIND] == NULL) {
 		fprintf(stderr, "print_class: NULL kind\n");
diff --git a/tc/tc_filter.c b/tc/tc_filter.c
index dcddca77..c591a19f 100644
--- a/tc/tc_filter.c
+++ b/tc/tc_filter.c
@@ -267,7 +267,7 @@ int print_filter(struct nlmsghdr *n, void *arg)
 		return -1;
 	}
 
-	parse_rtattr(tb, TCA_MAX, TCA_RTA(t), len);
+	parse_rtattr_flags(tb, TCA_MAX, TCA_RTA(t), len, NLA_F_NESTED);
 
 	if (tb[TCA_KIND] == NULL && (n->nlmsg_type == RTM_NEWTFILTER ||
 				     n->nlmsg_type == RTM_GETTFILTER ||
diff --git a/tc/tc_qdisc.c b/tc/tc_qdisc.c
index 75a14672..181fe2f0 100644
--- a/tc/tc_qdisc.c
+++ b/tc/tc_qdisc.c
@@ -235,7 +235,7 @@ int print_qdisc(struct nlmsghdr *n, void *arg)
 	if (filter_ifindex && filter_ifindex != t->tcm_ifindex)
 		return 0;
 
-	parse_rtattr(tb, TCA_MAX, TCA_RTA(t), len);
+	parse_rtattr_flags(tb, TCA_MAX, TCA_RTA(t), len, NLA_F_NESTED);
 
 	if (tb[TCA_KIND] == NULL) {
 		fprintf(stderr, "print_qdisc: NULL kind\n");
@@ -461,7 +461,7 @@ static int tc_qdisc_block_exists_cb(struct nlmsghdr *n, void *arg)
 	if (len < 0)
 		return -1;
 
-	parse_rtattr(tb, TCA_MAX, TCA_RTA(t), len);
+	parse_rtattr_flags(tb, TCA_MAX, TCA_RTA(t), len, NLA_F_NESTED);
 
 	if (tb[TCA_KIND] == NULL)
 		return -1;
-- 
2.17.1


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

* Re: [PATCH] tc: parse attributes with NLA_F_NESTED flag
  2020-01-16 15:57 [PATCH] tc: parse attributes with NLA_F_NESTED flag Leslie Monis
@ 2020-01-16 16:01 ` Leslie Monis
  2020-01-18 22:01 ` David Ahern
  2020-01-22  3:46 ` David Ahern
  2 siblings, 0 replies; 6+ messages in thread
From: Leslie Monis @ 2020-01-16 16:01 UTC (permalink / raw)
  To: Linux NetDev; +Cc: David Ahern, Stephen Hemminger

On Thu, Jan 16, 2020 at 9:27 PM Leslie Monis <lesliemonis@gmail.com> wrote:
>
> The kernel now requires all new nested attributes to set the
> NLA_F_NESTED flag. Enable tc {qdisc,class,filter} to parse
> attributes that have the NLA_F_NESTED flag set.
>
> Signed-off-by: Leslie Monis <lesliemonis@gmail.com>

I apologize. I forgot to add the [iproute2-next] tag.

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

* Re: [PATCH] tc: parse attributes with NLA_F_NESTED flag
  2020-01-16 15:57 [PATCH] tc: parse attributes with NLA_F_NESTED flag Leslie Monis
  2020-01-16 16:01 ` Leslie Monis
@ 2020-01-18 22:01 ` David Ahern
  2020-01-19  7:42   ` Leslie Monis
  2020-01-22  3:46 ` David Ahern
  2 siblings, 1 reply; 6+ messages in thread
From: David Ahern @ 2020-01-18 22:01 UTC (permalink / raw)
  To: Leslie Monis, Linux NetDev; +Cc: David Ahern, Stephen Hemminger

On 1/16/20 8:57 AM, Leslie Monis wrote:

> diff --git a/tc/tc_class.c b/tc/tc_class.c
> index c7e3cfdf..39bea971 100644
> --- a/tc/tc_class.c
> +++ b/tc/tc_class.c
> @@ -246,8 +246,8 @@ static void graph_cls_show(FILE *fp, char *buf, struct hlist_head *root_list,
>  			 "+---(%s)", cls_id_str);
>  		strcat(buf, str);
>  
> -		parse_rtattr(tb, TCA_MAX, (struct rtattr *)cls->data,
> -				cls->data_len);
> +		parse_rtattr_flags(tb, TCA_MAX, (struct rtattr *)cls->data,
> +				   cls->data_len, NLA_F_NESTED);

Petr recently sent a patch to update parse_rtattr_nested to add the
NESTED flag. Can you update this patch to use parse_rtattr_nested?

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

* Re: [PATCH] tc: parse attributes with NLA_F_NESTED flag
  2020-01-18 22:01 ` David Ahern
@ 2020-01-19  7:42   ` Leslie Monis
  2020-01-19 19:16     ` Leslie Monis
  0 siblings, 1 reply; 6+ messages in thread
From: Leslie Monis @ 2020-01-19  7:42 UTC (permalink / raw)
  To: David Ahern; +Cc: Linux NetDev, Stephen Hemminger

On Sun, Jan 19, 2020 at 3:31 AM David Ahern <dsahern@gmail.com> wrote:
>
> On 1/16/20 8:57 AM, Leslie Monis wrote:
>
> > diff --git a/tc/tc_class.c b/tc/tc_class.c
> > index c7e3cfdf..39bea971 100644
> > --- a/tc/tc_class.c
> > +++ b/tc/tc_class.c
> > @@ -246,8 +246,8 @@ static void graph_cls_show(FILE *fp, char *buf, struct hlist_head *root_list,
> >                        "+---(%s)", cls_id_str);
> >               strcat(buf, str);
> >
> > -             parse_rtattr(tb, TCA_MAX, (struct rtattr *)cls->data,
> > -                             cls->data_len);
> > +             parse_rtattr_flags(tb, TCA_MAX, (struct rtattr *)cls->data,
> > +                                cls->data_len, NLA_F_NESTED);
>
> Petr recently sent a patch to update parse_rtattr_nested to add the
> NESTED flag. Can you update this patch to use parse_rtattr_nested?

Yes, will do.

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

* Re: [PATCH] tc: parse attributes with NLA_F_NESTED flag
  2020-01-19  7:42   ` Leslie Monis
@ 2020-01-19 19:16     ` Leslie Monis
  0 siblings, 0 replies; 6+ messages in thread
From: Leslie Monis @ 2020-01-19 19:16 UTC (permalink / raw)
  To: David Ahern; +Cc: Linux NetDev, Stephen Hemminger

On Sun, Jan 19, 2020 at 1:12 PM Leslie Monis <lesliemonis@gmail.com> wrote:
>
> On Sun, Jan 19, 2020 at 3:31 AM David Ahern <dsahern@gmail.com> wrote:
> >
> > On 1/16/20 8:57 AM, Leslie Monis wrote:
> >
> > > diff --git a/tc/tc_class.c b/tc/tc_class.c
> > > index c7e3cfdf..39bea971 100644
> > > --- a/tc/tc_class.c
> > > +++ b/tc/tc_class.c
> > > @@ -246,8 +246,8 @@ static void graph_cls_show(FILE *fp, char *buf, struct hlist_head *root_list,
> > >                        "+---(%s)", cls_id_str);
> > >               strcat(buf, str);
> > >
> > > -             parse_rtattr(tb, TCA_MAX, (struct rtattr *)cls->data,
> > > -                             cls->data_len);
> > > +             parse_rtattr_flags(tb, TCA_MAX, (struct rtattr *)cls->data,
> > > +                                cls->data_len, NLA_F_NESTED);
> >
> > Petr recently sent a patch to update parse_rtattr_nested to add the
> > NESTED flag. Can you update this patch to use parse_rtattr_nested?
>
> Yes, will do.

On a second thought, I think this patch should suffice. Using
parse_rtattr_nested
does not work in this case as the object that is being parsed is not a nested
attribute, but a set of attributes placed contiguously in memory.

If I'm not mistaken, Petr's patch allows parsing nested attributes
(with the NLA_F_NESTED flag set) within a nested attribute.

Adding the NLA_F_NESTED flag to parse_rtattr_flags() enables the function
to correctly parse those attributes (among the set of attributes) that happen to
have the NLA_F_NESTED flag set.

Hope I'm making sense.

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

* Re: [PATCH] tc: parse attributes with NLA_F_NESTED flag
  2020-01-16 15:57 [PATCH] tc: parse attributes with NLA_F_NESTED flag Leslie Monis
  2020-01-16 16:01 ` Leslie Monis
  2020-01-18 22:01 ` David Ahern
@ 2020-01-22  3:46 ` David Ahern
  2 siblings, 0 replies; 6+ messages in thread
From: David Ahern @ 2020-01-22  3:46 UTC (permalink / raw)
  To: Leslie Monis, Linux NetDev; +Cc: Stephen Hemminger

On 1/16/20 8:57 AM, Leslie Monis wrote:
> The kernel now requires all new nested attributes to set the
> NLA_F_NESTED flag. Enable tc {qdisc,class,filter} to parse
> attributes that have the NLA_F_NESTED flag set.
> 
> Signed-off-by: Leslie Monis <lesliemonis@gmail.com>
> ---
>  tc/tc_class.c  | 6 +++---
>  tc/tc_filter.c | 2 +-
>  tc/tc_qdisc.c  | 4 ++--
>  3 files changed, 6 insertions(+), 6 deletions(-)
> 

applied to iproute2-next. Thanks



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

end of thread, other threads:[~2020-01-22  3:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-16 15:57 [PATCH] tc: parse attributes with NLA_F_NESTED flag Leslie Monis
2020-01-16 16:01 ` Leslie Monis
2020-01-18 22:01 ` David Ahern
2020-01-19  7:42   ` Leslie Monis
2020-01-19 19:16     ` Leslie Monis
2020-01-22  3:46 ` David Ahern

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.