Commit 7b8147aa authored by David S. Miller's avatar David S. Miller

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: default avatarDavid S. Miller <davem@davemloft.net>
parents 1190cfdb c006da0b
...@@ -53,7 +53,7 @@ int ife_tlv_meta_encode(void *skbdata, u16 attrtype, u16 dlen, const void *dval) ...@@ -53,7 +53,7 @@ int ife_tlv_meta_encode(void *skbdata, u16 attrtype, u16 dlen, const void *dval)
u32 *tlv = (u32 *)(skbdata); u32 *tlv = (u32 *)(skbdata);
u16 totlen = nla_total_size(dlen); /*alignment + hdr */ u16 totlen = nla_total_size(dlen); /*alignment + hdr */
char *dptr = (char *)tlv + NLA_HDRLEN; char *dptr = (char *)tlv + NLA_HDRLEN;
u32 htlv = attrtype << 16 | dlen; u32 htlv = attrtype << 16 | (dlen + NLA_HDRLEN);
*tlv = htonl(htlv); *tlv = htonl(htlv);
memset(dptr, 0, totlen - NLA_HDRLEN); 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,7 +627,7 @@ static int tcf_ife_decode(struct sk_buff *skb, const struct tc_action *a,
struct tcf_ife_info *ife = to_ife(a); struct tcf_ife_info *ife = to_ife(a);
int action = ife->tcf_action; int action = ife->tcf_action;
struct ifeheadr *ifehdr = (struct ifeheadr *)skb->data; struct ifeheadr *ifehdr = (struct ifeheadr *)skb->data;
u16 ifehdrln = ifehdr->metalen; int ifehdrln = (int)ifehdr->metalen;
struct meta_tlvhdr *tlv = (struct meta_tlvhdr *)(ifehdr->tlv_data); struct meta_tlvhdr *tlv = (struct meta_tlvhdr *)(ifehdr->tlv_data);
spin_lock(&ife->tcf_lock); spin_lock(&ife->tcf_lock);
...@@ -740,8 +740,6 @@ static int tcf_ife_encode(struct sk_buff *skb, const struct tc_action *a, ...@@ -740,8 +740,6 @@ static int tcf_ife_encode(struct sk_buff *skb, const struct tc_action *a,
return TC_ACT_SHOT; return TC_ACT_SHOT;
} }
iethh = eth_hdr(skb);
err = skb_cow_head(skb, hdrm); err = skb_cow_head(skb, hdrm);
if (unlikely(err)) { if (unlikely(err)) {
ife->tcf_qstats.drops++; ife->tcf_qstats.drops++;
...@@ -752,6 +750,7 @@ static int tcf_ife_encode(struct sk_buff *skb, const struct tc_action *a, ...@@ -752,6 +750,7 @@ static int tcf_ife_encode(struct sk_buff *skb, const struct tc_action *a,
if (!(at & AT_EGRESS)) if (!(at & AT_EGRESS))
skb_push(skb, skb->dev->hard_header_len); skb_push(skb, skb->dev->hard_header_len);
iethh = (struct ethhdr *)skb->data;
__skb_push(skb, hdrm); __skb_push(skb, hdrm);
memcpy(skb->data, iethh, skb->mac_len); memcpy(skb->data, iethh, skb->mac_len);
skb_reset_mac_header(skb); skb_reset_mac_header(skb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment