Skip to content

Commit 7b8147a

Browse files
committed
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 <[email protected]>
2 parents 1190cfd + c006da0 commit 7b8147a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

net/sched/act_ife.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ int ife_tlv_meta_encode(void *skbdata, u16 attrtype, u16 dlen, const void *dval)
5353
u32 *tlv = (u32 *)(skbdata);
5454
u16 totlen = nla_total_size(dlen); /*alignment + hdr */
5555
char *dptr = (char *)tlv + NLA_HDRLEN;
56-
u32 htlv = attrtype << 16 | dlen;
56+
u32 htlv = attrtype << 16 | (dlen + NLA_HDRLEN);
5757

5858
*tlv = htonl(htlv);
5959
memset(dptr, 0, totlen - NLA_HDRLEN);
@@ -627,7 +627,7 @@ static int tcf_ife_decode(struct sk_buff *skb, const struct tc_action *a,
627627
struct tcf_ife_info *ife = to_ife(a);
628628
int action = ife->tcf_action;
629629
struct ifeheadr *ifehdr = (struct ifeheadr *)skb->data;
630-
u16 ifehdrln = ifehdr->metalen;
630+
int ifehdrln = (int)ifehdr->metalen;
631631
struct meta_tlvhdr *tlv = (struct meta_tlvhdr *)(ifehdr->tlv_data);
632632

633633
spin_lock(&ife->tcf_lock);
@@ -740,8 +740,6 @@ static int tcf_ife_encode(struct sk_buff *skb, const struct tc_action *a,
740740
return TC_ACT_SHOT;
741741
}
742742

743-
iethh = eth_hdr(skb);
744-
745743
err = skb_cow_head(skb, hdrm);
746744
if (unlikely(err)) {
747745
ife->tcf_qstats.drops++;
@@ -752,6 +750,7 @@ static int tcf_ife_encode(struct sk_buff *skb, const struct tc_action *a,
752750
if (!(at & AT_EGRESS))
753751
skb_push(skb, skb->dev->hard_header_len);
754752

753+
iethh = (struct ethhdr *)skb->data;
755754
__skb_push(skb, hdrm);
756755
memcpy(skb->data, iethh, skb->mac_len);
757756
skb_reset_mac_header(skb);

0 commit comments

Comments
 (0)