diff options
author | David S. Miller <davem@davemloft.net> | 2016-09-27 09:53:30 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-09-27 09:53:30 -0400 |
commit | 7b8147aae741fedb7eab970361cd051d47bc8021 (patch) | |
tree | eb6f82ecd60bbcea3c16a16809b2272b9147db59 | |
parent | 1190cfdb1a19d89561ae51cff7d9c2ead24b3ebe (diff) | |
parent | c006da0be033b6ddcd27ee603d0ee01491236642 (diff) |
Merge branch 'act_ife-fixes'
Yotam Gigi says:
====================
Fix tc-ife bugs
This patch-set contains two bugfixes in the tc-ife action, one fixing some
random behaviour in encode side, and one fixing the decode side packet
parsing logic.
v2->v3
- Fix the encode side instead of the decode side
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/sched/act_ife.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/net/sched/act_ife.c b/net/sched/act_ife.c index e87cd81315e1..4a60cd5e1875 100644 --- a/net/sched/act_ife.c +++ b/net/sched/act_ife.c | |||
@@ -53,7 +53,7 @@ int ife_tlv_meta_encode(void *skbdata, u16 attrtype, u16 dlen, const void *dval) | |||
53 | u32 *tlv = (u32 *)(skbdata); | 53 | u32 *tlv = (u32 *)(skbdata); |
54 | u16 totlen = nla_total_size(dlen); /*alignment + hdr */ | 54 | u16 totlen = nla_total_size(dlen); /*alignment + hdr */ |
55 | char *dptr = (char *)tlv + NLA_HDRLEN; | 55 | char *dptr = (char *)tlv + NLA_HDRLEN; |
56 | u32 htlv = attrtype << 16 | dlen; | 56 | u32 htlv = attrtype << 16 | (dlen + NLA_HDRLEN); |
57 | 57 | ||
58 | *tlv = htonl(htlv); | 58 | *tlv = htonl(htlv); |
59 | memset(dptr, 0, totlen - NLA_HDRLEN); | 59 | memset(dptr, 0, totlen - NLA_HDRLEN); |
@@ -627,7 +627,7 @@ static int tcf_ife_decode(struct sk_buff *skb, const struct tc_action *a, | |||
627 | struct tcf_ife_info *ife = to_ife(a); | 627 | struct tcf_ife_info *ife = to_ife(a); |
628 | int action = ife->tcf_action; | 628 | int action = ife->tcf_action; |
629 | struct ifeheadr *ifehdr = (struct ifeheadr *)skb->data; | 629 | struct ifeheadr *ifehdr = (struct ifeheadr *)skb->data; |
630 | u16 ifehdrln = ifehdr->metalen; | 630 | int ifehdrln = (int)ifehdr->metalen; |
631 | struct meta_tlvhdr *tlv = (struct meta_tlvhdr *)(ifehdr->tlv_data); | 631 | struct meta_tlvhdr *tlv = (struct meta_tlvhdr *)(ifehdr->tlv_data); |
632 | 632 | ||
633 | spin_lock(&ife->tcf_lock); | 633 | spin_lock(&ife->tcf_lock); |
@@ -740,8 +740,6 @@ static int tcf_ife_encode(struct sk_buff *skb, const struct tc_action *a, | |||
740 | return TC_ACT_SHOT; | 740 | return TC_ACT_SHOT; |
741 | } | 741 | } |
742 | 742 | ||
743 | iethh = eth_hdr(skb); | ||
744 | |||
745 | err = skb_cow_head(skb, hdrm); | 743 | err = skb_cow_head(skb, hdrm); |
746 | if (unlikely(err)) { | 744 | if (unlikely(err)) { |
747 | ife->tcf_qstats.drops++; | 745 | ife->tcf_qstats.drops++; |
@@ -752,6 +750,7 @@ static int tcf_ife_encode(struct sk_buff *skb, const struct tc_action *a, | |||
752 | if (!(at & AT_EGRESS)) | 750 | if (!(at & AT_EGRESS)) |
753 | skb_push(skb, skb->dev->hard_header_len); | 751 | skb_push(skb, skb->dev->hard_header_len); |
754 | 752 | ||
753 | iethh = (struct ethhdr *)skb->data; | ||
755 | __skb_push(skb, hdrm); | 754 | __skb_push(skb, hdrm); |
756 | memcpy(skb->data, iethh, skb->mac_len); | 755 | memcpy(skb->data, iethh, skb->mac_len); |
757 | skb_reset_mac_header(skb); | 756 | skb_reset_mac_header(skb); |