aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/ip_gre.c33
-rw-r--r--net/ipv4/ipip.c18
-rw-r--r--net/ipv4/ipmr.c22
3 files changed, 35 insertions, 38 deletions
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index de16e944777f..1e93eafa7af1 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -188,7 +188,7 @@ static struct ip_tunnel * ipgre_tunnel_lookup(u32 remote, u32 local, u32 key)
188 } 188 }
189 189
190 if (ipgre_fb_tunnel_dev->flags&IFF_UP) 190 if (ipgre_fb_tunnel_dev->flags&IFF_UP)
191 return ipgre_fb_tunnel_dev->priv; 191 return netdev_priv(ipgre_fb_tunnel_dev);
192 return NULL; 192 return NULL;
193} 193}
194 194
@@ -278,7 +278,7 @@ static struct ip_tunnel * ipgre_tunnel_locate(struct ip_tunnel_parm *parms, int
278 return NULL; 278 return NULL;
279 279
280 dev->init = ipgre_tunnel_init; 280 dev->init = ipgre_tunnel_init;
281 nt = dev->priv; 281 nt = netdev_priv(dev);
282 nt->parms = *parms; 282 nt->parms = *parms;
283 283
284 if (register_netdevice(dev) < 0) { 284 if (register_netdevice(dev) < 0) {
@@ -286,9 +286,6 @@ static struct ip_tunnel * ipgre_tunnel_locate(struct ip_tunnel_parm *parms, int
286 goto failed; 286 goto failed;
287 } 287 }
288 288
289 nt = dev->priv;
290 nt->parms = *parms;
291
292 dev_hold(dev); 289 dev_hold(dev);
293 ipgre_tunnel_link(nt); 290 ipgre_tunnel_link(nt);
294 return nt; 291 return nt;
@@ -299,7 +296,7 @@ failed:
299 296
300static void ipgre_tunnel_uninit(struct net_device *dev) 297static void ipgre_tunnel_uninit(struct net_device *dev)
301{ 298{
302 ipgre_tunnel_unlink((struct ip_tunnel*)dev->priv); 299 ipgre_tunnel_unlink(netdev_priv(dev));
303 dev_put(dev); 300 dev_put(dev);
304} 301}
305 302
@@ -518,7 +515,7 @@ out:
518 skb2->dst->ops->update_pmtu(skb2->dst, rel_info); 515 skb2->dst->ops->update_pmtu(skb2->dst, rel_info);
519 rel_info = htonl(rel_info); 516 rel_info = htonl(rel_info);
520 } else if (type == ICMP_TIME_EXCEEDED) { 517 } else if (type == ICMP_TIME_EXCEEDED) {
521 struct ip_tunnel *t = (struct ip_tunnel*)skb2->dev->priv; 518 struct ip_tunnel *t = netdev_priv(skb2->dev);
522 if (t->parms.iph.ttl) { 519 if (t->parms.iph.ttl) {
523 rel_type = ICMP_DEST_UNREACH; 520 rel_type = ICMP_DEST_UNREACH;
524 rel_code = ICMP_HOST_UNREACH; 521 rel_code = ICMP_HOST_UNREACH;
@@ -669,7 +666,7 @@ drop_nolock:
669 666
670static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) 667static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
671{ 668{
672 struct ip_tunnel *tunnel = (struct ip_tunnel*)dev->priv; 669 struct ip_tunnel *tunnel = netdev_priv(dev);
673 struct net_device_stats *stats = &tunnel->stat; 670 struct net_device_stats *stats = &tunnel->stat;
674 struct iphdr *old_iph = skb->nh.iph; 671 struct iphdr *old_iph = skb->nh.iph;
675 struct iphdr *tiph; 672 struct iphdr *tiph;
@@ -915,7 +912,7 @@ ipgre_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
915 t = ipgre_tunnel_locate(&p, 0); 912 t = ipgre_tunnel_locate(&p, 0);
916 } 913 }
917 if (t == NULL) 914 if (t == NULL)
918 t = (struct ip_tunnel*)dev->priv; 915 t = netdev_priv(dev);
919 memcpy(&p, &t->parms, sizeof(p)); 916 memcpy(&p, &t->parms, sizeof(p));
920 if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof(p))) 917 if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof(p)))
921 err = -EFAULT; 918 err = -EFAULT;
@@ -955,7 +952,7 @@ ipgre_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
955 } else { 952 } else {
956 unsigned nflags=0; 953 unsigned nflags=0;
957 954
958 t = (struct ip_tunnel*)dev->priv; 955 t = netdev_priv(dev);
959 956
960 if (MULTICAST(p.iph.daddr)) 957 if (MULTICAST(p.iph.daddr))
961 nflags = IFF_BROADCAST; 958 nflags = IFF_BROADCAST;
@@ -1004,7 +1001,7 @@ ipgre_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
1004 if ((t = ipgre_tunnel_locate(&p, 0)) == NULL) 1001 if ((t = ipgre_tunnel_locate(&p, 0)) == NULL)
1005 goto done; 1002 goto done;
1006 err = -EPERM; 1003 err = -EPERM;
1007 if (t == ipgre_fb_tunnel_dev->priv) 1004 if (t == netdev_priv(ipgre_fb_tunnel_dev))
1008 goto done; 1005 goto done;
1009 dev = t->dev; 1006 dev = t->dev;
1010 } 1007 }
@@ -1021,12 +1018,12 @@ done:
1021 1018
1022static struct net_device_stats *ipgre_tunnel_get_stats(struct net_device *dev) 1019static struct net_device_stats *ipgre_tunnel_get_stats(struct net_device *dev)
1023{ 1020{
1024 return &(((struct ip_tunnel*)dev->priv)->stat); 1021 return &(((struct ip_tunnel*)netdev_priv(dev))->stat);
1025} 1022}
1026 1023
1027static int ipgre_tunnel_change_mtu(struct net_device *dev, int new_mtu) 1024static int ipgre_tunnel_change_mtu(struct net_device *dev, int new_mtu)
1028{ 1025{
1029 struct ip_tunnel *tunnel = (struct ip_tunnel*)dev->priv; 1026 struct ip_tunnel *tunnel = netdev_priv(dev);
1030 if (new_mtu < 68 || new_mtu > 0xFFF8 - tunnel->hlen) 1027 if (new_mtu < 68 || new_mtu > 0xFFF8 - tunnel->hlen)
1031 return -EINVAL; 1028 return -EINVAL;
1032 dev->mtu = new_mtu; 1029 dev->mtu = new_mtu;
@@ -1066,7 +1063,7 @@ static int ipgre_tunnel_change_mtu(struct net_device *dev, int new_mtu)
1066static int ipgre_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, 1063static int ipgre_header(struct sk_buff *skb, struct net_device *dev, unsigned short type,
1067 void *daddr, void *saddr, unsigned len) 1064 void *daddr, void *saddr, unsigned len)
1068{ 1065{
1069 struct ip_tunnel *t = (struct ip_tunnel*)dev->priv; 1066 struct ip_tunnel *t = netdev_priv(dev);
1070 struct iphdr *iph = (struct iphdr *)skb_push(skb, t->hlen); 1067 struct iphdr *iph = (struct iphdr *)skb_push(skb, t->hlen);
1071 u16 *p = (u16*)(iph+1); 1068 u16 *p = (u16*)(iph+1);
1072 1069
@@ -1093,7 +1090,7 @@ static int ipgre_header(struct sk_buff *skb, struct net_device *dev, unsigned sh
1093 1090
1094static int ipgre_open(struct net_device *dev) 1091static int ipgre_open(struct net_device *dev)
1095{ 1092{
1096 struct ip_tunnel *t = (struct ip_tunnel*)dev->priv; 1093 struct ip_tunnel *t = netdev_priv(dev);
1097 1094
1098 if (MULTICAST(t->parms.iph.daddr)) { 1095 if (MULTICAST(t->parms.iph.daddr)) {
1099 struct flowi fl = { .oif = t->parms.link, 1096 struct flowi fl = { .oif = t->parms.link,
@@ -1117,7 +1114,7 @@ static int ipgre_open(struct net_device *dev)
1117 1114
1118static int ipgre_close(struct net_device *dev) 1115static int ipgre_close(struct net_device *dev)
1119{ 1116{
1120 struct ip_tunnel *t = (struct ip_tunnel*)dev->priv; 1117 struct ip_tunnel *t = netdev_priv(dev);
1121 if (MULTICAST(t->parms.iph.daddr) && t->mlink) { 1118 if (MULTICAST(t->parms.iph.daddr) && t->mlink) {
1122 struct in_device *in_dev = inetdev_by_index(t->mlink); 1119 struct in_device *in_dev = inetdev_by_index(t->mlink);
1123 if (in_dev) { 1120 if (in_dev) {
@@ -1157,7 +1154,7 @@ static int ipgre_tunnel_init(struct net_device *dev)
1157 int mtu = ETH_DATA_LEN; 1154 int mtu = ETH_DATA_LEN;
1158 int addend = sizeof(struct iphdr) + 4; 1155 int addend = sizeof(struct iphdr) + 4;
1159 1156
1160 tunnel = (struct ip_tunnel*)dev->priv; 1157 tunnel = netdev_priv(dev);
1161 iph = &tunnel->parms.iph; 1158 iph = &tunnel->parms.iph;
1162 1159
1163 tunnel->dev = dev; 1160 tunnel->dev = dev;
@@ -1221,7 +1218,7 @@ static int ipgre_tunnel_init(struct net_device *dev)
1221 1218
1222static int __init ipgre_fb_tunnel_init(struct net_device *dev) 1219static int __init ipgre_fb_tunnel_init(struct net_device *dev)
1223{ 1220{
1224 struct ip_tunnel *tunnel = (struct ip_tunnel*)dev->priv; 1221 struct ip_tunnel *tunnel = netdev_priv(dev);
1225 struct iphdr *iph = &tunnel->parms.iph; 1222 struct iphdr *iph = &tunnel->parms.iph;
1226 1223
1227 tunnel->dev = dev; 1224 tunnel->dev = dev;
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index bbd85f5ec985..bc5ca23b2646 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -244,7 +244,7 @@ static struct ip_tunnel * ipip_tunnel_locate(struct ip_tunnel_parm *parms, int c
244 if (dev == NULL) 244 if (dev == NULL)
245 return NULL; 245 return NULL;
246 246
247 nt = dev->priv; 247 nt = netdev_priv(dev);
248 SET_MODULE_OWNER(dev); 248 SET_MODULE_OWNER(dev);
249 dev->init = ipip_tunnel_init; 249 dev->init = ipip_tunnel_init;
250 nt->parms = *parms; 250 nt->parms = *parms;
@@ -269,7 +269,7 @@ static void ipip_tunnel_uninit(struct net_device *dev)
269 tunnels_wc[0] = NULL; 269 tunnels_wc[0] = NULL;
270 write_unlock_bh(&ipip_lock); 270 write_unlock_bh(&ipip_lock);
271 } else 271 } else
272 ipip_tunnel_unlink((struct ip_tunnel*)dev->priv); 272 ipip_tunnel_unlink(netdev_priv(dev));
273 dev_put(dev); 273 dev_put(dev);
274} 274}
275 275
@@ -443,7 +443,7 @@ out:
443 skb2->dst->ops->update_pmtu(skb2->dst, rel_info); 443 skb2->dst->ops->update_pmtu(skb2->dst, rel_info);
444 rel_info = htonl(rel_info); 444 rel_info = htonl(rel_info);
445 } else if (type == ICMP_TIME_EXCEEDED) { 445 } else if (type == ICMP_TIME_EXCEEDED) {
446 struct ip_tunnel *t = (struct ip_tunnel*)skb2->dev->priv; 446 struct ip_tunnel *t = netdev_priv(skb2->dev);
447 if (t->parms.iph.ttl) { 447 if (t->parms.iph.ttl) {
448 rel_type = ICMP_DEST_UNREACH; 448 rel_type = ICMP_DEST_UNREACH;
449 rel_code = ICMP_HOST_UNREACH; 449 rel_code = ICMP_HOST_UNREACH;
@@ -514,7 +514,7 @@ out:
514 514
515static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) 515static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
516{ 516{
517 struct ip_tunnel *tunnel = (struct ip_tunnel*)dev->priv; 517 struct ip_tunnel *tunnel = netdev_priv(dev);
518 struct net_device_stats *stats = &tunnel->stat; 518 struct net_device_stats *stats = &tunnel->stat;
519 struct iphdr *tiph = &tunnel->parms.iph; 519 struct iphdr *tiph = &tunnel->parms.iph;
520 u8 tos = tunnel->parms.iph.tos; 520 u8 tos = tunnel->parms.iph.tos;
@@ -674,7 +674,7 @@ ipip_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
674 t = ipip_tunnel_locate(&p, 0); 674 t = ipip_tunnel_locate(&p, 0);
675 } 675 }
676 if (t == NULL) 676 if (t == NULL)
677 t = (struct ip_tunnel*)dev->priv; 677 t = netdev_priv(dev);
678 memcpy(&p, &t->parms, sizeof(p)); 678 memcpy(&p, &t->parms, sizeof(p));
679 if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof(p))) 679 if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof(p)))
680 err = -EFAULT; 680 err = -EFAULT;
@@ -711,7 +711,7 @@ ipip_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
711 err = -EINVAL; 711 err = -EINVAL;
712 break; 712 break;
713 } 713 }
714 t = (struct ip_tunnel*)dev->priv; 714 t = netdev_priv(dev);
715 ipip_tunnel_unlink(t); 715 ipip_tunnel_unlink(t);
716 t->parms.iph.saddr = p.iph.saddr; 716 t->parms.iph.saddr = p.iph.saddr;
717 t->parms.iph.daddr = p.iph.daddr; 717 t->parms.iph.daddr = p.iph.daddr;
@@ -765,7 +765,7 @@ done:
765 765
766static struct net_device_stats *ipip_tunnel_get_stats(struct net_device *dev) 766static struct net_device_stats *ipip_tunnel_get_stats(struct net_device *dev)
767{ 767{
768 return &(((struct ip_tunnel*)dev->priv)->stat); 768 return &(((struct ip_tunnel*)netdev_priv(dev))->stat);
769} 769}
770 770
771static int ipip_tunnel_change_mtu(struct net_device *dev, int new_mtu) 771static int ipip_tunnel_change_mtu(struct net_device *dev, int new_mtu)
@@ -800,7 +800,7 @@ static int ipip_tunnel_init(struct net_device *dev)
800 struct ip_tunnel *tunnel; 800 struct ip_tunnel *tunnel;
801 struct iphdr *iph; 801 struct iphdr *iph;
802 802
803 tunnel = (struct ip_tunnel*)dev->priv; 803 tunnel = netdev_priv(dev);
804 iph = &tunnel->parms.iph; 804 iph = &tunnel->parms.iph;
805 805
806 tunnel->dev = dev; 806 tunnel->dev = dev;
@@ -838,7 +838,7 @@ static int ipip_tunnel_init(struct net_device *dev)
838 838
839static int __init ipip_fb_tunnel_init(struct net_device *dev) 839static int __init ipip_fb_tunnel_init(struct net_device *dev)
840{ 840{
841 struct ip_tunnel *tunnel = dev->priv; 841 struct ip_tunnel *tunnel = netdev_priv(dev);
842 struct iphdr *iph = &tunnel->parms.iph; 842 struct iphdr *iph = &tunnel->parms.iph;
843 843
844 tunnel->dev = dev; 844 tunnel->dev = dev;
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 9a5c0ce7ff35..f58ac9854c3f 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -178,8 +178,8 @@ static int reg_vif_num = -1;
178static int reg_vif_xmit(struct sk_buff *skb, struct net_device *dev) 178static int reg_vif_xmit(struct sk_buff *skb, struct net_device *dev)
179{ 179{
180 read_lock(&mrt_lock); 180 read_lock(&mrt_lock);
181 ((struct net_device_stats*)dev->priv)->tx_bytes += skb->len; 181 ((struct net_device_stats*)netdev_priv(dev))->tx_bytes += skb->len;
182 ((struct net_device_stats*)dev->priv)->tx_packets++; 182 ((struct net_device_stats*)netdev_priv(dev))->tx_packets++;
183 ipmr_cache_report(skb, reg_vif_num, IGMPMSG_WHOLEPKT); 183 ipmr_cache_report(skb, reg_vif_num, IGMPMSG_WHOLEPKT);
184 read_unlock(&mrt_lock); 184 read_unlock(&mrt_lock);
185 kfree_skb(skb); 185 kfree_skb(skb);
@@ -188,7 +188,7 @@ static int reg_vif_xmit(struct sk_buff *skb, struct net_device *dev)
188 188
189static struct net_device_stats *reg_vif_get_stats(struct net_device *dev) 189static struct net_device_stats *reg_vif_get_stats(struct net_device *dev)
190{ 190{
191 return (struct net_device_stats*)dev->priv; 191 return (struct net_device_stats*)netdev_priv(dev);
192} 192}
193 193
194static void reg_vif_setup(struct net_device *dev) 194static void reg_vif_setup(struct net_device *dev)
@@ -1149,8 +1149,8 @@ static void ipmr_queue_xmit(struct sk_buff *skb, struct mfc_cache *c, int vifi)
1149 if (vif->flags & VIFF_REGISTER) { 1149 if (vif->flags & VIFF_REGISTER) {
1150 vif->pkt_out++; 1150 vif->pkt_out++;
1151 vif->bytes_out+=skb->len; 1151 vif->bytes_out+=skb->len;
1152 ((struct net_device_stats*)vif->dev->priv)->tx_bytes += skb->len; 1152 ((struct net_device_stats*)netdev_priv(vif->dev))->tx_bytes += skb->len;
1153 ((struct net_device_stats*)vif->dev->priv)->tx_packets++; 1153 ((struct net_device_stats*)netdev_priv(vif->dev))->tx_packets++;
1154 ipmr_cache_report(skb, vifi, IGMPMSG_WHOLEPKT); 1154 ipmr_cache_report(skb, vifi, IGMPMSG_WHOLEPKT);
1155 kfree_skb(skb); 1155 kfree_skb(skb);
1156 return; 1156 return;
@@ -1210,8 +1210,8 @@ static void ipmr_queue_xmit(struct sk_buff *skb, struct mfc_cache *c, int vifi)
1210 if (vif->flags & VIFF_TUNNEL) { 1210 if (vif->flags & VIFF_TUNNEL) {
1211 ip_encap(skb, vif->local, vif->remote); 1211 ip_encap(skb, vif->local, vif->remote);
1212 /* FIXME: extra output firewall step used to be here. --RR */ 1212 /* FIXME: extra output firewall step used to be here. --RR */
1213 ((struct ip_tunnel *)vif->dev->priv)->stat.tx_packets++; 1213 ((struct ip_tunnel *)netdev_priv(vif->dev))->stat.tx_packets++;
1214 ((struct ip_tunnel *)vif->dev->priv)->stat.tx_bytes+=skb->len; 1214 ((struct ip_tunnel *)netdev_priv(vif->dev))->stat.tx_bytes+=skb->len;
1215 } 1215 }
1216 1216
1217 IPCB(skb)->flags |= IPSKB_FORWARDED; 1217 IPCB(skb)->flags |= IPSKB_FORWARDED;
@@ -1467,8 +1467,8 @@ int pim_rcv_v1(struct sk_buff * skb)
1467 skb->pkt_type = PACKET_HOST; 1467 skb->pkt_type = PACKET_HOST;
1468 dst_release(skb->dst); 1468 dst_release(skb->dst);
1469 skb->dst = NULL; 1469 skb->dst = NULL;
1470 ((struct net_device_stats*)reg_dev->priv)->rx_bytes += skb->len; 1470 ((struct net_device_stats*)netdev_priv(reg_dev))->rx_bytes += skb->len;
1471 ((struct net_device_stats*)reg_dev->priv)->rx_packets++; 1471 ((struct net_device_stats*)netdev_priv(reg_dev))->rx_packets++;
1472 nf_reset(skb); 1472 nf_reset(skb);
1473 netif_rx(skb); 1473 netif_rx(skb);
1474 dev_put(reg_dev); 1474 dev_put(reg_dev);
@@ -1522,8 +1522,8 @@ static int pim_rcv(struct sk_buff * skb)
1522 skb->ip_summed = 0; 1522 skb->ip_summed = 0;
1523 skb->pkt_type = PACKET_HOST; 1523 skb->pkt_type = PACKET_HOST;
1524 dst_release(skb->dst); 1524 dst_release(skb->dst);
1525 ((struct net_device_stats*)reg_dev->priv)->rx_bytes += skb->len; 1525 ((struct net_device_stats*)netdev_priv(reg_dev))->rx_bytes += skb->len;
1526 ((struct net_device_stats*)reg_dev->priv)->rx_packets++; 1526 ((struct net_device_stats*)netdev_priv(reg_dev))->rx_packets++;
1527 skb->dst = NULL; 1527 skb->dst = NULL;
1528 nf_reset(skb); 1528 nf_reset(skb);
1529 netif_rx(skb); 1529 netif_rx(skb);