iptunnel: specify protocol outside IP header
authorNicolas Dichtel <nicolas.dichtel@6wind.com>
Mon, 27 May 2013 23:48:15 +0000 (23:48 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sat, 1 Jun 2013 00:19:05 +0000 (17:19 -0700)
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 <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/ip_tunnels.h
net/ipv4/ip_gre.c
net/ipv4/ip_tunnel.c
net/ipv4/ipip.c

index 4b6f0b28f41f097153669aa6194deae952ea58ff..40b4dfce01fc0324e6fda08ac9a6ade1f64e5a09 100644 (file)
@@ -101,7 +101,7 @@ int __net_init ip_tunnel_init_net(struct net *net, int ip_tnl_net_id,
 void __net_exit ip_tunnel_delete_net(struct ip_tunnel_net *itn);
 
 void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
-                   const struct iphdr *tnl_params);
+                   const struct iphdr *tnl_params, const u8 protocol);
 int ip_tunnel_ioctl(struct net_device *dev, struct ip_tunnel_parm *p, int cmd);
 int ip_tunnel_change_mtu(struct net_device *dev, int new_mtu);
 
index 2a83591492dd6f3e8b7470c3e9b897dad7625a49..a982657d05e7ee8c3f396a557c6ddf3b639c72a1 100644 (file)
@@ -429,7 +429,7 @@ static void __gre_xmit(struct sk_buff *skb, struct net_device *dev,
                return;
        }
 
-       ip_tunnel_xmit(skb, dev, tnl_params);
+       ip_tunnel_xmit(skb, dev, tnl_params, tnl_params->protocol);
 }
 
 static netdev_tx_t ipgre_xmit(struct sk_buff *skb,
index e4147ec1665a7af9c9661a12712babdf4bfd29ea..b89095c1518f50d28e58e099fb9011d0d5c260ae 100644 (file)
@@ -487,7 +487,7 @@ drop:
 EXPORT_SYMBOL_GPL(ip_tunnel_rcv);
 
 void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
-                   const struct iphdr *tnl_params)
+                   const struct iphdr *tnl_params, const u8 protocol)
 {
        struct ip_tunnel *tunnel = netdev_priv(dev);
        const struct iphdr *inner_iph;
@@ -670,7 +670,7 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
        iph->version    =       4;
        iph->ihl        =       sizeof(struct iphdr) >> 2;
        iph->frag_off   =       df;
-       iph->protocol   =       tnl_params->protocol;
+       iph->protocol   =       protocol;
        iph->tos        =       ip_tunnel_ecn_encap(tos, inner_iph, skb);
        iph->daddr      =       fl4.daddr;
        iph->saddr      =       fl4.saddr;
index 77bfcce64fe568b3a162a9d36324061553275a5e..9df7ecd393f20246d5fcb0246cdf5c35323eb4be 100644 (file)
@@ -222,7 +222,7 @@ static netdev_tx_t ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
                skb->encapsulation = 1;
        }
 
-       ip_tunnel_xmit(skb, dev, tiph);
+       ip_tunnel_xmit(skb, dev, tiph, tiph->protocol);
        return NETDEV_TX_OK;
 
 tx_error: