diff options
| author | Jiri Pirko <jiri@resnulli.us> | 2015-01-13 11:13:43 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2015-01-13 17:51:08 -0500 |
| commit | d8b9605d2697c48fb822c821c5751afbb4567003 (patch) | |
| tree | e9c4cbcafae686743acae5cd834086735e31aa7a /net/sched | |
| parent | 8bdda5ddd1f1590ae24002749adb72693b80baaf (diff) | |
net: sched: fix skb->protocol use in case of accelerated vlan path
tc code implicitly considers skb->protocol even in case of accelerated
vlan paths and expects vlan protocol type here. However, on rx path,
if the vlan header was already stripped, skb->protocol contains value
of next header. Similar situation is on tx path.
So for skbs that use skb->vlan_tci for tagging, use skb->vlan_proto instead.
Reported-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched')
| -rw-r--r-- | net/sched/act_csum.c | 2 | ||||
| -rw-r--r-- | net/sched/cls_flow.c | 8 | ||||
| -rw-r--r-- | net/sched/em_ipset.c | 2 | ||||
| -rw-r--r-- | net/sched/em_meta.c | 2 | ||||
| -rw-r--r-- | net/sched/sch_api.c | 2 | ||||
| -rw-r--r-- | net/sched/sch_dsmark.c | 6 | ||||
| -rw-r--r-- | net/sched/sch_teql.c | 4 |
7 files changed, 13 insertions, 13 deletions
diff --git a/net/sched/act_csum.c b/net/sched/act_csum.c index edbf40dac709..4cd5cf1aedf8 100644 --- a/net/sched/act_csum.c +++ b/net/sched/act_csum.c | |||
| @@ -509,7 +509,7 @@ static int tcf_csum(struct sk_buff *skb, | |||
| 509 | if (unlikely(action == TC_ACT_SHOT)) | 509 | if (unlikely(action == TC_ACT_SHOT)) |
| 510 | goto drop; | 510 | goto drop; |
| 511 | 511 | ||
| 512 | switch (skb->protocol) { | 512 | switch (tc_skb_protocol(skb)) { |
| 513 | case cpu_to_be16(ETH_P_IP): | 513 | case cpu_to_be16(ETH_P_IP): |
| 514 | if (!tcf_csum_ipv4(skb, update_flags)) | 514 | if (!tcf_csum_ipv4(skb, update_flags)) |
| 515 | goto drop; | 515 | goto drop; |
diff --git a/net/sched/cls_flow.c b/net/sched/cls_flow.c index 15d68f24a521..461410394d08 100644 --- a/net/sched/cls_flow.c +++ b/net/sched/cls_flow.c | |||
| @@ -77,7 +77,7 @@ static u32 flow_get_dst(const struct sk_buff *skb, const struct flow_keys *flow) | |||
| 77 | { | 77 | { |
| 78 | if (flow->dst) | 78 | if (flow->dst) |
| 79 | return ntohl(flow->dst); | 79 | return ntohl(flow->dst); |
| 80 | return addr_fold(skb_dst(skb)) ^ (__force u16)skb->protocol; | 80 | return addr_fold(skb_dst(skb)) ^ (__force u16) tc_skb_protocol(skb); |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | static u32 flow_get_proto(const struct sk_buff *skb, const struct flow_keys *flow) | 83 | static u32 flow_get_proto(const struct sk_buff *skb, const struct flow_keys *flow) |
| @@ -98,7 +98,7 @@ static u32 flow_get_proto_dst(const struct sk_buff *skb, const struct flow_keys | |||
| 98 | if (flow->ports) | 98 | if (flow->ports) |
| 99 | return ntohs(flow->port16[1]); | 99 | return ntohs(flow->port16[1]); |
| 100 | 100 | ||
| 101 | return addr_fold(skb_dst(skb)) ^ (__force u16)skb->protocol; | 101 | return addr_fold(skb_dst(skb)) ^ (__force u16) tc_skb_protocol(skb); |
| 102 | } | 102 | } |
| 103 | 103 | ||
| 104 | static u32 flow_get_iif(const struct sk_buff *skb) | 104 | static u32 flow_get_iif(const struct sk_buff *skb) |
| @@ -144,7 +144,7 @@ static u32 flow_get_nfct(const struct sk_buff *skb) | |||
| 144 | 144 | ||
| 145 | static u32 flow_get_nfct_src(const struct sk_buff *skb, const struct flow_keys *flow) | 145 | static u32 flow_get_nfct_src(const struct sk_buff *skb, const struct flow_keys *flow) |
| 146 | { | 146 | { |
| 147 | switch (skb->protocol) { | 147 | switch (tc_skb_protocol(skb)) { |
| 148 | case htons(ETH_P_IP): | 148 | case htons(ETH_P_IP): |
| 149 | return ntohl(CTTUPLE(skb, src.u3.ip)); | 149 | return ntohl(CTTUPLE(skb, src.u3.ip)); |
| 150 | case htons(ETH_P_IPV6): | 150 | case htons(ETH_P_IPV6): |
| @@ -156,7 +156,7 @@ fallback: | |||
| 156 | 156 | ||
| 157 | static u32 flow_get_nfct_dst(const struct sk_buff *skb, const struct flow_keys *flow) | 157 | static u32 flow_get_nfct_dst(const struct sk_buff *skb, const struct flow_keys *flow) |
| 158 | { | 158 | { |
| 159 | switch (skb->protocol) { | 159 | switch (tc_skb_protocol(skb)) { |
| 160 | case htons(ETH_P_IP): | 160 | case htons(ETH_P_IP): |
| 161 | return ntohl(CTTUPLE(skb, dst.u3.ip)); | 161 | return ntohl(CTTUPLE(skb, dst.u3.ip)); |
| 162 | case htons(ETH_P_IPV6): | 162 | case htons(ETH_P_IPV6): |
diff --git a/net/sched/em_ipset.c b/net/sched/em_ipset.c index 5b4a4efe468c..a3d79c8bf3b8 100644 --- a/net/sched/em_ipset.c +++ b/net/sched/em_ipset.c | |||
| @@ -59,7 +59,7 @@ static int em_ipset_match(struct sk_buff *skb, struct tcf_ematch *em, | |||
| 59 | struct net_device *dev, *indev = NULL; | 59 | struct net_device *dev, *indev = NULL; |
| 60 | int ret, network_offset; | 60 | int ret, network_offset; |
| 61 | 61 | ||
| 62 | switch (skb->protocol) { | 62 | switch (tc_skb_protocol(skb)) { |
| 63 | case htons(ETH_P_IP): | 63 | case htons(ETH_P_IP): |
| 64 | acpar.family = NFPROTO_IPV4; | 64 | acpar.family = NFPROTO_IPV4; |
| 65 | if (!pskb_network_may_pull(skb, sizeof(struct iphdr))) | 65 | if (!pskb_network_may_pull(skb, sizeof(struct iphdr))) |
diff --git a/net/sched/em_meta.c b/net/sched/em_meta.c index c8f8c399b99a..2159981b604e 100644 --- a/net/sched/em_meta.c +++ b/net/sched/em_meta.c | |||
| @@ -197,7 +197,7 @@ META_COLLECTOR(int_priority) | |||
| 197 | META_COLLECTOR(int_protocol) | 197 | META_COLLECTOR(int_protocol) |
| 198 | { | 198 | { |
| 199 | /* Let userspace take care of the byte ordering */ | 199 | /* Let userspace take care of the byte ordering */ |
| 200 | dst->value = skb->protocol; | 200 | dst->value = tc_skb_protocol(skb); |
| 201 | } | 201 | } |
| 202 | 202 | ||
| 203 | META_COLLECTOR(int_pkttype) | 203 | META_COLLECTOR(int_pkttype) |
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index 76f402e05bd6..243b7d169d61 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
| @@ -1807,7 +1807,7 @@ done: | |||
| 1807 | int tc_classify_compat(struct sk_buff *skb, const struct tcf_proto *tp, | 1807 | int tc_classify_compat(struct sk_buff *skb, const struct tcf_proto *tp, |
| 1808 | struct tcf_result *res) | 1808 | struct tcf_result *res) |
| 1809 | { | 1809 | { |
| 1810 | __be16 protocol = skb->protocol; | 1810 | __be16 protocol = tc_skb_protocol(skb); |
| 1811 | int err; | 1811 | int err; |
| 1812 | 1812 | ||
| 1813 | for (; tp; tp = rcu_dereference_bh(tp->next)) { | 1813 | for (; tp; tp = rcu_dereference_bh(tp->next)) { |
diff --git a/net/sched/sch_dsmark.c b/net/sched/sch_dsmark.c index 227114f27f94..66700a6116aa 100644 --- a/net/sched/sch_dsmark.c +++ b/net/sched/sch_dsmark.c | |||
| @@ -203,7 +203,7 @@ static int dsmark_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
| 203 | pr_debug("%s(skb %p,sch %p,[qdisc %p])\n", __func__, skb, sch, p); | 203 | pr_debug("%s(skb %p,sch %p,[qdisc %p])\n", __func__, skb, sch, p); |
| 204 | 204 | ||
| 205 | if (p->set_tc_index) { | 205 | if (p->set_tc_index) { |
| 206 | switch (skb->protocol) { | 206 | switch (tc_skb_protocol(skb)) { |
| 207 | case htons(ETH_P_IP): | 207 | case htons(ETH_P_IP): |
| 208 | if (skb_cow_head(skb, sizeof(struct iphdr))) | 208 | if (skb_cow_head(skb, sizeof(struct iphdr))) |
| 209 | goto drop; | 209 | goto drop; |
| @@ -289,7 +289,7 @@ static struct sk_buff *dsmark_dequeue(struct Qdisc *sch) | |||
| 289 | index = skb->tc_index & (p->indices - 1); | 289 | index = skb->tc_index & (p->indices - 1); |
| 290 | pr_debug("index %d->%d\n", skb->tc_index, index); | 290 | pr_debug("index %d->%d\n", skb->tc_index, index); |
| 291 | 291 | ||
| 292 | switch (skb->protocol) { | 292 | switch (tc_skb_protocol(skb)) { |
| 293 | case htons(ETH_P_IP): | 293 | case htons(ETH_P_IP): |
| 294 | ipv4_change_dsfield(ip_hdr(skb), p->mask[index], | 294 | ipv4_change_dsfield(ip_hdr(skb), p->mask[index], |
| 295 | p->value[index]); | 295 | p->value[index]); |
| @@ -306,7 +306,7 @@ static struct sk_buff *dsmark_dequeue(struct Qdisc *sch) | |||
| 306 | */ | 306 | */ |
| 307 | if (p->mask[index] != 0xff || p->value[index]) | 307 | if (p->mask[index] != 0xff || p->value[index]) |
| 308 | pr_warn("%s: unsupported protocol %d\n", | 308 | pr_warn("%s: unsupported protocol %d\n", |
| 309 | __func__, ntohs(skb->protocol)); | 309 | __func__, ntohs(tc_skb_protocol(skb))); |
| 310 | break; | 310 | break; |
| 311 | } | 311 | } |
| 312 | 312 | ||
diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c index 4899d4a18aa5..e02687185a59 100644 --- a/net/sched/sch_teql.c +++ b/net/sched/sch_teql.c | |||
| @@ -242,8 +242,8 @@ __teql_resolve(struct sk_buff *skb, struct sk_buff *skb_res, | |||
| 242 | char haddr[MAX_ADDR_LEN]; | 242 | char haddr[MAX_ADDR_LEN]; |
| 243 | 243 | ||
| 244 | neigh_ha_snapshot(haddr, n, dev); | 244 | neigh_ha_snapshot(haddr, n, dev); |
| 245 | err = dev_hard_header(skb, dev, ntohs(skb->protocol), haddr, | 245 | err = dev_hard_header(skb, dev, ntohs(tc_skb_protocol(skb)), |
| 246 | NULL, skb->len); | 246 | haddr, NULL, skb->len); |
| 247 | 247 | ||
| 248 | if (err < 0) | 248 | if (err < 0) |
| 249 | err = -EINVAL; | 249 | err = -EINVAL; |
