]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/ipv4/ip_gre.c
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/linville/wireles...
[linux-2.6-omap-h63xx.git] / net / ipv4 / ip_gre.c
index 906cb1ada4c35db7ef7281c7dd69907854b68169..f9ee84420cb33005798f47c87e98bf01d5bc7216 100644 (file)
@@ -266,20 +266,24 @@ static struct ip_tunnel * ipgre_tunnel_locate(struct ip_tunnel_parm *parms, int
        if (!dev)
          return NULL;
 
+       if (strchr(name, '%')) {
+               if (dev_alloc_name(dev, name) < 0)
+                       goto failed_free;
+       }
+
        dev->init = ipgre_tunnel_init;
        nt = netdev_priv(dev);
        nt->parms = *parms;
 
-       if (register_netdevice(dev) < 0) {
-               free_netdev(dev);
-               goto failed;
-       }
+       if (register_netdevice(dev) < 0)
+               goto failed_free;
 
        dev_hold(dev);
        ipgre_tunnel_link(nt);
        return nt;
 
-failed:
+failed_free:
+       free_netdev(dev);
        return NULL;
 }
 
@@ -615,7 +619,7 @@ static int ipgre_rcv(struct sk_buff *skb)
 #ifdef CONFIG_NET_IPGRE_BROADCAST
                if (ipv4_is_multicast(iph->daddr)) {
                        /* Looped back packet, drop it! */
-                       if (((struct rtable*)skb->dst)->fl.iif == 0)
+                       if (skb->rtable->fl.iif == 0)
                                goto drop;
                        tunnel->stat.multicast++;
                        skb->pkt_type = PACKET_BROADCAST;
@@ -695,7 +699,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
                }
 
                if (skb->protocol == htons(ETH_P_IP)) {
-                       rt = (struct rtable*)skb->dst;
+                       rt = skb->rtable;
                        if ((dst = rt->rt_gateway) == 0)
                                goto tx_error_icmp;
                }