diff mbox series

[v2,net,2/2] net: sched: fix TCF_LAYER_LINK case in tcf_get_base_ptr

Message ID 20180122105342.15182-3-w.bumiller@proxmox.com
State Not Applicable, archived
Delegated to: David Miller
Headers show
Series nbyte, cmp and text filter fixups | expand

Commit Message

Wolfgang Bumiller Jan. 22, 2018, 10:53 a.m. UTC
TCF_LAYER_LINK and TCF_LAYER_NETWORK returned the same pointer as
skb->data points to the network header.
Use skb_mac_header instead.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
---
Only change: fixed up commit message

Previous comment:
  Alternatively this could return skb->head directly, but
  'sk_buff->mac_header' is documented as 'Link layer header' and this
  seemed more clear. Since on the first read I thought "it looks fine"
  while in fact skb->head comes before skb->data, so this seems less
  confusing.

 include/net/pkt_cls.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Cong Wang Jan. 22, 2018, 10:39 p.m. UTC | #1
On Mon, Jan 22, 2018 at 2:53 AM, Wolfgang Bumiller
<w.bumiller@proxmox.com> wrote:
> TCF_LAYER_LINK and TCF_LAYER_NETWORK returned the same pointer as
> skb->data points to the network header.
> Use skb_mac_header instead.

skb->data points to network header only on ingress side, IIRC.
diff mbox series

Patch

diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
index 8e08b6da72f3..753ac9361154 100644
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -522,7 +522,7 @@  static inline unsigned char * tcf_get_base_ptr(struct sk_buff *skb, int layer)
 {
 	switch (layer) {
 		case TCF_LAYER_LINK:
-			return skb->data;
+			return skb_mac_header(skb);
 		case TCF_LAYER_NETWORK:
 			return skb_network_header(skb);
 		case TCF_LAYER_TRANSPORT: