Commit a34cd4f3 authored by Steffen Klassert's avatar Steffen Klassert

vti4: Use the on xfrm_lookup returned dst_entry directly

We need to be protocol family indepenent to support
inter addresss family tunneling with vti. So use a
dst_entry instead of the ipv4 rtable in vti_tunnel_xmit.
Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
parent 9994bb8e
...@@ -128,7 +128,7 @@ static int vti_rcv_cb(struct sk_buff *skb, int err) ...@@ -128,7 +128,7 @@ static int vti_rcv_cb(struct sk_buff *skb, int err)
static netdev_tx_t vti_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) static netdev_tx_t vti_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
{ {
struct ip_tunnel *tunnel = netdev_priv(dev); struct ip_tunnel *tunnel = netdev_priv(dev);
struct rtable *rt; /* Route to the other host */ struct dst_entry *dst = skb_dst(skb);
struct net_device *tdev; /* Device to other host */ struct net_device *tdev; /* Device to other host */
struct flowi fl; struct flowi fl;
int err; int err;
...@@ -140,14 +140,14 @@ static netdev_tx_t vti_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -140,14 +140,14 @@ static netdev_tx_t vti_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
skb->mark = be32_to_cpu(tunnel->parms.o_key); skb->mark = be32_to_cpu(tunnel->parms.o_key);
xfrm_decode_session(skb, &fl, AF_INET); xfrm_decode_session(skb, &fl, AF_INET);
if (!skb_dst(skb)) { if (!dst) {
dev->stats.tx_carrier_errors++; dev->stats.tx_carrier_errors++;
goto tx_error_icmp; goto tx_error_icmp;
} }
dst_hold(skb_dst(skb)); dst_hold(dst);
rt = (struct rtable *)xfrm_lookup(tunnel->net, skb_dst(skb), &fl, NULL, 0); dst = xfrm_lookup(tunnel->net, dst, &fl, NULL, 0);
if (IS_ERR(rt)) { if (IS_ERR(dst)) {
dev->stats.tx_carrier_errors++; dev->stats.tx_carrier_errors++;
goto tx_error_icmp; goto tx_error_icmp;
} }
...@@ -155,16 +155,16 @@ static netdev_tx_t vti_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -155,16 +155,16 @@ static netdev_tx_t vti_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
/* if there is no transform then this tunnel is not functional. /* if there is no transform then this tunnel is not functional.
* Or if the xfrm is not mode tunnel. * Or if the xfrm is not mode tunnel.
*/ */
if (!rt->dst.xfrm || if (!dst->xfrm ||
rt->dst.xfrm->props.mode != XFRM_MODE_TUNNEL) { dst->xfrm->props.mode != XFRM_MODE_TUNNEL) {
dev->stats.tx_carrier_errors++; dev->stats.tx_carrier_errors++;
ip_rt_put(rt); dst_release(dst);
goto tx_error_icmp; goto tx_error_icmp;
} }
tdev = rt->dst.dev; tdev = dst->dev;
if (tdev == dev) { if (tdev == dev) {
ip_rt_put(rt); dst_release(dst);
dev->stats.collisions++; dev->stats.collisions++;
goto tx_error; goto tx_error;
} }
...@@ -180,7 +180,7 @@ static netdev_tx_t vti_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -180,7 +180,7 @@ static netdev_tx_t vti_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
memset(IPCB(skb), 0, sizeof(*IPCB(skb))); memset(IPCB(skb), 0, sizeof(*IPCB(skb)));
skb_scrub_packet(skb, !net_eq(tunnel->net, dev_net(dev))); skb_scrub_packet(skb, !net_eq(tunnel->net, dev_net(dev)));
skb_dst_set(skb, &rt->dst); skb_dst_set(skb, dst);
skb->dev = skb_dst(skb)->dev; skb->dev = skb_dst(skb)->dev;
err = dst_output(skb); err = dst_output(skb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment