Skip to content

Commit a6d5bbf

Browse files
Jiri Bencdavem330
authored andcommitted
ip_tunnel: implement __iptunnel_pull_header
Allow calling of iptunnel_pull_header without special casing ETH_P_TEB inner protocol. Signed-off-by: Jiri Benc <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 47e5d1b commit a6d5bbf

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

include/net/ip_tunnels.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,15 @@ static inline u8 ip_tunnel_ecn_encap(u8 tos, const struct iphdr *iph,
295295
return INET_ECN_encapsulate(tos, inner);
296296
}
297297

298-
int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto,
299-
bool xnet);
298+
int __iptunnel_pull_header(struct sk_buff *skb, int hdr_len,
299+
__be16 inner_proto, bool raw_proto, bool xnet);
300+
301+
static inline int iptunnel_pull_header(struct sk_buff *skb, int hdr_len,
302+
__be16 inner_proto, bool xnet)
303+
{
304+
return __iptunnel_pull_header(skb, hdr_len, inner_proto, false, xnet);
305+
}
306+
300307
void iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb,
301308
__be32 src, __be32 dst, u8 proto,
302309
u8 tos, u8 ttl, __be16 df, bool xnet);

net/ipv4/ip_tunnel_core.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,15 @@ void iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb,
8686
}
8787
EXPORT_SYMBOL_GPL(iptunnel_xmit);
8888

89-
int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto,
90-
bool xnet)
89+
int __iptunnel_pull_header(struct sk_buff *skb, int hdr_len,
90+
__be16 inner_proto, bool raw_proto, bool xnet)
9191
{
9292
if (unlikely(!pskb_may_pull(skb, hdr_len)))
9393
return -ENOMEM;
9494

9595
skb_pull_rcsum(skb, hdr_len);
9696

97-
if (inner_proto == htons(ETH_P_TEB)) {
97+
if (!raw_proto && inner_proto == htons(ETH_P_TEB)) {
9898
struct ethhdr *eh;
9999

100100
if (unlikely(!pskb_may_pull(skb, ETH_HLEN)))
@@ -117,7 +117,7 @@ int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto,
117117

118118
return iptunnel_pull_offloads(skb);
119119
}
120-
EXPORT_SYMBOL_GPL(iptunnel_pull_header);
120+
EXPORT_SYMBOL_GPL(__iptunnel_pull_header);
121121

122122
struct metadata_dst *iptunnel_metadata_reply(struct metadata_dst *md,
123123
gfp_t flags)

0 commit comments

Comments
 (0)