xfrm: ipv6: add xfrm6_hdr_offset helper

This moves the ->hdr_offset indirect call to a new helper.

A followup patch can then modify the new function to replace
the indirect call by direct calls to the required hdr_offset helper.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
This commit is contained in:
Florian Westphal 2021-06-11 12:50:10 +02:00 коммит произвёл Steffen Klassert
Родитель 7a7ae1eba2
Коммит 9acf4d3b9e
1 изменённых файлов: 7 добавлений и 2 удалений

Просмотреть файл

@ -77,6 +77,11 @@ static int xfrm4_transport_output(struct xfrm_state *x, struct sk_buff *skb)
return 0; return 0;
} }
static int xfrm6_hdr_offset(struct xfrm_state *x, struct sk_buff *skb, u8 **prevhdr)
{
return x->type->hdr_offset(x, skb, prevhdr);
}
/* Add encapsulation header. /* Add encapsulation header.
* *
* The IP header and mutable extension headers will be moved forward to make * The IP header and mutable extension headers will be moved forward to make
@ -92,7 +97,7 @@ static int xfrm6_transport_output(struct xfrm_state *x, struct sk_buff *skb)
iph = ipv6_hdr(skb); iph = ipv6_hdr(skb);
skb_set_inner_transport_header(skb, skb_transport_offset(skb)); skb_set_inner_transport_header(skb, skb_transport_offset(skb));
hdr_len = x->type->hdr_offset(x, skb, &prevhdr); hdr_len = xfrm6_hdr_offset(x, skb, &prevhdr);
if (hdr_len < 0) if (hdr_len < 0)
return hdr_len; return hdr_len;
skb_set_mac_header(skb, skb_set_mac_header(skb,
@ -122,7 +127,7 @@ static int xfrm6_ro_output(struct xfrm_state *x, struct sk_buff *skb)
iph = ipv6_hdr(skb); iph = ipv6_hdr(skb);
hdr_len = x->type->hdr_offset(x, skb, &prevhdr); hdr_len = xfrm6_hdr_offset(x, skb, &prevhdr);
if (hdr_len < 0) if (hdr_len < 0)
return hdr_len; return hdr_len;
skb_set_mac_header(skb, skb_set_mac_header(skb,