[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>
This commit is contained in:

committed by
David S. Miller

parent
e7dd65dafd
commit
bbe735e424
@@ -2944,7 +2944,7 @@ static int selinux_parse_skb_ipv4(struct sk_buff *skb,
|
||||
int offset, ihlen, ret = -EINVAL;
|
||||
struct iphdr _iph, *ih;
|
||||
|
||||
offset = skb->nh.raw - skb->data;
|
||||
offset = skb_network_offset(skb);
|
||||
ih = skb_header_pointer(skb, offset, sizeof(_iph), &_iph);
|
||||
if (ih == NULL)
|
||||
goto out;
|
||||
@@ -3026,7 +3026,7 @@ static int selinux_parse_skb_ipv6(struct sk_buff *skb,
|
||||
int ret = -EINVAL, offset;
|
||||
struct ipv6hdr _ipv6h, *ip6;
|
||||
|
||||
offset = skb->nh.raw - skb->data;
|
||||
offset = skb_network_offset(skb);
|
||||
ip6 = skb_header_pointer(skb, offset, sizeof(_ipv6h), &_ipv6h);
|
||||
if (ip6 == NULL)
|
||||
goto out;
|
||||
|
Reference in New Issue
Block a user