diff mbox

[net-next,4/9] sit: TX path for sit/UDP Generic UDP Encapsulation

Message ID alpine.DEB.2.02.1407162058410.2721@tomh.mtv.corp.google.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Tom Herbert July 17, 2014, 4:14 a.m. UTC
Signed-off-by: Tom Herbert <therbert@google.com>
---
 net/ipv6/sit.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 2e9ba03..4a7adb0 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -822,6 +822,7 @@  static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb,
 	int addr_type;
 	u8 ttl;
 	int err;
+	u8 protocol = IPPROTO_IPV6;
 
 	if (skb->protocol != htons(ETH_P_IPV6))
 		goto tx_error;
@@ -905,6 +906,11 @@  static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb,
 	}
 	tdev = rt->dst.dev;
 
+	if (ip_tunnel_encap(skb, tunnel, &protocol, &fl4) < 0) {
+		ip_rt_put(rt);
+		goto tx_error;
+	}
+
 	if (tdev == dev) {
 		ip_rt_put(rt);
 		dev->stats.collisions++;
@@ -976,7 +982,7 @@  static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb,
 	}
 
 	err = iptunnel_xmit(skb->sk, rt, skb, fl4.saddr, fl4.daddr,
-			    IPPROTO_IPV6, tos, ttl, df,
+			    protocol, tos, ttl, df,
 			    !net_eq(tunnel->net, dev_net(dev)));
 	iptunnel_xmit_stats(err, &dev->stats, dev->tstats);
 	return NETDEV_TX_OK;
@@ -1135,6 +1141,12 @@  ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
 	struct ip_tunnel_6rd ip6rd;
 #endif
 
+	/* Try generic tunnel ioctls first */
+	err = __ip_tunnel_gen_ioctl(dev, sitn->fb_tunnel_dev, ifr, cmd);
+	if (err != -ENOIOCTLCMD)
+		return err;
+
+	err = 0;
 	switch (cmd) {
 	case SIOCGETTUNNEL:
 #ifdef CONFIG_IPV6_SIT_6RD