diff mbox series

[net] net: sched: Fix dump of MPLS_OPT_LSE_LABEL attribute in cls_flower

Message ID 0e248b0464673b412d428666d10b6d3c208809bf.1607528860.git.gnault@redhat.com (mailing list archive)
State Accepted
Delegated to: Netdev Maintainers
Headers show
Series [net] net: sched: Fix dump of MPLS_OPT_LSE_LABEL attribute in cls_flower | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net
netdev/subject_prefix success Link
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 88 this patch: 88
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 10 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 88 this patch: 88
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Guillaume Nault Dec. 9, 2020, 3:48 p.m. UTC
TCA_FLOWER_KEY_MPLS_OPT_LSE_LABEL is a u32 attribute (MPLS label is
20 bits long).

Fixes the following bug:

 $ tc filter add dev ethX ingress protocol mpls_uc \
     flower mpls lse depth 2 label 256             \
     action drop

 $ tc filter show dev ethX ingress
   filter protocol mpls_uc pref 49152 flower chain 0
   filter protocol mpls_uc pref 49152 flower chain 0 handle 0x1
     eth_type 8847
     mpls
       lse depth 2 label 0  <-- invalid label 0, should be 256
   ...

Fixes: 61aec25a6db5 ("cls_flower: Support filtering on multiple MPLS Label Stack Entries")
Signed-off-by: Guillaume Nault <gnault@redhat.com>
---
 net/sched/cls_flower.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Davide Caratti Dec. 10, 2020, 5:47 p.m. UTC | #1
On Wed, 2020-12-09 at 16:48 +0100, Guillaume Nault wrote:
> TCA_FLOWER_KEY_MPLS_OPT_LSE_LABEL is a u32 attribute (MPLS label is
> 20 bits long).
> 
> Fixes the following bug:
> 
>  $ tc filter add dev ethX ingress protocol mpls_uc \
>      flower mpls lse depth 2 label 256             \
>      action drop
> 
>  $ tc filter show dev ethX ingress
>    filter protocol mpls_uc pref 49152 flower chain 0
>    filter protocol mpls_uc pref 49152 flower chain 0 handle 0x1
>      eth_type 8847
>      mpls
>        lse depth 2 label 0  <-- invalid label 0, should be 256
>    ...
> 
> Fixes: 61aec25a6db5 ("cls_flower: Support filtering on multiple MPLS Label Stack Entries")
> Signed-off-by: Guillaume Nault <gnault@redhat.com>

Reviewed-by: Davide Caratti <dcaratti@redhat.com>
diff mbox series

Patch

diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
index fed18fd2c50b..1319986693fc 100644
--- a/net/sched/cls_flower.c
+++ b/net/sched/cls_flower.c
@@ -2424,8 +2424,8 @@  static int fl_dump_key_mpls_opt_lse(struct sk_buff *skb,
 			return err;
 	}
 	if (lse_mask->mpls_label) {
-		err = nla_put_u8(skb, TCA_FLOWER_KEY_MPLS_OPT_LSE_LABEL,
-				 lse_key->mpls_label);
+		err = nla_put_u32(skb, TCA_FLOWER_KEY_MPLS_OPT_LSE_LABEL,
+				  lse_key->mpls_label);
 		if (err)
 			return err;
 	}