Skip to content

Commit bf3d6a8

Browse files
NicolasDichteldavem330
authored andcommitted
iptunnel: specify protocol outside IP header
Before this patch, ip_tunnel_xmit() was using the field protocol from the IP header passed into argument. There is no functional change, this patch prepares the support of IPv4 over IPv4 for module sit. Signed-off-by: Nicolas Dichtel <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 35d0461 commit bf3d6a8

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

include/net/ip_tunnels.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ int __net_init ip_tunnel_init_net(struct net *net, int ip_tnl_net_id,
101101
void __net_exit ip_tunnel_delete_net(struct ip_tunnel_net *itn);
102102

103103
void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
104-
const struct iphdr *tnl_params);
104+
const struct iphdr *tnl_params, const u8 protocol);
105105
int ip_tunnel_ioctl(struct net_device *dev, struct ip_tunnel_parm *p, int cmd);
106106
int ip_tunnel_change_mtu(struct net_device *dev, int new_mtu);
107107

net/ipv4/ip_gre.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ static void __gre_xmit(struct sk_buff *skb, struct net_device *dev,
429429
return;
430430
}
431431

432-
ip_tunnel_xmit(skb, dev, tnl_params);
432+
ip_tunnel_xmit(skb, dev, tnl_params, tnl_params->protocol);
433433
}
434434

435435
static netdev_tx_t ipgre_xmit(struct sk_buff *skb,

net/ipv4/ip_tunnel.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ int ip_tunnel_rcv(struct ip_tunnel *tunnel, struct sk_buff *skb,
487487
EXPORT_SYMBOL_GPL(ip_tunnel_rcv);
488488

489489
void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
490-
const struct iphdr *tnl_params)
490+
const struct iphdr *tnl_params, const u8 protocol)
491491
{
492492
struct ip_tunnel *tunnel = netdev_priv(dev);
493493
const struct iphdr *inner_iph;
@@ -670,7 +670,7 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
670670
iph->version = 4;
671671
iph->ihl = sizeof(struct iphdr) >> 2;
672672
iph->frag_off = df;
673-
iph->protocol = tnl_params->protocol;
673+
iph->protocol = protocol;
674674
iph->tos = ip_tunnel_ecn_encap(tos, inner_iph, skb);
675675
iph->daddr = fl4.daddr;
676676
iph->saddr = fl4.saddr;

net/ipv4/ipip.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ static netdev_tx_t ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
222222
skb->encapsulation = 1;
223223
}
224224

225-
ip_tunnel_xmit(skb, dev, tiph);
225+
ip_tunnel_xmit(skb, dev, tiph, tiph->protocol);
226226
return NETDEV_TX_OK;
227227

228228
tx_error:

0 commit comments

Comments
 (0)