Skip to content

Commit 970bfcd

Browse files
Paul Blakeydavem330
authored andcommitted
net/sched: cls_flower: Use mask for addr_type
When addr_type is set, mask should also be set. Fixes: 66530bd ('sched,cls_flower: set key address type when present') Fixes: bc3103f ('net/sched: cls_flower: Classify packet in ip tunnels') Signed-off-by: Paul Blakey <paulb@mellanox.com> Reviewed-by: Roi Dayan <roid@mellanox.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 83a77e9 commit 970bfcd

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

net/sched/cls_flower.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,7 @@ static int fl_set_key(struct net *net, struct nlattr **tb,
509509

510510
if (tb[TCA_FLOWER_KEY_IPV4_SRC] || tb[TCA_FLOWER_KEY_IPV4_DST]) {
511511
key->control.addr_type = FLOW_DISSECTOR_KEY_IPV4_ADDRS;
512+
mask->control.addr_type = ~0;
512513
fl_set_key_val(tb, &key->ipv4.src, TCA_FLOWER_KEY_IPV4_SRC,
513514
&mask->ipv4.src, TCA_FLOWER_KEY_IPV4_SRC_MASK,
514515
sizeof(key->ipv4.src));
@@ -517,6 +518,7 @@ static int fl_set_key(struct net *net, struct nlattr **tb,
517518
sizeof(key->ipv4.dst));
518519
} else if (tb[TCA_FLOWER_KEY_IPV6_SRC] || tb[TCA_FLOWER_KEY_IPV6_DST]) {
519520
key->control.addr_type = FLOW_DISSECTOR_KEY_IPV6_ADDRS;
521+
mask->control.addr_type = ~0;
520522
fl_set_key_val(tb, &key->ipv6.src, TCA_FLOWER_KEY_IPV6_SRC,
521523
&mask->ipv6.src, TCA_FLOWER_KEY_IPV6_SRC_MASK,
522524
sizeof(key->ipv6.src));
@@ -571,6 +573,7 @@ static int fl_set_key(struct net *net, struct nlattr **tb,
571573
if (tb[TCA_FLOWER_KEY_ENC_IPV4_SRC] ||
572574
tb[TCA_FLOWER_KEY_ENC_IPV4_DST]) {
573575
key->enc_control.addr_type = FLOW_DISSECTOR_KEY_IPV4_ADDRS;
576+
mask->enc_control.addr_type = ~0;
574577
fl_set_key_val(tb, &key->enc_ipv4.src,
575578
TCA_FLOWER_KEY_ENC_IPV4_SRC,
576579
&mask->enc_ipv4.src,
@@ -586,6 +589,7 @@ static int fl_set_key(struct net *net, struct nlattr **tb,
586589
if (tb[TCA_FLOWER_KEY_ENC_IPV6_SRC] ||
587590
tb[TCA_FLOWER_KEY_ENC_IPV6_DST]) {
588591
key->enc_control.addr_type = FLOW_DISSECTOR_KEY_IPV6_ADDRS;
592+
mask->enc_control.addr_type = ~0;
589593
fl_set_key_val(tb, &key->enc_ipv6.src,
590594
TCA_FLOWER_KEY_ENC_IPV6_SRC,
591595
&mask->enc_ipv6.src,

0 commit comments

Comments
 (0)