aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2006-09-28 21:00:55 -0400
committerDavid S. Miller <davem@davemloft.net>2006-09-28 21:00:55 -0400
commita144ea4b7a13087081ab5402fa9ad0bcfd249e67 (patch)
treea0452a546c231d85a89e8920c26e5dec4595ba54
parent6d85c10abe840e98cbac673202fe7cc9ada2180c (diff)
[IPV4]: annotate struct in_ifaddr
ifa_local, ifa_address, ifa_mask, ifa_broadcast and ifa_anycast are net-endian. Annotated them and variables that are inferred to be net-endian. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--arch/ia64/hp/sim/simeth.c4
-rw-r--r--arch/um/drivers/net_kern.c2
-rw-r--r--arch/xtensa/platform-iss/network.c2
-rw-r--r--drivers/isdn/i4l/isdn_net.c4
-rw-r--r--drivers/net/bonding/bond_main.c2
-rw-r--r--drivers/net/wan/hdlc_cisco.c2
-rw-r--r--drivers/net/wan/syncppp.c2
-rw-r--r--drivers/net/wireless/strip.c4
-rw-r--r--include/linux/inetdevice.h10
-rw-r--r--net/ipv4/devinet.c4
-rw-r--r--net/ipv4/fib_frontend.c12
-rw-r--r--net/ipv4/icmp.c2
-rw-r--r--net/ipv4/netfilter/ip_conntrack_netbios_ns.c2
-rw-r--r--net/ipv4/netfilter/ipt_REDIRECT.c2
14 files changed, 27 insertions, 27 deletions
diff --git a/arch/ia64/hp/sim/simeth.c b/arch/ia64/hp/sim/simeth.c
index b5195be6281..e1a1b11473e 100644
--- a/arch/ia64/hp/sim/simeth.c
+++ b/arch/ia64/hp/sim/simeth.c
@@ -320,7 +320,7 @@ simeth_device_event(struct notifier_block *this,unsigned long event, void *ptr)
320 } 320 }
321 321
322 printk(KERN_INFO "simeth_device_event: %s ipaddr=0x%x\n", 322 printk(KERN_INFO "simeth_device_event: %s ipaddr=0x%x\n",
323 dev->name, htonl(ifa->ifa_local)); 323 dev->name, ntohl(ifa->ifa_local));
324 324
325 /* 325 /*
326 * XXX Fix me 326 * XXX Fix me
@@ -331,7 +331,7 @@ simeth_device_event(struct notifier_block *this,unsigned long event, void *ptr)
331 local = dev->priv; 331 local = dev->priv;
332 /* now do it for real */ 332 /* now do it for real */
333 r = event == NETDEV_UP ? 333 r = event == NETDEV_UP ?
334 netdev_attach(local->simfd, dev->irq, htonl(ifa->ifa_local)): 334 netdev_attach(local->simfd, dev->irq, ntohl(ifa->ifa_local)):
335 netdev_detach(local->simfd); 335 netdev_detach(local->simfd);
336 336
337 printk(KERN_INFO "simeth: netdev_attach/detach: event=%s ->%d\n", 337 printk(KERN_INFO "simeth: netdev_attach/detach: event=%s ->%d\n",
diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c
index 664c2e2fb82..bd1178fa4e9 100644
--- a/arch/um/drivers/net_kern.c
+++ b/arch/um/drivers/net_kern.c
@@ -825,7 +825,7 @@ int dev_netmask(void *d, void *m)
825 struct net_device *dev = d; 825 struct net_device *dev = d;
826 struct in_device *ip = dev->ip_ptr; 826 struct in_device *ip = dev->ip_ptr;
827 struct in_ifaddr *in; 827 struct in_ifaddr *in;
828 __u32 *mask_out = m; 828 __be32 *mask_out = m;
829 829
830 if(ip == NULL) 830 if(ip == NULL)
831 return(1); 831 return(1);
diff --git a/arch/xtensa/platform-iss/network.c b/arch/xtensa/platform-iss/network.c
index d96164e602f..15d64414bd6 100644
--- a/arch/xtensa/platform-iss/network.c
+++ b/arch/xtensa/platform-iss/network.c
@@ -201,7 +201,7 @@ static void dev_ip_addr(void *d, char *buf, char *bin_buf)
201 struct net_device *dev = d; 201 struct net_device *dev = d;
202 struct in_device *ip = dev->ip_ptr; 202 struct in_device *ip = dev->ip_ptr;
203 struct in_ifaddr *in; 203 struct in_ifaddr *in;
204 u32 addr; 204 __be32 addr;
205 205
206 if ((ip == NULL) || ((in = ip->ifa_list) == NULL)) { 206 if ((ip == NULL) || ((in = ip->ifa_list) == NULL)) {
207 printk(KERN_WARNING "Device not assigned an IP address!\n"); 207 printk(KERN_WARNING "Device not assigned an IP address!\n");
diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c
index 43da8ae1b2a..1f8d6ae66b4 100644
--- a/drivers/isdn/i4l/isdn_net.c
+++ b/drivers/isdn/i4l/isdn_net.c
@@ -1614,8 +1614,8 @@ isdn_net_ciscohdlck_slarp_send_reply(isdn_net_local *lp)
1614 struct sk_buff *skb; 1614 struct sk_buff *skb;
1615 unsigned char *p; 1615 unsigned char *p;
1616 struct in_device *in_dev = NULL; 1616 struct in_device *in_dev = NULL;
1617 u32 addr = 0; /* local ipv4 address */ 1617 __be32 addr = 0; /* local ipv4 address */
1618 u32 mask = 0; /* local netmask */ 1618 __be32 mask = 0; /* local netmask */
1619 1619
1620 if ((in_dev = lp->netdev->dev.ip_ptr) != NULL) { 1620 if ((in_dev = lp->netdev->dev.ip_ptr) != NULL) {
1621 /* take primary(first) address of interface */ 1621 /* take primary(first) address of interface */
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 0fb5f653d3c..c0bbddae4ec 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2252,7 +2252,7 @@ static u32 bond_glean_dev_ip(struct net_device *dev)
2252{ 2252{
2253 struct in_device *idev; 2253 struct in_device *idev;
2254 struct in_ifaddr *ifa; 2254 struct in_ifaddr *ifa;
2255 u32 addr = 0; 2255 __be32 addr = 0;
2256 2256
2257 if (!dev) 2257 if (!dev)
2258 return 0; 2258 return 0;
diff --git a/drivers/net/wan/hdlc_cisco.c b/drivers/net/wan/hdlc_cisco.c
index 7ec2b2f9b7e..b0bc5ddcf1b 100644
--- a/drivers/net/wan/hdlc_cisco.c
+++ b/drivers/net/wan/hdlc_cisco.c
@@ -161,7 +161,7 @@ static int cisco_rx(struct sk_buff *skb)
161 struct hdlc_header *data = (struct hdlc_header*)skb->data; 161 struct hdlc_header *data = (struct hdlc_header*)skb->data;
162 struct cisco_packet *cisco_data; 162 struct cisco_packet *cisco_data;
163 struct in_device *in_dev; 163 struct in_device *in_dev;
164 u32 addr, mask; 164 __be32 addr, mask;
165 165
166 if (skb->len < sizeof(struct hdlc_header)) 166 if (skb->len < sizeof(struct hdlc_header))
167 goto rx_error; 167 goto rx_error;
diff --git a/drivers/net/wan/syncppp.c b/drivers/net/wan/syncppp.c
index c13b459a013..d1173089f33 100644
--- a/drivers/net/wan/syncppp.c
+++ b/drivers/net/wan/syncppp.c
@@ -763,7 +763,7 @@ static void sppp_cisco_input (struct sppp *sp, struct sk_buff *skb)
763 { 763 {
764 struct in_device *in_dev; 764 struct in_device *in_dev;
765 struct in_ifaddr *ifa; 765 struct in_ifaddr *ifa;
766 u32 addr = 0, mask = ~0; /* FIXME: is the mask correct? */ 766 __be32 addr = 0, mask = ~0; /* FIXME: is the mask correct? */
767#ifdef CONFIG_INET 767#ifdef CONFIG_INET
768 rcu_read_lock(); 768 rcu_read_lock();
769 if ((in_dev = __in_dev_get_rcu(dev)) != NULL) 769 if ((in_dev = __in_dev_get_rcu(dev)) != NULL)
diff --git a/drivers/net/wireless/strip.c b/drivers/net/wireless/strip.c
index ccaf28e8db0..337c692f6fd 100644
--- a/drivers/net/wireless/strip.c
+++ b/drivers/net/wireless/strip.c
@@ -1342,7 +1342,7 @@ static unsigned char *strip_make_packet(unsigned char *buffer,
1342 * 'broadcast hub' radio (First byte of address being 0xFF means broadcast) 1342 * 'broadcast hub' radio (First byte of address being 0xFF means broadcast)
1343 */ 1343 */
1344 if (haddr.c[0] == 0xFF) { 1344 if (haddr.c[0] == 0xFF) {
1345 u32 brd = 0; 1345 __be32 brd = 0;
1346 struct in_device *in_dev; 1346 struct in_device *in_dev;
1347 1347
1348 rcu_read_lock(); 1348 rcu_read_lock();
@@ -1406,7 +1406,7 @@ static void strip_send(struct strip *strip_info, struct sk_buff *skb)
1406 int doreset = (long) jiffies - strip_info->watchdog_doreset >= 0; 1406 int doreset = (long) jiffies - strip_info->watchdog_doreset >= 0;
1407 int doprobe = (long) jiffies - strip_info->watchdog_doprobe >= 0 1407 int doprobe = (long) jiffies - strip_info->watchdog_doprobe >= 0
1408 && !doreset; 1408 && !doreset;
1409 u32 addr, brd; 1409 __be32 addr, brd;
1410 1410
1411 /* 1411 /*
1412 * 1. If we have a packet, encapsulate it and put it in the buffer 1412 * 1. If we have a packet, encapsulate it and put it in the buffer
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index 5ae09372c14..54b32e8b8f6 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -90,11 +90,11 @@ struct in_ifaddr
90 struct in_ifaddr *ifa_next; 90 struct in_ifaddr *ifa_next;
91 struct in_device *ifa_dev; 91 struct in_device *ifa_dev;
92 struct rcu_head rcu_head; 92 struct rcu_head rcu_head;
93 u32 ifa_local; 93 __be32 ifa_local;
94 u32 ifa_address; 94 __be32 ifa_address;
95 u32 ifa_mask; 95 __be32 ifa_mask;
96 u32 ifa_broadcast; 96 __be32 ifa_broadcast;
97 u32 ifa_anycast; 97 __be32 ifa_anycast;
98 unsigned char ifa_scope; 98 unsigned char ifa_scope;
99 unsigned char ifa_flags; 99 unsigned char ifa_flags;
100 unsigned char ifa_prefixlen; 100 unsigned char ifa_prefixlen;
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 5988584f6a6..a0a7780e751 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -805,7 +805,7 @@ int devinet_ioctl(unsigned int cmd, void __user *arg)
805 break; 805 break;
806 ret = 0; 806 ret = 0;
807 if (ifa->ifa_mask != sin->sin_addr.s_addr) { 807 if (ifa->ifa_mask != sin->sin_addr.s_addr) {
808 u32 old_mask = ifa->ifa_mask; 808 __be32 old_mask = ifa->ifa_mask;
809 inet_del_ifa(in_dev, ifap, 0); 809 inet_del_ifa(in_dev, ifap, 0);
810 ifa->ifa_mask = sin->sin_addr.s_addr; 810 ifa->ifa_mask = sin->sin_addr.s_addr;
811 ifa->ifa_prefixlen = inet_mask_len(ifa->ifa_mask); 811 ifa->ifa_prefixlen = inet_mask_len(ifa->ifa_mask);
@@ -931,7 +931,7 @@ static u32 confirm_addr_indev(struct in_device *in_dev, u32 dst,
931 u32 local, int scope) 931 u32 local, int scope)
932{ 932{
933 int same = 0; 933 int same = 0;
934 u32 addr = 0; 934 __be32 addr = 0;
935 935
936 for_ifa(in_dev) { 936 for_ifa(in_dev) {
937 if (!addr && 937 if (!addr &&
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 7f5217907e5..62ee71ee6bc 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -667,9 +667,9 @@ void fib_add_ifaddr(struct in_ifaddr *ifa)
667 struct in_device *in_dev = ifa->ifa_dev; 667 struct in_device *in_dev = ifa->ifa_dev;
668 struct net_device *dev = in_dev->dev; 668 struct net_device *dev = in_dev->dev;
669 struct in_ifaddr *prim = ifa; 669 struct in_ifaddr *prim = ifa;
670 u32 mask = ifa->ifa_mask; 670 __be32 mask = ifa->ifa_mask;
671 u32 addr = ifa->ifa_local; 671 __be32 addr = ifa->ifa_local;
672 u32 prefix = ifa->ifa_address&mask; 672 __be32 prefix = ifa->ifa_address&mask;
673 673
674 if (ifa->ifa_flags&IFA_F_SECONDARY) { 674 if (ifa->ifa_flags&IFA_F_SECONDARY) {
675 prim = inet_ifa_byprefix(in_dev, prefix, mask); 675 prim = inet_ifa_byprefix(in_dev, prefix, mask);
@@ -685,7 +685,7 @@ void fib_add_ifaddr(struct in_ifaddr *ifa)
685 return; 685 return;
686 686
687 /* Add broadcast address, if it is explicitly assigned. */ 687 /* Add broadcast address, if it is explicitly assigned. */
688 if (ifa->ifa_broadcast && ifa->ifa_broadcast != 0xFFFFFFFF) 688 if (ifa->ifa_broadcast && ifa->ifa_broadcast != htonl(0xFFFFFFFF))
689 fib_magic(RTM_NEWROUTE, RTN_BROADCAST, ifa->ifa_broadcast, 32, prim); 689 fib_magic(RTM_NEWROUTE, RTN_BROADCAST, ifa->ifa_broadcast, 32, prim);
690 690
691 if (!ZERONET(prefix) && !(ifa->ifa_flags&IFA_F_SECONDARY) && 691 if (!ZERONET(prefix) && !(ifa->ifa_flags&IFA_F_SECONDARY) &&
@@ -707,8 +707,8 @@ static void fib_del_ifaddr(struct in_ifaddr *ifa)
707 struct net_device *dev = in_dev->dev; 707 struct net_device *dev = in_dev->dev;
708 struct in_ifaddr *ifa1; 708 struct in_ifaddr *ifa1;
709 struct in_ifaddr *prim = ifa; 709 struct in_ifaddr *prim = ifa;
710 u32 brd = ifa->ifa_address|~ifa->ifa_mask; 710 __be32 brd = ifa->ifa_address|~ifa->ifa_mask;
711 u32 any = ifa->ifa_address&ifa->ifa_mask; 711 __be32 any = ifa->ifa_address&ifa->ifa_mask;
712#define LOCAL_OK 1 712#define LOCAL_OK 1
713#define BRD_OK 2 713#define BRD_OK 2
714#define BRD0_OK 4 714#define BRD0_OK 4
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index fd39685241c..428f1c91ec4 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -895,7 +895,7 @@ static void icmp_address_reply(struct sk_buff *skb)
895 if (in_dev->ifa_list && 895 if (in_dev->ifa_list &&
896 IN_DEV_LOG_MARTIANS(in_dev) && 896 IN_DEV_LOG_MARTIANS(in_dev) &&
897 IN_DEV_FORWARD(in_dev)) { 897 IN_DEV_FORWARD(in_dev)) {
898 u32 _mask, *mp; 898 __be32 _mask, *mp;
899 899
900 mp = skb_header_pointer(skb, 0, sizeof(_mask), &_mask); 900 mp = skb_header_pointer(skb, 0, sizeof(_mask), &_mask);
901 BUG_ON(mp == NULL); 901 BUG_ON(mp == NULL);
diff --git a/net/ipv4/netfilter/ip_conntrack_netbios_ns.c b/net/ipv4/netfilter/ip_conntrack_netbios_ns.c
index 3d0b438783d..4adec47aae3 100644
--- a/net/ipv4/netfilter/ip_conntrack_netbios_ns.c
+++ b/net/ipv4/netfilter/ip_conntrack_netbios_ns.c
@@ -48,7 +48,7 @@ static int help(struct sk_buff **pskb,
48 struct iphdr *iph = (*pskb)->nh.iph; 48 struct iphdr *iph = (*pskb)->nh.iph;
49 struct rtable *rt = (struct rtable *)(*pskb)->dst; 49 struct rtable *rt = (struct rtable *)(*pskb)->dst;
50 struct in_device *in_dev; 50 struct in_device *in_dev;
51 u_int32_t mask = 0; 51 __be32 mask = 0;
52 52
53 /* we're only interested in locally generated packets */ 53 /* we're only interested in locally generated packets */
54 if ((*pskb)->sk == NULL) 54 if ((*pskb)->sk == NULL)
diff --git a/net/ipv4/netfilter/ipt_REDIRECT.c b/net/ipv4/netfilter/ipt_REDIRECT.c
index f03d43671c6..c0dcfe9d610 100644
--- a/net/ipv4/netfilter/ipt_REDIRECT.c
+++ b/net/ipv4/netfilter/ipt_REDIRECT.c
@@ -61,7 +61,7 @@ redirect_target(struct sk_buff **pskb,
61{ 61{
62 struct ip_conntrack *ct; 62 struct ip_conntrack *ct;
63 enum ip_conntrack_info ctinfo; 63 enum ip_conntrack_info ctinfo;
64 u_int32_t newdst; 64 __be32 newdst;
65 const struct ip_nat_multi_range_compat *mr = targinfo; 65 const struct ip_nat_multi_range_compat *mr = targinfo;
66 struct ip_nat_range newrange; 66 struct ip_nat_range newrange;
67 67