]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - net/ipv4/ipmr.c
[NET]: Convert net/{ipv4,ipv6,sched} to netdev_priv
[net-next-2.6.git] / net / ipv4 / ipmr.c
index 9dbf5909f3a6a190fcef1961e3737100a4b12e57..f58ac9854c3f705c91a9e9654b270fc4f4010b40 100644 (file)
 #include <linux/seq_file.h>
 #include <linux/mroute.h>
 #include <linux/init.h>
+#include <linux/if_ether.h>
 #include <net/ip.h>
 #include <net/protocol.h>
 #include <linux/skbuff.h>
+#include <net/route.h>
 #include <net/sock.h>
 #include <net/icmp.h>
 #include <net/udp.h>
@@ -149,7 +151,7 @@ struct net_device *ipmr_new_tunnel(struct vifctl *v)
                if (err == 0 && (dev = __dev_get_by_name(p.name)) != NULL) {
                        dev->flags |= IFF_MULTICAST;
 
-                       in_dev = __in_dev_get(dev);
+                       in_dev = __in_dev_get_rtnl(dev);
                        if (in_dev == NULL && (in_dev = inetdev_init(dev)) == NULL)
                                goto failure;
                        in_dev->cnf.rp_filter = 0;
@@ -176,8 +178,8 @@ static int reg_vif_num = -1;
 static int reg_vif_xmit(struct sk_buff *skb, struct net_device *dev)
 {
        read_lock(&mrt_lock);
-       ((struct net_device_stats*)dev->priv)->tx_bytes += skb->len;
-       ((struct net_device_stats*)dev->priv)->tx_packets++;
+       ((struct net_device_stats*)netdev_priv(dev))->tx_bytes += skb->len;
+       ((struct net_device_stats*)netdev_priv(dev))->tx_packets++;
        ipmr_cache_report(skb, reg_vif_num, IGMPMSG_WHOLEPKT);
        read_unlock(&mrt_lock);
        kfree_skb(skb);
@@ -186,13 +188,13 @@ static int reg_vif_xmit(struct sk_buff *skb, struct net_device *dev)
 
 static struct net_device_stats *reg_vif_get_stats(struct net_device *dev)
 {
-       return (struct net_device_stats*)dev->priv;
+       return (struct net_device_stats*)netdev_priv(dev);
 }
 
 static void reg_vif_setup(struct net_device *dev)
 {
        dev->type               = ARPHRD_PIMREG;
-       dev->mtu                = 1500 - sizeof(struct iphdr) - 8;
+       dev->mtu                = ETH_DATA_LEN - sizeof(struct iphdr) - 8;
        dev->flags              = IFF_NOARP;
        dev->hard_start_xmit    = reg_vif_xmit;
        dev->get_stats          = reg_vif_get_stats;
@@ -278,7 +280,7 @@ static int vif_delete(int vifi)
 
        dev_set_allmulti(dev, -1);
 
-       if ((in_dev = __in_dev_get(dev)) != NULL) {
+       if ((in_dev = __in_dev_get_rtnl(dev)) != NULL) {
                in_dev->cnf.mc_forwarding--;
                ip_rt_multicast_event(in_dev);
        }
@@ -421,7 +423,7 @@ static int vif_add(struct vifctl *vifc, int mrtsock)
                return -EINVAL;
        }
 
-       if ((in_dev = __in_dev_get(dev)) == NULL)
+       if ((in_dev = __in_dev_get_rtnl(dev)) == NULL)
                return -EADDRNOTAVAIL;
        in_dev->cnf.mc_forwarding++;
        dev_set_allmulti(dev, +1);
@@ -1147,8 +1149,8 @@ static void ipmr_queue_xmit(struct sk_buff *skb, struct mfc_cache *c, int vifi)
        if (vif->flags & VIFF_REGISTER) {
                vif->pkt_out++;
                vif->bytes_out+=skb->len;
-               ((struct net_device_stats*)vif->dev->priv)->tx_bytes += skb->len;
-               ((struct net_device_stats*)vif->dev->priv)->tx_packets++;
+               ((struct net_device_stats*)netdev_priv(vif->dev))->tx_bytes += skb->len;
+               ((struct net_device_stats*)netdev_priv(vif->dev))->tx_packets++;
                ipmr_cache_report(skb, vifi, IGMPMSG_WHOLEPKT);
                kfree_skb(skb);
                return;
@@ -1208,8 +1210,8 @@ static void ipmr_queue_xmit(struct sk_buff *skb, struct mfc_cache *c, int vifi)
        if (vif->flags & VIFF_TUNNEL) {
                ip_encap(skb, vif->local, vif->remote);
                /* FIXME: extra output firewall step used to be here. --RR */
-               ((struct ip_tunnel *)vif->dev->priv)->stat.tx_packets++;
-               ((struct ip_tunnel *)vif->dev->priv)->stat.tx_bytes+=skb->len;
+               ((struct ip_tunnel *)netdev_priv(vif->dev))->stat.tx_packets++;
+               ((struct ip_tunnel *)netdev_priv(vif->dev))->stat.tx_bytes+=skb->len;
        }
 
        IPCB(skb)->flags |= IPSKB_FORWARDED;
@@ -1465,8 +1467,8 @@ int pim_rcv_v1(struct sk_buff * skb)
        skb->pkt_type = PACKET_HOST;
        dst_release(skb->dst);
        skb->dst = NULL;
-       ((struct net_device_stats*)reg_dev->priv)->rx_bytes += skb->len;
-       ((struct net_device_stats*)reg_dev->priv)->rx_packets++;
+       ((struct net_device_stats*)netdev_priv(reg_dev))->rx_bytes += skb->len;
+       ((struct net_device_stats*)netdev_priv(reg_dev))->rx_packets++;
        nf_reset(skb);
        netif_rx(skb);
        dev_put(reg_dev);
@@ -1520,8 +1522,8 @@ static int pim_rcv(struct sk_buff * skb)
        skb->ip_summed = 0;
        skb->pkt_type = PACKET_HOST;
        dst_release(skb->dst);
-       ((struct net_device_stats*)reg_dev->priv)->rx_bytes += skb->len;
-       ((struct net_device_stats*)reg_dev->priv)->rx_packets++;
+       ((struct net_device_stats*)netdev_priv(reg_dev))->rx_bytes += skb->len;
+       ((struct net_device_stats*)netdev_priv(reg_dev))->rx_packets++;
        skb->dst = NULL;
        nf_reset(skb);
        netif_rx(skb);