diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2007-03-10 20:16:10 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:24:58 -0400 |
commit | bbe735e4247dba32568a305553b010081c8dea99 (patch) | |
tree | 95d96619c85785a47ccee48965b68d99cf946854 | |
parent | e7dd65dafda5737a983c04d652a69ab8da78ee3f (diff) |
[SK_BUFF]: Introduce skb_network_offset()
For the quite common 'skb->nh.raw - skb->data' sequence.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/isdn/i4l/isdn_net.c | 2 | ||||
-rw-r--r-- | drivers/net/atl1/atl1_main.c | 2 | ||||
-rw-r--r-- | drivers/net/chelsio/sge.c | 2 | ||||
-rw-r--r-- | drivers/net/cxgb3/sge.c | 2 | ||||
-rw-r--r-- | drivers/net/e1000/e1000_main.c | 2 | ||||
-rw-r--r-- | drivers/net/gianfar.c | 2 | ||||
-rw-r--r-- | drivers/net/ixgb/ixgb_main.c | 2 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_hw.c | 2 | ||||
-rw-r--r-- | include/linux/skbuff.h | 5 | ||||
-rw-r--r-- | net/ax25/ax25_out.c | 4 | ||||
-rw-r--r-- | net/core/neighbour.c | 6 | ||||
-rw-r--r-- | net/ipv4/ip_output.c | 4 | ||||
-rw-r--r-- | net/ipv6/icmp.c | 4 | ||||
-rw-r--r-- | net/ipv6/ip6_output.c | 4 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_core.c | 4 | ||||
-rw-r--r-- | net/packet/af_packet.c | 8 | ||||
-rw-r--r-- | net/sched/sch_teql.c | 2 | ||||
-rw-r--r-- | security/selinux/hooks.c | 4 |
18 files changed, 33 insertions, 28 deletions
diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c index fadb9291bc1..0c2b3752e46 100644 --- a/drivers/isdn/i4l/isdn_net.c +++ b/drivers/isdn/i4l/isdn_net.c | |||
@@ -1121,7 +1121,7 @@ isdn_net_adjust_hdr(struct sk_buff *skb, struct net_device *dev) | |||
1121 | if (!skb) | 1121 | if (!skb) |
1122 | return; | 1122 | return; |
1123 | if (lp->p_encap == ISDN_NET_ENCAP_ETHER) { | 1123 | if (lp->p_encap == ISDN_NET_ENCAP_ETHER) { |
1124 | int pullsize = (ulong)skb->nh.raw - (ulong)skb->data - ETH_HLEN; | 1124 | const int pullsize = skb_network_offset(skb) - ETH_HLEN; |
1125 | if (pullsize > 0) { | 1125 | if (pullsize > 0) { |
1126 | printk(KERN_DEBUG "isdn_net: Pull junk %d\n", pullsize); | 1126 | printk(KERN_DEBUG "isdn_net: Pull junk %d\n", pullsize); |
1127 | skb_pull(skb, pullsize); | 1127 | skb_pull(skb, pullsize); |
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c index e3f181602e4..793a61b2140 100644 --- a/drivers/net/atl1/atl1_main.c +++ b/drivers/net/atl1/atl1_main.c | |||
@@ -1300,7 +1300,7 @@ static int atl1_tso(struct atl1_adapter *adapter, struct sk_buff *skb, | |||
1300 | ~csum_tcpudp_magic(skb->nh.iph->saddr, | 1300 | ~csum_tcpudp_magic(skb->nh.iph->saddr, |
1301 | skb->nh.iph->daddr, 0, | 1301 | skb->nh.iph->daddr, 0, |
1302 | IPPROTO_TCP, 0); | 1302 | IPPROTO_TCP, 0); |
1303 | ipofst = skb->nh.raw - skb->data; | 1303 | ipofst = skb_network_offset(skb); |
1304 | if (ipofst != ENET_HEADER_SIZE) /* 802.3 frame */ | 1304 | if (ipofst != ENET_HEADER_SIZE) /* 802.3 frame */ |
1305 | tso->tsopl |= 1 << TSO_PARAM_ETHTYPE_SHIFT; | 1305 | tso->tsopl |= 1 << TSO_PARAM_ETHTYPE_SHIFT; |
1306 | 1306 | ||
diff --git a/drivers/net/chelsio/sge.c b/drivers/net/chelsio/sge.c index 47fa8dcf752..8cdee67d582 100644 --- a/drivers/net/chelsio/sge.c +++ b/drivers/net/chelsio/sge.c | |||
@@ -1865,7 +1865,7 @@ int t1_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1865 | 1865 | ||
1866 | ++st->tx_tso; | 1866 | ++st->tx_tso; |
1867 | 1867 | ||
1868 | eth_type = skb->nh.raw - skb->data == ETH_HLEN ? | 1868 | eth_type = skb_network_offset(skb) == ETH_HLEN ? |
1869 | CPL_ETH_II : CPL_ETH_II_VLAN; | 1869 | CPL_ETH_II : CPL_ETH_II_VLAN; |
1870 | 1870 | ||
1871 | hdr = (struct cpl_tx_pkt_lso *)skb_push(skb, sizeof(*hdr)); | 1871 | hdr = (struct cpl_tx_pkt_lso *)skb_push(skb, sizeof(*hdr)); |
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c index 4dd712088bc..7e9e9db4fb9 100644 --- a/drivers/net/cxgb3/sge.c +++ b/drivers/net/cxgb3/sge.c | |||
@@ -897,7 +897,7 @@ static void write_tx_pkt_wr(struct adapter *adap, struct sk_buff *skb, | |||
897 | d->flit[2] = 0; | 897 | d->flit[2] = 0; |
898 | cntrl |= V_TXPKT_OPCODE(CPL_TX_PKT_LSO); | 898 | cntrl |= V_TXPKT_OPCODE(CPL_TX_PKT_LSO); |
899 | hdr->cntrl = htonl(cntrl); | 899 | hdr->cntrl = htonl(cntrl); |
900 | eth_type = skb->nh.raw - skb->data == ETH_HLEN ? | 900 | eth_type = skb_network_offset(skb) == ETH_HLEN ? |
901 | CPL_ETH_II : CPL_ETH_II_VLAN; | 901 | CPL_ETH_II : CPL_ETH_II_VLAN; |
902 | tso_info |= V_LSO_ETH_TYPE(eth_type) | | 902 | tso_info |= V_LSO_ETH_TYPE(eth_type) | |
903 | V_LSO_IPHDR_WORDS(skb->nh.iph->ihl) | | 903 | V_LSO_IPHDR_WORDS(skb->nh.iph->ihl) | |
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index b28a915bd98..86161011b53 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -2910,7 +2910,7 @@ e1000_tso(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, | |||
2910 | 0); | 2910 | 0); |
2911 | ipcse = 0; | 2911 | ipcse = 0; |
2912 | } | 2912 | } |
2913 | ipcss = skb->nh.raw - skb->data; | 2913 | ipcss = skb_network_offset(skb); |
2914 | ipcso = (void *)&(skb->nh.iph->check) - (void *)skb->data; | 2914 | ipcso = (void *)&(skb->nh.iph->check) - (void *)skb->data; |
2915 | tucss = skb->h.raw - skb->data; | 2915 | tucss = skb->h.raw - skb->data; |
2916 | tucso = (void *)&(skb->h.th->check) - (void *)skb->data; | 2916 | tucso = (void *)&(skb->h.th->check) - (void *)skb->data; |
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index 1d019195a39..c7a70933c75 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
@@ -952,7 +952,7 @@ static inline void gfar_tx_checksum(struct sk_buff *skb, struct txfcb *fcb) | |||
952 | * frame (skb->data) and the start of the IP hdr. | 952 | * frame (skb->data) and the start of the IP hdr. |
953 | * l4os is the distance between the start of the | 953 | * l4os is the distance between the start of the |
954 | * l3 hdr and the l4 hdr */ | 954 | * l3 hdr and the l4 hdr */ |
955 | fcb->l3os = (u16)(skb->nh.raw - skb->data - GMAC_FCB_LEN); | 955 | fcb->l3os = (u16)(skb_network_offset(skb) - GMAC_FCB_LEN); |
956 | fcb->l4os = (u16)(skb->h.raw - skb->nh.raw); | 956 | fcb->l4os = (u16)(skb->h.raw - skb->nh.raw); |
957 | 957 | ||
958 | fcb->flags = flags; | 958 | fcb->flags = flags; |
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c index afc2ec72529..cfb791bb45e 100644 --- a/drivers/net/ixgb/ixgb_main.c +++ b/drivers/net/ixgb/ixgb_main.c | |||
@@ -1195,7 +1195,7 @@ ixgb_tso(struct ixgb_adapter *adapter, struct sk_buff *skb) | |||
1195 | skb->h.th->check = ~csum_tcpudp_magic(skb->nh.iph->saddr, | 1195 | skb->h.th->check = ~csum_tcpudp_magic(skb->nh.iph->saddr, |
1196 | skb->nh.iph->daddr, | 1196 | skb->nh.iph->daddr, |
1197 | 0, IPPROTO_TCP, 0); | 1197 | 0, IPPROTO_TCP, 0); |
1198 | ipcss = skb->nh.raw - skb->data; | 1198 | ipcss = skb_network_offset(skb); |
1199 | ipcso = (void *)&(skb->nh.iph->check) - (void *)skb->data; | 1199 | ipcso = (void *)&(skb->nh.iph->check) - (void *)skb->data; |
1200 | ipcse = skb->h.raw - skb->data - 1; | 1200 | ipcse = skb->h.raw - skb->data - 1; |
1201 | tucss = skb->h.raw - skb->data; | 1201 | tucss = skb->h.raw - skb->data; |
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c index 6537574a9cd..625e11ed6aa 100644 --- a/drivers/net/netxen/netxen_nic_hw.c +++ b/drivers/net/netxen/netxen_nic_hw.c | |||
@@ -386,7 +386,7 @@ void netxen_tso_check(struct netxen_adapter *adapter, | |||
386 | } | 386 | } |
387 | adapter->stats.xmitcsummed++; | 387 | adapter->stats.xmitcsummed++; |
388 | desc->tcp_hdr_offset = skb->h.raw - skb->data; | 388 | desc->tcp_hdr_offset = skb->h.raw - skb->data; |
389 | desc->ip_hdr_offset = skb->nh.raw - skb->data; | 389 | desc->ip_hdr_offset = skb_network_offset(skb); |
390 | } | 390 | } |
391 | 391 | ||
392 | int netxen_is_flash_supported(struct netxen_adapter *adapter) | 392 | int netxen_is_flash_supported(struct netxen_adapter *adapter) |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 6440c78fe62..47cc8b07c2b 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -965,6 +965,11 @@ static inline void skb_reset_network_header(struct sk_buff *skb) | |||
965 | skb->nh.raw = skb->data; | 965 | skb->nh.raw = skb->data; |
966 | } | 966 | } |
967 | 967 | ||
968 | static inline int skb_network_offset(const struct sk_buff *skb) | ||
969 | { | ||
970 | return skb->nh.raw - skb->data; | ||
971 | } | ||
972 | |||
968 | static inline unsigned char *skb_mac_header(const struct sk_buff *skb) | 973 | static inline unsigned char *skb_mac_header(const struct sk_buff *skb) |
969 | { | 974 | { |
970 | return skb->mac.raw; | 975 | return skb->mac.raw; |
diff --git a/net/ax25/ax25_out.c b/net/ax25/ax25_out.c index 6e08dc8dee4..02dea851a11 100644 --- a/net/ax25/ax25_out.c +++ b/net/ax25/ax25_out.c | |||
@@ -148,7 +148,7 @@ void ax25_output(ax25_cb *ax25, int paclen, struct sk_buff *skb) | |||
148 | 148 | ||
149 | if (ka9qfrag == 1) { | 149 | if (ka9qfrag == 1) { |
150 | skb_reserve(skbn, frontlen + 2); | 150 | skb_reserve(skbn, frontlen + 2); |
151 | skbn->nh.raw = skbn->data + (skb->nh.raw - skb->data); | 151 | skbn->nh.raw = skbn->data + skb_network_offset(skb); |
152 | memcpy(skb_put(skbn, len), skb->data, len); | 152 | memcpy(skb_put(skbn, len), skb->data, len); |
153 | p = skb_push(skbn, 2); | 153 | p = skb_push(skbn, 2); |
154 | 154 | ||
@@ -161,7 +161,7 @@ void ax25_output(ax25_cb *ax25, int paclen, struct sk_buff *skb) | |||
161 | } | 161 | } |
162 | } else { | 162 | } else { |
163 | skb_reserve(skbn, frontlen + 1); | 163 | skb_reserve(skbn, frontlen + 1); |
164 | skbn->nh.raw = skbn->data + (skb->nh.raw - skb->data); | 164 | skbn->nh.raw = skbn->data + skb_network_offset(skb); |
165 | memcpy(skb_put(skbn, len), skb->data, len); | 165 | memcpy(skb_put(skbn, len), skb->data, len); |
166 | p = skb_push(skbn, 1); | 166 | p = skb_push(skbn, 1); |
167 | *p = AX25_P_TEXT; | 167 | *p = AX25_P_TEXT; |
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index 841e3f32cab..c5653c512b4 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
@@ -1125,7 +1125,7 @@ int neigh_compat_output(struct sk_buff *skb) | |||
1125 | { | 1125 | { |
1126 | struct net_device *dev = skb->dev; | 1126 | struct net_device *dev = skb->dev; |
1127 | 1127 | ||
1128 | __skb_pull(skb, skb->nh.raw - skb->data); | 1128 | __skb_pull(skb, skb_network_offset(skb)); |
1129 | 1129 | ||
1130 | if (dev->hard_header && | 1130 | if (dev->hard_header && |
1131 | dev->hard_header(skb, dev, ntohs(skb->protocol), NULL, NULL, | 1131 | dev->hard_header(skb, dev, ntohs(skb->protocol), NULL, NULL, |
@@ -1147,7 +1147,7 @@ int neigh_resolve_output(struct sk_buff *skb) | |||
1147 | if (!dst || !(neigh = dst->neighbour)) | 1147 | if (!dst || !(neigh = dst->neighbour)) |
1148 | goto discard; | 1148 | goto discard; |
1149 | 1149 | ||
1150 | __skb_pull(skb, skb->nh.raw - skb->data); | 1150 | __skb_pull(skb, skb_network_offset(skb)); |
1151 | 1151 | ||
1152 | if (!neigh_event_send(neigh, skb)) { | 1152 | if (!neigh_event_send(neigh, skb)) { |
1153 | int err; | 1153 | int err; |
@@ -1190,7 +1190,7 @@ int neigh_connected_output(struct sk_buff *skb) | |||
1190 | struct neighbour *neigh = dst->neighbour; | 1190 | struct neighbour *neigh = dst->neighbour; |
1191 | struct net_device *dev = neigh->dev; | 1191 | struct net_device *dev = neigh->dev; |
1192 | 1192 | ||
1193 | __skb_pull(skb, skb->nh.raw - skb->data); | 1193 | __skb_pull(skb, skb_network_offset(skb)); |
1194 | 1194 | ||
1195 | read_lock_bh(&neigh->lock); | 1195 | read_lock_bh(&neigh->lock); |
1196 | err = dev->hard_header(skb, dev, ntohs(skb->protocol), | 1196 | err = dev->hard_header(skb, dev, ntohs(skb->protocol), |
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 99cd90c2231..669f5d97c6e 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
@@ -96,7 +96,7 @@ __inline__ void ip_send_check(struct iphdr *iph) | |||
96 | static int ip_dev_loopback_xmit(struct sk_buff *newskb) | 96 | static int ip_dev_loopback_xmit(struct sk_buff *newskb) |
97 | { | 97 | { |
98 | skb_reset_mac_header(newskb); | 98 | skb_reset_mac_header(newskb); |
99 | __skb_pull(newskb, newskb->nh.raw - newskb->data); | 99 | __skb_pull(newskb, skb_network_offset(newskb)); |
100 | newskb->pkt_type = PACKET_LOOPBACK; | 100 | newskb->pkt_type = PACKET_LOOPBACK; |
101 | newskb->ip_summed = CHECKSUM_UNNECESSARY; | 101 | newskb->ip_summed = CHECKSUM_UNNECESSARY; |
102 | BUG_TRAP(newskb->dst); | 102 | BUG_TRAP(newskb->dst); |
@@ -1199,7 +1199,7 @@ int ip_push_pending_frames(struct sock *sk) | |||
1199 | 1199 | ||
1200 | /* move skb->data to ip header from ext header */ | 1200 | /* move skb->data to ip header from ext header */ |
1201 | if (skb->data < skb->nh.raw) | 1201 | if (skb->data < skb->nh.raw) |
1202 | __skb_pull(skb, skb->nh.raw - skb->data); | 1202 | __skb_pull(skb, skb_network_offset(skb)); |
1203 | while ((tmp_skb = __skb_dequeue(&sk->sk_write_queue)) != NULL) { | 1203 | while ((tmp_skb = __skb_dequeue(&sk->sk_write_queue)) != NULL) { |
1204 | __skb_pull(tmp_skb, skb->h.raw - skb->nh.raw); | 1204 | __skb_pull(tmp_skb, skb->h.raw - skb->nh.raw); |
1205 | *tail_skb = tmp_skb; | 1205 | *tail_skb = tmp_skb; |
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c index a91dfbce843..aa4a0a59ffa 100644 --- a/net/ipv6/icmp.c +++ b/net/ipv6/icmp.c | |||
@@ -206,7 +206,7 @@ static __inline__ int opt_unrec(struct sk_buff *skb, __u32 offset) | |||
206 | { | 206 | { |
207 | u8 _optval, *op; | 207 | u8 _optval, *op; |
208 | 208 | ||
209 | offset += skb->nh.raw - skb->data; | 209 | offset += skb_network_offset(skb); |
210 | op = skb_header_pointer(skb, offset, sizeof(_optval), &_optval); | 210 | op = skb_header_pointer(skb, offset, sizeof(_optval), &_optval); |
211 | if (op == NULL) | 211 | if (op == NULL) |
212 | return 1; | 212 | return 1; |
@@ -431,7 +431,7 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info, | |||
431 | tclass = 0; | 431 | tclass = 0; |
432 | 432 | ||
433 | msg.skb = skb; | 433 | msg.skb = skb; |
434 | msg.offset = skb->nh.raw - skb->data; | 434 | msg.offset = skb_network_offset(skb); |
435 | msg.type = type; | 435 | msg.type = type; |
436 | 436 | ||
437 | len = skb->len - msg.offset; | 437 | len = skb->len - msg.offset; |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 8a7b5c76014..47d00210cba 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -89,7 +89,7 @@ static inline int ip6_output_finish(struct sk_buff *skb) | |||
89 | static int ip6_dev_loopback_xmit(struct sk_buff *newskb) | 89 | static int ip6_dev_loopback_xmit(struct sk_buff *newskb) |
90 | { | 90 | { |
91 | skb_reset_mac_header(newskb); | 91 | skb_reset_mac_header(newskb); |
92 | __skb_pull(newskb, newskb->nh.raw - newskb->data); | 92 | __skb_pull(newskb, skb_network_offset(newskb)); |
93 | newskb->pkt_type = PACKET_LOOPBACK; | 93 | newskb->pkt_type = PACKET_LOOPBACK; |
94 | newskb->ip_summed = CHECKSUM_UNNECESSARY; | 94 | newskb->ip_summed = CHECKSUM_UNNECESSARY; |
95 | BUG_TRAP(newskb->dst); | 95 | BUG_TRAP(newskb->dst); |
@@ -1330,7 +1330,7 @@ int ip6_push_pending_frames(struct sock *sk) | |||
1330 | 1330 | ||
1331 | /* move skb->data to ip header from ext header */ | 1331 | /* move skb->data to ip header from ext header */ |
1332 | if (skb->data < skb->nh.raw) | 1332 | if (skb->data < skb->nh.raw) |
1333 | __skb_pull(skb, skb->nh.raw - skb->data); | 1333 | __skb_pull(skb, skb_network_offset(skb)); |
1334 | while ((tmp_skb = __skb_dequeue(&sk->sk_write_queue)) != NULL) { | 1334 | while ((tmp_skb = __skb_dequeue(&sk->sk_write_queue)) != NULL) { |
1335 | __skb_pull(tmp_skb, skb->h.raw - skb->nh.raw); | 1335 | __skb_pull(tmp_skb, skb->h.raw - skb->nh.raw); |
1336 | *tail_skb = tmp_skb; | 1336 | *tail_skb = tmp_skb; |
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index b3a70eb6d42..7694c51f125 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c | |||
@@ -768,7 +768,7 @@ resolve_normal_ct(struct sk_buff *skb, | |||
768 | struct nf_conntrack_tuple_hash *h; | 768 | struct nf_conntrack_tuple_hash *h; |
769 | struct nf_conn *ct; | 769 | struct nf_conn *ct; |
770 | 770 | ||
771 | if (!nf_ct_get_tuple(skb, (unsigned int)(skb->nh.raw - skb->data), | 771 | if (!nf_ct_get_tuple(skb, skb_network_offset(skb), |
772 | dataoff, l3num, protonum, &tuple, l3proto, | 772 | dataoff, l3num, protonum, &tuple, l3proto, |
773 | l4proto)) { | 773 | l4proto)) { |
774 | DEBUGP("resolve_normal_ct: Can't get tuple\n"); | 774 | DEBUGP("resolve_normal_ct: Can't get tuple\n"); |
@@ -960,7 +960,7 @@ void __nf_ct_refresh_acct(struct nf_conn *ct, | |||
960 | if (do_acct) { | 960 | if (do_acct) { |
961 | ct->counters[CTINFO2DIR(ctinfo)].packets++; | 961 | ct->counters[CTINFO2DIR(ctinfo)].packets++; |
962 | ct->counters[CTINFO2DIR(ctinfo)].bytes += | 962 | ct->counters[CTINFO2DIR(ctinfo)].bytes += |
963 | skb->len - (unsigned int)(skb->nh.raw - skb->data); | 963 | skb->len - skb_network_offset(skb); |
964 | 964 | ||
965 | if ((ct->counters[CTINFO2DIR(ctinfo)].packets & 0x80000000) | 965 | if ((ct->counters[CTINFO2DIR(ctinfo)].packets & 0x80000000) |
966 | || (ct->counters[CTINFO2DIR(ctinfo)].bytes & 0x80000000)) | 966 | || (ct->counters[CTINFO2DIR(ctinfo)].bytes & 0x80000000)) |
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 1225e751b3f..a059cc7be67 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -491,7 +491,7 @@ static int packet_rcv(struct sk_buff *skb, struct net_device *dev, struct packet | |||
491 | skb_push(skb, skb->data - skb_mac_header(skb)); | 491 | skb_push(skb, skb->data - skb_mac_header(skb)); |
492 | else if (skb->pkt_type == PACKET_OUTGOING) { | 492 | else if (skb->pkt_type == PACKET_OUTGOING) { |
493 | /* Special case: outgoing packets have ll header at head */ | 493 | /* Special case: outgoing packets have ll header at head */ |
494 | skb_pull(skb, skb->nh.raw - skb->data); | 494 | skb_pull(skb, skb_network_offset(skb)); |
495 | } | 495 | } |
496 | } | 496 | } |
497 | 497 | ||
@@ -595,7 +595,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, struct packe | |||
595 | skb_push(skb, skb->data - skb_mac_header(skb)); | 595 | skb_push(skb, skb->data - skb_mac_header(skb)); |
596 | else if (skb->pkt_type == PACKET_OUTGOING) { | 596 | else if (skb->pkt_type == PACKET_OUTGOING) { |
597 | /* Special case: outgoing packets have ll header at head */ | 597 | /* Special case: outgoing packets have ll header at head */ |
598 | skb_pull(skb, skb->nh.raw - skb->data); | 598 | skb_pull(skb, skb_network_offset(skb)); |
599 | } | 599 | } |
600 | } | 600 | } |
601 | 601 | ||
@@ -613,7 +613,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, struct packe | |||
613 | if (sk->sk_type == SOCK_DGRAM) { | 613 | if (sk->sk_type == SOCK_DGRAM) { |
614 | macoff = netoff = TPACKET_ALIGN(TPACKET_HDRLEN) + 16; | 614 | macoff = netoff = TPACKET_ALIGN(TPACKET_HDRLEN) + 16; |
615 | } else { | 615 | } else { |
616 | unsigned maclen = skb->nh.raw - skb->data; | 616 | unsigned maclen = skb_network_offset(skb); |
617 | netoff = TPACKET_ALIGN(TPACKET_HDRLEN + (maclen < 16 ? 16 : maclen)); | 617 | netoff = TPACKET_ALIGN(TPACKET_HDRLEN + (maclen < 16 ? 16 : maclen)); |
618 | macoff = netoff - maclen; | 618 | macoff = netoff - maclen; |
619 | } | 619 | } |
@@ -1145,7 +1145,7 @@ static int packet_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1145 | aux.tp_len = PACKET_SKB_CB(skb)->origlen; | 1145 | aux.tp_len = PACKET_SKB_CB(skb)->origlen; |
1146 | aux.tp_snaplen = skb->len; | 1146 | aux.tp_snaplen = skb->len; |
1147 | aux.tp_mac = 0; | 1147 | aux.tp_mac = 0; |
1148 | aux.tp_net = skb->nh.raw - skb->data; | 1148 | aux.tp_net = skb_network_offset(skb); |
1149 | 1149 | ||
1150 | put_cmsg(msg, SOL_PACKET, PACKET_AUXDATA, sizeof(aux), &aux); | 1150 | put_cmsg(msg, SOL_PACKET, PACKET_AUXDATA, sizeof(aux), &aux); |
1151 | } | 1151 | } |
diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c index 587123c61af..d24914db786 100644 --- a/net/sched/sch_teql.c +++ b/net/sched/sch_teql.c | |||
@@ -323,7 +323,7 @@ restart: | |||
323 | nores = 1; | 323 | nores = 1; |
324 | break; | 324 | break; |
325 | } | 325 | } |
326 | __skb_pull(skb, skb->nh.raw - skb->data); | 326 | __skb_pull(skb, skb_network_offset(skb)); |
327 | } while ((q = NEXT_SLAVE(q)) != start); | 327 | } while ((q = NEXT_SLAVE(q)) != start); |
328 | 328 | ||
329 | if (nores && skb_res == NULL) { | 329 | if (nores && skb_res == NULL) { |
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index d41e24d6ae4..addb5850105 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -2944,7 +2944,7 @@ static int selinux_parse_skb_ipv4(struct sk_buff *skb, | |||
2944 | int offset, ihlen, ret = -EINVAL; | 2944 | int offset, ihlen, ret = -EINVAL; |
2945 | struct iphdr _iph, *ih; | 2945 | struct iphdr _iph, *ih; |
2946 | 2946 | ||
2947 | offset = skb->nh.raw - skb->data; | 2947 | offset = skb_network_offset(skb); |
2948 | ih = skb_header_pointer(skb, offset, sizeof(_iph), &_iph); | 2948 | ih = skb_header_pointer(skb, offset, sizeof(_iph), &_iph); |
2949 | if (ih == NULL) | 2949 | if (ih == NULL) |
2950 | goto out; | 2950 | goto out; |
@@ -3026,7 +3026,7 @@ static int selinux_parse_skb_ipv6(struct sk_buff *skb, | |||
3026 | int ret = -EINVAL, offset; | 3026 | int ret = -EINVAL, offset; |
3027 | struct ipv6hdr _ipv6h, *ip6; | 3027 | struct ipv6hdr _ipv6h, *ip6; |
3028 | 3028 | ||
3029 | offset = skb->nh.raw - skb->data; | 3029 | offset = skb_network_offset(skb); |
3030 | ip6 = skb_header_pointer(skb, offset, sizeof(_ipv6h), &_ipv6h); | 3030 | ip6 = skb_header_pointer(skb, offset, sizeof(_ipv6h), &_ipv6h); |
3031 | if (ip6 == NULL) | 3031 | if (ip6 == NULL) |
3032 | goto out; | 3032 | goto out; |