aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorSteven Whitehouse <steve@chygwyn.com>2006-03-21 01:42:39 -0500
committerDavid S. Miller <davem@davemloft.net>2006-03-21 01:42:39 -0500
commitc4ea94ab3710eb2434abe2eab1a479c2dc01f8ac (patch)
tree72e07ca7d2d5fe2de31b3f5a4e64fa411efdf18d /net
parent2c7946a7bf45ae86736ab3b43d0085e43947945c (diff)
[DECnet]: Endian annotation and fixes for DECnet.
The typedef for dn_address has been removed in favour of using __le16 or __u16 directly as appropriate. All the DECnet header files are updated accordingly. The byte ordering of dn_eth2dn() and dn_dn2eth() are both changed since just about all their callers wanted network order rather than host order, so the conversion is now done in the functions themselves. Several missed endianess conversions have been picked up during the conversion process. The nh_gw field in struct dn_fib_info has been changed from a 32 bit field to 16 bits as it ought to be. One or two cases of using htons rather than dn_htons in the routing code have been found and fixed. There are still a few warnings to fix, but this patch deals with the important cases. Signed-off-by: Steven Whitehouse <steve@chygwyn.com> Signed-off-by: Patrick Caulfield <patrick@tykepenguin.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/decnet/af_decnet.c16
-rw-r--r--net/decnet/dn_dev.c34
-rw-r--r--net/decnet/dn_fib.c8
-rw-r--r--net/decnet/dn_neigh.c24
-rw-r--r--net/decnet/dn_nsp_in.c28
-rw-r--r--net/decnet/dn_nsp_out.c38
-rw-r--r--net/decnet/dn_route.c57
-rw-r--r--net/decnet/dn_rules.c18
-rw-r--r--net/decnet/dn_table.c12
-rw-r--r--net/decnet/sysctl_net_decnet.c12
10 files changed, 125 insertions, 122 deletions
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c
index ce4aaf94860d..824981eed225 100644
--- a/net/decnet/af_decnet.c
+++ b/net/decnet/af_decnet.c
@@ -172,7 +172,7 @@ static struct hlist_head *dn_find_list(struct sock *sk)
172/* 172/*
173 * Valid ports are those greater than zero and not already in use. 173 * Valid ports are those greater than zero and not already in use.
174 */ 174 */
175static int check_port(unsigned short port) 175static int check_port(__le16 port)
176{ 176{
177 struct sock *sk; 177 struct sock *sk;
178 struct hlist_node *node; 178 struct hlist_node *node;
@@ -661,7 +661,7 @@ disc_reject:
661 } 661 }
662} 662}
663 663
664char *dn_addr2asc(dn_address addr, char *buf) 664char *dn_addr2asc(__u16 addr, char *buf)
665{ 665{
666 unsigned short node, area; 666 unsigned short node, area;
667 667
@@ -801,7 +801,7 @@ static int dn_auto_bind(struct socket *sock)
801 /* End of compatibility stuff */ 801 /* End of compatibility stuff */
802 802
803 scp->addr.sdn_add.a_len = dn_htons(2); 803 scp->addr.sdn_add.a_len = dn_htons(2);
804 rv = dn_dev_bind_default((dn_address *)scp->addr.sdn_add.a_addr); 804 rv = dn_dev_bind_default((__le16 *)scp->addr.sdn_add.a_addr);
805 if (rv == 0) { 805 if (rv == 0) {
806 rv = dn_hash_sock(sk); 806 rv = dn_hash_sock(sk);
807 if (rv) 807 if (rv)
@@ -1021,7 +1021,7 @@ static void dn_user_copy(struct sk_buff *skb, struct optdata_dn *opt)
1021 opt->opt_optl = *ptr++; 1021 opt->opt_optl = *ptr++;
1022 opt->opt_status = 0; 1022 opt->opt_status = 0;
1023 memcpy(opt->opt_data, ptr, opt->opt_optl); 1023 memcpy(opt->opt_data, ptr, opt->opt_optl);
1024 skb_pull(skb, opt->opt_optl + 1); 1024 skb_pull(skb, dn_ntohs(opt->opt_optl) + 1);
1025 1025
1026} 1026}
1027 1027
@@ -1121,8 +1121,8 @@ static int dn_accept(struct socket *sock, struct socket *newsock, int flags)
1121 1121
1122 skb_pull(skb, dn_username2sockaddr(skb->data, skb->len, &(DN_SK(newsk)->addr), &type)); 1122 skb_pull(skb, dn_username2sockaddr(skb->data, skb->len, &(DN_SK(newsk)->addr), &type));
1123 skb_pull(skb, dn_username2sockaddr(skb->data, skb->len, &(DN_SK(newsk)->peer), &type)); 1123 skb_pull(skb, dn_username2sockaddr(skb->data, skb->len, &(DN_SK(newsk)->peer), &type));
1124 *(dn_address *)(DN_SK(newsk)->peer.sdn_add.a_addr) = cb->src; 1124 *(__le16 *)(DN_SK(newsk)->peer.sdn_add.a_addr) = cb->src;
1125 *(dn_address *)(DN_SK(newsk)->addr.sdn_add.a_addr) = cb->dst; 1125 *(__le16 *)(DN_SK(newsk)->addr.sdn_add.a_addr) = cb->dst;
1126 1126
1127 menuver = *skb->data; 1127 menuver = *skb->data;
1128 skb_pull(skb, 1); 1128 skb_pull(skb, 1);
@@ -1365,7 +1365,7 @@ static int __dn_setsockopt(struct socket *sock, int level,int optname, char __us
1365 if (optlen != sizeof(struct optdata_dn)) 1365 if (optlen != sizeof(struct optdata_dn))
1366 return -EINVAL; 1366 return -EINVAL;
1367 1367
1368 if (u.opt.opt_optl > 16) 1368 if (dn_ntohs(u.opt.opt_optl) > 16)
1369 return -EINVAL; 1369 return -EINVAL;
1370 1370
1371 memcpy(&scp->conndata_out, &u.opt, optlen); 1371 memcpy(&scp->conndata_out, &u.opt, optlen);
@@ -1378,7 +1378,7 @@ static int __dn_setsockopt(struct socket *sock, int level,int optname, char __us
1378 if (optlen != sizeof(struct optdata_dn)) 1378 if (optlen != sizeof(struct optdata_dn))
1379 return -EINVAL; 1379 return -EINVAL;
1380 1380
1381 if (u.opt.opt_optl > 16) 1381 if (dn_ntohs(u.opt.opt_optl) > 16)
1382 return -EINVAL; 1382 return -EINVAL;
1383 1383
1384 memcpy(&scp->discdata_out, &u.opt, optlen); 1384 memcpy(&scp->discdata_out, &u.opt, optlen);
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c
index efbead83ba7f..cc7b9d9255ef 100644
--- a/net/decnet/dn_dev.c
+++ b/net/decnet/dn_dev.c
@@ -64,7 +64,7 @@ extern struct neigh_table dn_neigh_table;
64/* 64/*
65 * decnet_address is kept in network order. 65 * decnet_address is kept in network order.
66 */ 66 */
67dn_address decnet_address = 0; 67__le16 decnet_address = 0;
68 68
69static DEFINE_RWLOCK(dndev_lock); 69static DEFINE_RWLOCK(dndev_lock);
70static struct net_device *decnet_default_device; 70static struct net_device *decnet_default_device;
@@ -439,7 +439,7 @@ static void dn_dev_del_ifa(struct dn_dev *dn_db, struct dn_ifaddr **ifap, int de
439 *ifap = ifa1->ifa_next; 439 *ifap = ifa1->ifa_next;
440 440
441 if (dn_db->dev->type == ARPHRD_ETHER) { 441 if (dn_db->dev->type == ARPHRD_ETHER) {
442 if (ifa1->ifa_local != dn_htons(dn_eth2dn(dev->dev_addr))) { 442 if (ifa1->ifa_local != dn_eth2dn(dev->dev_addr)) {
443 dn_dn2eth(mac_addr, ifa1->ifa_local); 443 dn_dn2eth(mac_addr, ifa1->ifa_local);
444 dev_mc_delete(dev, mac_addr, ETH_ALEN, 0); 444 dev_mc_delete(dev, mac_addr, ETH_ALEN, 0);
445 } 445 }
@@ -470,7 +470,7 @@ static int dn_dev_insert_ifa(struct dn_dev *dn_db, struct dn_ifaddr *ifa)
470 } 470 }
471 471
472 if (dev->type == ARPHRD_ETHER) { 472 if (dev->type == ARPHRD_ETHER) {
473 if (ifa->ifa_local != dn_htons(dn_eth2dn(dev->dev_addr))) { 473 if (ifa->ifa_local != dn_eth2dn(dev->dev_addr)) {
474 dn_dn2eth(mac_addr, ifa->ifa_local); 474 dn_dn2eth(mac_addr, ifa->ifa_local);
475 dev_mc_add(dev, mac_addr, ETH_ALEN, 0); 475 dev_mc_add(dev, mac_addr, ETH_ALEN, 0);
476 dev_mc_upload(dev); 476 dev_mc_upload(dev);
@@ -561,7 +561,7 @@ int dn_dev_ioctl(unsigned int cmd, void __user *arg)
561 561
562 switch(cmd) { 562 switch(cmd) {
563 case SIOCGIFADDR: 563 case SIOCGIFADDR:
564 *((dn_address *)sdn->sdn_nodeaddr) = ifa->ifa_local; 564 *((__le16 *)sdn->sdn_nodeaddr) = ifa->ifa_local;
565 goto rarok; 565 goto rarok;
566 566
567 case SIOCSIFADDR: 567 case SIOCSIFADDR:
@@ -804,7 +804,7 @@ done:
804 return skb->len; 804 return skb->len;
805} 805}
806 806
807static int dn_dev_get_first(struct net_device *dev, dn_address *addr) 807static int dn_dev_get_first(struct net_device *dev, __le16 *addr)
808{ 808{
809 struct dn_dev *dn_db = (struct dn_dev *)dev->dn_ptr; 809 struct dn_dev *dn_db = (struct dn_dev *)dev->dn_ptr;
810 struct dn_ifaddr *ifa; 810 struct dn_ifaddr *ifa;
@@ -830,7 +830,7 @@ out:
830 * a sensible default. Eventually the routing code will take care of all the 830 * a sensible default. Eventually the routing code will take care of all the
831 * nasties for us I hope. 831 * nasties for us I hope.
832 */ 832 */
833int dn_dev_bind_default(dn_address *addr) 833int dn_dev_bind_default(__le16 *addr)
834{ 834{
835 struct net_device *dev; 835 struct net_device *dev;
836 int rv; 836 int rv;
@@ -853,7 +853,7 @@ static void dn_send_endnode_hello(struct net_device *dev, struct dn_ifaddr *ifa)
853{ 853{
854 struct endnode_hello_message *msg; 854 struct endnode_hello_message *msg;
855 struct sk_buff *skb = NULL; 855 struct sk_buff *skb = NULL;
856 unsigned short int *pktlen; 856 __le16 *pktlen;
857 struct dn_dev *dn_db = (struct dn_dev *)dev->dn_ptr; 857 struct dn_dev *dn_db = (struct dn_dev *)dev->dn_ptr;
858 858
859 if ((skb = dn_alloc_skb(NULL, sizeof(*msg), GFP_ATOMIC)) == NULL) 859 if ((skb = dn_alloc_skb(NULL, sizeof(*msg), GFP_ATOMIC)) == NULL)
@@ -882,7 +882,7 @@ static void dn_send_endnode_hello(struct net_device *dev, struct dn_ifaddr *ifa)
882 msg->datalen = 0x02; 882 msg->datalen = 0x02;
883 memset(msg->data, 0xAA, 2); 883 memset(msg->data, 0xAA, 2);
884 884
885 pktlen = (unsigned short *)skb_push(skb,2); 885 pktlen = (__le16 *)skb_push(skb,2);
886 *pktlen = dn_htons(skb->len - 2); 886 *pktlen = dn_htons(skb->len - 2);
887 887
888 skb->nh.raw = skb->data; 888 skb->nh.raw = skb->data;
@@ -926,7 +926,7 @@ static void dn_send_router_hello(struct net_device *dev, struct dn_ifaddr *ifa)
926 size_t size; 926 size_t size;
927 unsigned char *ptr; 927 unsigned char *ptr;
928 unsigned char *i1, *i2; 928 unsigned char *i1, *i2;
929 unsigned short *pktlen; 929 __le16 *pktlen;
930 char *src; 930 char *src;
931 931
932 if (mtu2blksize(dev) < (26 + 7)) 932 if (mtu2blksize(dev) < (26 + 7))
@@ -955,11 +955,11 @@ static void dn_send_router_hello(struct net_device *dev, struct dn_ifaddr *ifa)
955 ptr += ETH_ALEN; 955 ptr += ETH_ALEN;
956 *ptr++ = dn_db->parms.forwarding == 1 ? 956 *ptr++ = dn_db->parms.forwarding == 1 ?
957 DN_RT_INFO_L1RT : DN_RT_INFO_L2RT; 957 DN_RT_INFO_L1RT : DN_RT_INFO_L2RT;
958 *((unsigned short *)ptr) = dn_htons(mtu2blksize(dev)); 958 *((__le16 *)ptr) = dn_htons(mtu2blksize(dev));
959 ptr += 2; 959 ptr += 2;
960 *ptr++ = dn_db->parms.priority; /* Priority */ 960 *ptr++ = dn_db->parms.priority; /* Priority */
961 *ptr++ = 0; /* Area: Reserved */ 961 *ptr++ = 0; /* Area: Reserved */
962 *((unsigned short *)ptr) = dn_htons((unsigned short)dn_db->parms.t3); 962 *((__le16 *)ptr) = dn_htons((unsigned short)dn_db->parms.t3);
963 ptr += 2; 963 ptr += 2;
964 *ptr++ = 0; /* MPD: Reserved */ 964 *ptr++ = 0; /* MPD: Reserved */
965 i1 = ptr++; 965 i1 = ptr++;
@@ -974,7 +974,7 @@ static void dn_send_router_hello(struct net_device *dev, struct dn_ifaddr *ifa)
974 974
975 skb_trim(skb, (27 + *i2)); 975 skb_trim(skb, (27 + *i2));
976 976
977 pktlen = (unsigned short *)skb_push(skb, 2); 977 pktlen = (__le16 *)skb_push(skb, 2);
978 *pktlen = dn_htons(skb->len - 2); 978 *pktlen = dn_htons(skb->len - 2);
979 979
980 skb->nh.raw = skb->data; 980 skb->nh.raw = skb->data;
@@ -1016,7 +1016,7 @@ static void dn_send_ptp_hello(struct net_device *dev, struct dn_ifaddr *ifa)
1016 ptr = skb_put(skb, 2 + 4 + tdlen); 1016 ptr = skb_put(skb, 2 + 4 + tdlen);
1017 1017
1018 *ptr++ = DN_RT_PKT_HELO; 1018 *ptr++ = DN_RT_PKT_HELO;
1019 *((dn_address *)ptr) = ifa->ifa_local; 1019 *((__le16 *)ptr) = ifa->ifa_local;
1020 ptr += 2; 1020 ptr += 2;
1021 *ptr++ = tdlen; 1021 *ptr++ = tdlen;
1022 1022
@@ -1150,7 +1150,7 @@ struct dn_dev *dn_dev_create(struct net_device *dev, int *err)
1150void dn_dev_up(struct net_device *dev) 1150void dn_dev_up(struct net_device *dev)
1151{ 1151{
1152 struct dn_ifaddr *ifa; 1152 struct dn_ifaddr *ifa;
1153 dn_address addr = decnet_address; 1153 __le16 addr = decnet_address;
1154 int maybe_default = 0; 1154 int maybe_default = 0;
1155 struct dn_dev *dn_db = (struct dn_dev *)dev->dn_ptr; 1155 struct dn_dev *dn_db = (struct dn_dev *)dev->dn_ptr;
1156 1156
@@ -1173,7 +1173,7 @@ void dn_dev_up(struct net_device *dev)
1173 if (dev->type == ARPHRD_ETHER) { 1173 if (dev->type == ARPHRD_ETHER) {
1174 if (memcmp(dev->dev_addr, dn_hiord, 4) != 0) 1174 if (memcmp(dev->dev_addr, dn_hiord, 4) != 0)
1175 return; 1175 return;
1176 addr = dn_htons(dn_eth2dn(dev->dev_addr)); 1176 addr = dn_eth2dn(dev->dev_addr);
1177 maybe_default = 1; 1177 maybe_default = 1;
1178 } 1178 }
1179 1179
@@ -1385,8 +1385,8 @@ static int dn_dev_seq_show(struct seq_file *seq, void *v)
1385 mtu2blksize(dev), 1385 mtu2blksize(dev),
1386 dn_db->parms.priority, 1386 dn_db->parms.priority,
1387 dn_db->parms.state, dn_db->parms.name, 1387 dn_db->parms.state, dn_db->parms.name,
1388 dn_db->router ? dn_addr2asc(dn_ntohs(*(dn_address *)dn_db->router->primary_key), router_buf) : "", 1388 dn_db->router ? dn_addr2asc(dn_ntohs(*(__le16 *)dn_db->router->primary_key), router_buf) : "",
1389 dn_db->peer ? dn_addr2asc(dn_ntohs(*(dn_address *)dn_db->peer->primary_key), peer_buf) : ""); 1389 dn_db->peer ? dn_addr2asc(dn_ntohs(*(__le16 *)dn_db->peer->primary_key), peer_buf) : "");
1390 } 1390 }
1391 return 0; 1391 return 0;
1392} 1392}
diff --git a/net/decnet/dn_fib.c b/net/decnet/dn_fib.c
index 99bc061759c3..bd4ce8681a12 100644
--- a/net/decnet/dn_fib.c
+++ b/net/decnet/dn_fib.c
@@ -143,11 +143,11 @@ static inline struct dn_fib_info *dn_fib_find_info(const struct dn_fib_info *nfi
143 return NULL; 143 return NULL;
144} 144}
145 145
146u16 dn_fib_get_attr16(struct rtattr *attr, int attrlen, int type) 146__le16 dn_fib_get_attr16(struct rtattr *attr, int attrlen, int type)
147{ 147{
148 while(RTA_OK(attr,attrlen)) { 148 while(RTA_OK(attr,attrlen)) {
149 if (attr->rta_type == type) 149 if (attr->rta_type == type)
150 return *(u16*)RTA_DATA(attr); 150 return *(__le16*)RTA_DATA(attr);
151 attr = RTA_NEXT(attr, attrlen); 151 attr = RTA_NEXT(attr, attrlen);
152 } 152 }
153 153
@@ -565,7 +565,7 @@ int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb)
565 return skb->len; 565 return skb->len;
566} 566}
567 567
568static void fib_magic(int cmd, int type, __u16 dst, int dst_len, struct dn_ifaddr *ifa) 568static void fib_magic(int cmd, int type, __le16 dst, int dst_len, struct dn_ifaddr *ifa)
569{ 569{
570 struct dn_fib_table *tb; 570 struct dn_fib_table *tb;
571 struct { 571 struct {
@@ -684,7 +684,7 @@ static int dn_fib_dnaddr_event(struct notifier_block *this, unsigned long event,
684 return NOTIFY_DONE; 684 return NOTIFY_DONE;
685} 685}
686 686
687int dn_fib_sync_down(dn_address local, struct net_device *dev, int force) 687int dn_fib_sync_down(__le16 local, struct net_device *dev, int force)
688{ 688{
689 int ret = 0; 689 int ret = 0;
690 int scope = RT_SCOPE_NOWHERE; 690 int scope = RT_SCOPE_NOWHERE;
diff --git a/net/decnet/dn_neigh.c b/net/decnet/dn_neigh.c
index 33ab256cfd4a..7c8692c26bfe 100644
--- a/net/decnet/dn_neigh.c
+++ b/net/decnet/dn_neigh.c
@@ -95,7 +95,7 @@ static struct neigh_ops dn_phase3_ops = {
95struct neigh_table dn_neigh_table = { 95struct neigh_table dn_neigh_table = {
96 .family = PF_DECnet, 96 .family = PF_DECnet,
97 .entry_size = sizeof(struct dn_neigh), 97 .entry_size = sizeof(struct dn_neigh),
98 .key_len = sizeof(dn_address), 98 .key_len = sizeof(__le16),
99 .hash = dn_neigh_hash, 99 .hash = dn_neigh_hash,
100 .constructor = dn_neigh_construct, 100 .constructor = dn_neigh_construct,
101 .id = "dn_neigh_cache", 101 .id = "dn_neigh_cache",
@@ -123,7 +123,7 @@ struct neigh_table dn_neigh_table = {
123 123
124static u32 dn_neigh_hash(const void *pkey, const struct net_device *dev) 124static u32 dn_neigh_hash(const void *pkey, const struct net_device *dev)
125{ 125{
126 return jhash_2words(*(dn_address *)pkey, 0, dn_neigh_table.hash_rnd); 126 return jhash_2words(*(__u16 *)pkey, 0, dn_neigh_table.hash_rnd);
127} 127}
128 128
129static int dn_neigh_construct(struct neighbour *neigh) 129static int dn_neigh_construct(struct neighbour *neigh)
@@ -249,14 +249,14 @@ static int dn_long_output(struct sk_buff *skb)
249 data = skb_push(skb, sizeof(struct dn_long_packet) + 3); 249 data = skb_push(skb, sizeof(struct dn_long_packet) + 3);
250 lp = (struct dn_long_packet *)(data+3); 250 lp = (struct dn_long_packet *)(data+3);
251 251
252 *((unsigned short *)data) = dn_htons(skb->len - 2); 252 *((__le16 *)data) = dn_htons(skb->len - 2);
253 *(data + 2) = 1 | DN_RT_F_PF; /* Padding */ 253 *(data + 2) = 1 | DN_RT_F_PF; /* Padding */
254 254
255 lp->msgflg = DN_RT_PKT_LONG|(cb->rt_flags&(DN_RT_F_IE|DN_RT_F_RQR|DN_RT_F_RTS)); 255 lp->msgflg = DN_RT_PKT_LONG|(cb->rt_flags&(DN_RT_F_IE|DN_RT_F_RQR|DN_RT_F_RTS));
256 lp->d_area = lp->d_subarea = 0; 256 lp->d_area = lp->d_subarea = 0;
257 dn_dn2eth(lp->d_id, dn_ntohs(cb->dst)); 257 dn_dn2eth(lp->d_id, cb->dst);
258 lp->s_area = lp->s_subarea = 0; 258 lp->s_area = lp->s_subarea = 0;
259 dn_dn2eth(lp->s_id, dn_ntohs(cb->src)); 259 dn_dn2eth(lp->s_id, cb->src);
260 lp->nl2 = 0; 260 lp->nl2 = 0;
261 lp->visit_ct = cb->hops & 0x3f; 261 lp->visit_ct = cb->hops & 0x3f;
262 lp->s_class = 0; 262 lp->s_class = 0;
@@ -293,7 +293,7 @@ static int dn_short_output(struct sk_buff *skb)
293 } 293 }
294 294
295 data = skb_push(skb, sizeof(struct dn_short_packet) + 2); 295 data = skb_push(skb, sizeof(struct dn_short_packet) + 2);
296 *((unsigned short *)data) = dn_htons(skb->len - 2); 296 *((__le16 *)data) = dn_htons(skb->len - 2);
297 sp = (struct dn_short_packet *)(data+2); 297 sp = (struct dn_short_packet *)(data+2);
298 298
299 sp->msgflg = DN_RT_PKT_SHORT|(cb->rt_flags&(DN_RT_F_RQR|DN_RT_F_RTS)); 299 sp->msgflg = DN_RT_PKT_SHORT|(cb->rt_flags&(DN_RT_F_RQR|DN_RT_F_RTS));
@@ -335,7 +335,7 @@ static int dn_phase3_output(struct sk_buff *skb)
335 } 335 }
336 336
337 data = skb_push(skb, sizeof(struct dn_short_packet) + 2); 337 data = skb_push(skb, sizeof(struct dn_short_packet) + 2);
338 *((unsigned short *)data) = dn_htons(skb->len - 2); 338 *((__le16 *)data) = dn_htons(skb->len - 2);
339 sp = (struct dn_short_packet *)(data + 2); 339 sp = (struct dn_short_packet *)(data + 2);
340 340
341 sp->msgflg = DN_RT_PKT_SHORT|(cb->rt_flags&(DN_RT_F_RQR|DN_RT_F_RTS)); 341 sp->msgflg = DN_RT_PKT_SHORT|(cb->rt_flags&(DN_RT_F_RQR|DN_RT_F_RTS));
@@ -373,9 +373,9 @@ int dn_neigh_router_hello(struct sk_buff *skb)
373 struct neighbour *neigh; 373 struct neighbour *neigh;
374 struct dn_neigh *dn; 374 struct dn_neigh *dn;
375 struct dn_dev *dn_db; 375 struct dn_dev *dn_db;
376 dn_address src; 376 __le16 src;
377 377
378 src = dn_htons(dn_eth2dn(msg->id)); 378 src = dn_eth2dn(msg->id);
379 379
380 neigh = __neigh_lookup(&dn_neigh_table, &src, skb->dev, 1); 380 neigh = __neigh_lookup(&dn_neigh_table, &src, skb->dev, 1);
381 381
@@ -409,7 +409,7 @@ int dn_neigh_router_hello(struct sk_buff *skb)
409 } 409 }
410 410
411 /* Only use routers in our area */ 411 /* Only use routers in our area */
412 if ((dn_ntohs(src)>>10) == dn_ntohs((decnet_address)>>10)) { 412 if ((dn_ntohs(src)>>10) == (dn_ntohs((decnet_address))>>10)) {
413 if (!dn_db->router) { 413 if (!dn_db->router) {
414 dn_db->router = neigh_clone(neigh); 414 dn_db->router = neigh_clone(neigh);
415 } else { 415 } else {
@@ -433,9 +433,9 @@ int dn_neigh_endnode_hello(struct sk_buff *skb)
433 struct endnode_hello_message *msg = (struct endnode_hello_message *)skb->data; 433 struct endnode_hello_message *msg = (struct endnode_hello_message *)skb->data;
434 struct neighbour *neigh; 434 struct neighbour *neigh;
435 struct dn_neigh *dn; 435 struct dn_neigh *dn;
436 dn_address src; 436 __le16 src;
437 437
438 src = dn_htons(dn_eth2dn(msg->id)); 438 src = dn_eth2dn(msg->id);
439 439
440 neigh = __neigh_lookup(&dn_neigh_table, &src, skb->dev, 1); 440 neigh = __neigh_lookup(&dn_neigh_table, &src, skb->dev, 1);
441 441
diff --git a/net/decnet/dn_nsp_in.c b/net/decnet/dn_nsp_in.c
index 44bda85e678f..547523b41c81 100644
--- a/net/decnet/dn_nsp_in.c
+++ b/net/decnet/dn_nsp_in.c
@@ -85,7 +85,7 @@ static void dn_log_martian(struct sk_buff *skb, const char *msg)
85 if (decnet_log_martians && net_ratelimit()) { 85 if (decnet_log_martians && net_ratelimit()) {
86 char *devname = skb->dev ? skb->dev->name : "???"; 86 char *devname = skb->dev ? skb->dev->name : "???";
87 struct dn_skb_cb *cb = DN_SKB_CB(skb); 87 struct dn_skb_cb *cb = DN_SKB_CB(skb);
88 printk(KERN_INFO "DECnet: Martian packet (%s) dev=%s src=0x%04hx dst=0x%04hx srcport=0x%04hx dstport=0x%04hx\n", msg, devname, cb->src, cb->dst, cb->src_port, cb->dst_port); 88 printk(KERN_INFO "DECnet: Martian packet (%s) dev=%s src=0x%04hx dst=0x%04hx srcport=0x%04hx dstport=0x%04hx\n", msg, devname, dn_ntohs(cb->src), dn_ntohs(cb->dst), dn_ntohs(cb->src_port), dn_ntohs(cb->dst_port));
89 } 89 }
90} 90}
91 91
@@ -128,7 +128,7 @@ static void dn_ack(struct sock *sk, struct sk_buff *skb, unsigned short ack)
128 */ 128 */
129static int dn_process_ack(struct sock *sk, struct sk_buff *skb, int oth) 129static int dn_process_ack(struct sock *sk, struct sk_buff *skb, int oth)
130{ 130{
131 unsigned short *ptr = (unsigned short *)skb->data; 131 __le16 *ptr = (__le16 *)skb->data;
132 int len = 0; 132 int len = 0;
133 unsigned short ack; 133 unsigned short ack;
134 134
@@ -346,7 +346,7 @@ static void dn_nsp_conn_conf(struct sock *sk, struct sk_buff *skb)
346 ptr = skb->data; 346 ptr = skb->data;
347 cb->services = *ptr++; 347 cb->services = *ptr++;
348 cb->info = *ptr++; 348 cb->info = *ptr++;
349 cb->segsize = dn_ntohs(*(__u16 *)ptr); 349 cb->segsize = dn_ntohs(*(__le16 *)ptr);
350 350
351 if ((scp->state == DN_CI) || (scp->state == DN_CD)) { 351 if ((scp->state == DN_CI) || (scp->state == DN_CD)) {
352 scp->persist = 0; 352 scp->persist = 0;
@@ -363,7 +363,7 @@ static void dn_nsp_conn_conf(struct sock *sk, struct sk_buff *skb)
363 if (skb->len > 0) { 363 if (skb->len > 0) {
364 unsigned char dlen = *skb->data; 364 unsigned char dlen = *skb->data;
365 if ((dlen <= 16) && (dlen <= skb->len)) { 365 if ((dlen <= 16) && (dlen <= skb->len)) {
366 scp->conndata_in.opt_optl = dlen; 366 scp->conndata_in.opt_optl = dn_htons((__u16)dlen);
367 memcpy(scp->conndata_in.opt_data, skb->data + 1, dlen); 367 memcpy(scp->conndata_in.opt_data, skb->data + 1, dlen);
368 } 368 }
369 } 369 }
@@ -397,17 +397,17 @@ static void dn_nsp_disc_init(struct sock *sk, struct sk_buff *skb)
397 if (skb->len < 2) 397 if (skb->len < 2)
398 goto out; 398 goto out;
399 399
400 reason = dn_ntohs(*(__u16 *)skb->data); 400 reason = dn_ntohs(*(__le16 *)skb->data);
401 skb_pull(skb, 2); 401 skb_pull(skb, 2);
402 402
403 scp->discdata_in.opt_status = reason; 403 scp->discdata_in.opt_status = dn_htons(reason);
404 scp->discdata_in.opt_optl = 0; 404 scp->discdata_in.opt_optl = 0;
405 memset(scp->discdata_in.opt_data, 0, 16); 405 memset(scp->discdata_in.opt_data, 0, 16);
406 406
407 if (skb->len > 0) { 407 if (skb->len > 0) {
408 unsigned char dlen = *skb->data; 408 unsigned char dlen = *skb->data;
409 if ((dlen <= 16) && (dlen <= skb->len)) { 409 if ((dlen <= 16) && (dlen <= skb->len)) {
410 scp->discdata_in.opt_optl = dlen; 410 scp->discdata_in.opt_optl = dn_htons((__u16)dlen);
411 memcpy(scp->discdata_in.opt_data, skb->data + 1, dlen); 411 memcpy(scp->discdata_in.opt_data, skb->data + 1, dlen);
412 } 412 }
413 } 413 }
@@ -464,7 +464,7 @@ static void dn_nsp_disc_conf(struct sock *sk, struct sk_buff *skb)
464 if (skb->len != 2) 464 if (skb->len != 2)
465 goto out; 465 goto out;
466 466
467 reason = dn_ntohs(*(__u16 *)skb->data); 467 reason = dn_ntohs(*(__le16 *)skb->data);
468 468
469 sk->sk_state = TCP_CLOSE; 469 sk->sk_state = TCP_CLOSE;
470 470
@@ -513,7 +513,7 @@ static void dn_nsp_linkservice(struct sock *sk, struct sk_buff *skb)
513 if (skb->len != 4) 513 if (skb->len != 4)
514 goto out; 514 goto out;
515 515
516 segnum = dn_ntohs(*(__u16 *)ptr); 516 segnum = dn_ntohs(*(__le16 *)ptr);
517 ptr += 2; 517 ptr += 2;
518 lsflags = *(unsigned char *)ptr++; 518 lsflags = *(unsigned char *)ptr++;
519 fcval = *ptr; 519 fcval = *ptr;
@@ -621,7 +621,7 @@ static void dn_nsp_otherdata(struct sock *sk, struct sk_buff *skb)
621 if (skb->len < 2) 621 if (skb->len < 2)
622 goto out; 622 goto out;
623 623
624 cb->segnum = segnum = dn_ntohs(*(__u16 *)skb->data); 624 cb->segnum = segnum = dn_ntohs(*(__le16 *)skb->data);
625 skb_pull(skb, 2); 625 skb_pull(skb, 2);
626 626
627 if (seq_next(scp->numoth_rcv, segnum)) { 627 if (seq_next(scp->numoth_rcv, segnum)) {
@@ -649,7 +649,7 @@ static void dn_nsp_data(struct sock *sk, struct sk_buff *skb)
649 if (skb->len < 2) 649 if (skb->len < 2)
650 goto out; 650 goto out;
651 651
652 cb->segnum = segnum = dn_ntohs(*(__u16 *)skb->data); 652 cb->segnum = segnum = dn_ntohs(*(__le16 *)skb->data);
653 skb_pull(skb, 2); 653 skb_pull(skb, 2);
654 654
655 if (seq_next(scp->numdat_rcv, segnum)) { 655 if (seq_next(scp->numdat_rcv, segnum)) {
@@ -760,7 +760,7 @@ static int dn_nsp_rx_packet(struct sk_buff *skb)
760 /* 760 /*
761 * Grab the destination address. 761 * Grab the destination address.
762 */ 762 */
763 cb->dst_port = *(unsigned short *)ptr; 763 cb->dst_port = *(__le16 *)ptr;
764 cb->src_port = 0; 764 cb->src_port = 0;
765 ptr += 2; 765 ptr += 2;
766 766
@@ -768,7 +768,7 @@ static int dn_nsp_rx_packet(struct sk_buff *skb)
768 * If not a connack, grab the source address too. 768 * If not a connack, grab the source address too.
769 */ 769 */
770 if (pskb_may_pull(skb, 5)) { 770 if (pskb_may_pull(skb, 5)) {
771 cb->src_port = *(unsigned short *)ptr; 771 cb->src_port = *(__le16 *)ptr;
772 ptr += 2; 772 ptr += 2;
773 skb_pull(skb, 5); 773 skb_pull(skb, 5);
774 } 774 }
@@ -778,7 +778,7 @@ static int dn_nsp_rx_packet(struct sk_buff *skb)
778 * Swap src & dst and look up in the normal way. 778 * Swap src & dst and look up in the normal way.
779 */ 779 */
780 if (unlikely(cb->rt_flags & DN_RT_F_RTS)) { 780 if (unlikely(cb->rt_flags & DN_RT_F_RTS)) {
781 unsigned short tmp = cb->dst_port; 781 __le16 tmp = cb->dst_port;
782 cb->dst_port = cb->src_port; 782 cb->dst_port = cb->src_port;
783 cb->src_port = tmp; 783 cb->src_port = tmp;
784 tmp = cb->dst; 784 tmp = cb->dst;
diff --git a/net/decnet/dn_nsp_out.c b/net/decnet/dn_nsp_out.c
index c96c767b1f74..c2e21cd89b3c 100644
--- a/net/decnet/dn_nsp_out.c
+++ b/net/decnet/dn_nsp_out.c
@@ -287,26 +287,26 @@ int dn_nsp_xmit_timeout(struct sock *sk)
287 return 0; 287 return 0;
288} 288}
289 289
290static inline unsigned char *dn_mk_common_header(struct dn_scp *scp, struct sk_buff *skb, unsigned char msgflag, int len) 290static inline __le16 *dn_mk_common_header(struct dn_scp *scp, struct sk_buff *skb, unsigned char msgflag, int len)
291{ 291{
292 unsigned char *ptr = skb_push(skb, len); 292 unsigned char *ptr = skb_push(skb, len);
293 293
294 BUG_ON(len < 5); 294 BUG_ON(len < 5);
295 295
296 *ptr++ = msgflag; 296 *ptr++ = msgflag;
297 *((unsigned short *)ptr) = scp->addrrem; 297 *((__le16 *)ptr) = scp->addrrem;
298 ptr += 2; 298 ptr += 2;
299 *((unsigned short *)ptr) = scp->addrloc; 299 *((__le16 *)ptr) = scp->addrloc;
300 ptr += 2; 300 ptr += 2;
301 return ptr; 301 return (__le16 __force *)ptr;
302} 302}
303 303
304static unsigned short *dn_mk_ack_header(struct sock *sk, struct sk_buff *skb, unsigned char msgflag, int hlen, int other) 304static __le16 *dn_mk_ack_header(struct sock *sk, struct sk_buff *skb, unsigned char msgflag, int hlen, int other)
305{ 305{
306 struct dn_scp *scp = DN_SK(sk); 306 struct dn_scp *scp = DN_SK(sk);
307 unsigned short acknum = scp->numdat_rcv & 0x0FFF; 307 unsigned short acknum = scp->numdat_rcv & 0x0FFF;
308 unsigned short ackcrs = scp->numoth_rcv & 0x0FFF; 308 unsigned short ackcrs = scp->numoth_rcv & 0x0FFF;
309 unsigned short *ptr; 309 __le16 *ptr;
310 310
311 BUG_ON(hlen < 9); 311 BUG_ON(hlen < 9);
312 312
@@ -325,7 +325,7 @@ static unsigned short *dn_mk_ack_header(struct sock *sk, struct sk_buff *skb, un
325 /* Set "cross subchannel" bit in ackcrs */ 325 /* Set "cross subchannel" bit in ackcrs */
326 ackcrs |= 0x2000; 326 ackcrs |= 0x2000;
327 327
328 ptr = (unsigned short *)dn_mk_common_header(scp, skb, msgflag, hlen); 328 ptr = (__le16 *)dn_mk_common_header(scp, skb, msgflag, hlen);
329 329
330 *ptr++ = dn_htons(acknum); 330 *ptr++ = dn_htons(acknum);
331 *ptr++ = dn_htons(ackcrs); 331 *ptr++ = dn_htons(ackcrs);
@@ -333,11 +333,11 @@ static unsigned short *dn_mk_ack_header(struct sock *sk, struct sk_buff *skb, un
333 return ptr; 333 return ptr;
334} 334}
335 335
336static unsigned short *dn_nsp_mk_data_header(struct sock *sk, struct sk_buff *skb, int oth) 336static __le16 *dn_nsp_mk_data_header(struct sock *sk, struct sk_buff *skb, int oth)
337{ 337{
338 struct dn_scp *scp = DN_SK(sk); 338 struct dn_scp *scp = DN_SK(sk);
339 struct dn_skb_cb *cb = DN_SKB_CB(skb); 339 struct dn_skb_cb *cb = DN_SKB_CB(skb);
340 unsigned short *ptr = dn_mk_ack_header(sk, skb, cb->nsp_flags, 11, oth); 340 __le16 *ptr = dn_mk_ack_header(sk, skb, cb->nsp_flags, 11, oth);
341 341
342 if (unlikely(oth)) { 342 if (unlikely(oth)) {
343 cb->segnum = scp->numoth; 343 cb->segnum = scp->numoth;
@@ -524,9 +524,9 @@ void dn_send_conn_conf(struct sock *sk, gfp_t gfp)
524 struct dn_scp *scp = DN_SK(sk); 524 struct dn_scp *scp = DN_SK(sk);
525 struct sk_buff *skb = NULL; 525 struct sk_buff *skb = NULL;
526 struct nsp_conn_init_msg *msg; 526 struct nsp_conn_init_msg *msg;
527 unsigned char len = scp->conndata_out.opt_optl; 527 __u8 len = (__u8)dn_ntohs(scp->conndata_out.opt_optl);
528 528
529 if ((skb = dn_alloc_skb(sk, 50 + scp->conndata_out.opt_optl, gfp)) == NULL) 529 if ((skb = dn_alloc_skb(sk, 50 + dn_ntohs(scp->conndata_out.opt_optl), gfp)) == NULL)
530 return; 530 return;
531 531
532 msg = (struct nsp_conn_init_msg *)skb_put(skb, sizeof(*msg)); 532 msg = (struct nsp_conn_init_msg *)skb_put(skb, sizeof(*msg));
@@ -553,7 +553,7 @@ void dn_send_conn_conf(struct sock *sk, gfp_t gfp)
553static __inline__ void dn_nsp_do_disc(struct sock *sk, unsigned char msgflg, 553static __inline__ void dn_nsp_do_disc(struct sock *sk, unsigned char msgflg,
554 unsigned short reason, gfp_t gfp, 554 unsigned short reason, gfp_t gfp,
555 struct dst_entry *dst, 555 struct dst_entry *dst,
556 int ddl, unsigned char *dd, __u16 rem, __u16 loc) 556 int ddl, unsigned char *dd, __le16 rem, __le16 loc)
557{ 557{
558 struct sk_buff *skb = NULL; 558 struct sk_buff *skb = NULL;
559 int size = 7 + ddl + ((msgflg == NSP_DISCINIT) ? 1 : 0); 559 int size = 7 + ddl + ((msgflg == NSP_DISCINIT) ? 1 : 0);
@@ -561,7 +561,7 @@ static __inline__ void dn_nsp_do_disc(struct sock *sk, unsigned char msgflg,
561 561
562 if ((dst == NULL) || (rem == 0)) { 562 if ((dst == NULL) || (rem == 0)) {
563 if (net_ratelimit()) 563 if (net_ratelimit())
564 printk(KERN_DEBUG "DECnet: dn_nsp_do_disc: BUG! Please report this to SteveW@ACM.org rem=%u dst=%p\n", (unsigned)rem, dst); 564 printk(KERN_DEBUG "DECnet: dn_nsp_do_disc: BUG! Please report this to SteveW@ACM.org rem=%u dst=%p\n", dn_ntohs(rem), dst);
565 return; 565 return;
566 } 566 }
567 567
@@ -570,11 +570,11 @@ static __inline__ void dn_nsp_do_disc(struct sock *sk, unsigned char msgflg,
570 570
571 msg = skb_put(skb, size); 571 msg = skb_put(skb, size);
572 *msg++ = msgflg; 572 *msg++ = msgflg;
573 *(__u16 *)msg = rem; 573 *(__le16 *)msg = rem;
574 msg += 2; 574 msg += 2;
575 *(__u16 *)msg = loc; 575 *(__le16 *)msg = loc;
576 msg += 2; 576 msg += 2;
577 *(__u16 *)msg = dn_htons(reason); 577 *(__le16 *)msg = dn_htons(reason);
578 msg += 2; 578 msg += 2;
579 if (msgflg == NSP_DISCINIT) 579 if (msgflg == NSP_DISCINIT)
580 *msg++ = ddl; 580 *msg++ = ddl;
@@ -600,10 +600,10 @@ void dn_nsp_send_disc(struct sock *sk, unsigned char msgflg,
600 int ddl = 0; 600 int ddl = 0;
601 601
602 if (msgflg == NSP_DISCINIT) 602 if (msgflg == NSP_DISCINIT)
603 ddl = scp->discdata_out.opt_optl; 603 ddl = dn_ntohs(scp->discdata_out.opt_optl);
604 604
605 if (reason == 0) 605 if (reason == 0)
606 reason = scp->discdata_out.opt_status; 606 reason = dn_ntohs(scp->discdata_out.opt_status);
607 607
608 dn_nsp_do_disc(sk, msgflg, reason, gfp, sk->sk_dst_cache, ddl, 608 dn_nsp_do_disc(sk, msgflg, reason, gfp, sk->sk_dst_cache, ddl,
609 scp->discdata_out.opt_data, scp->addrrem, scp->addrloc); 609 scp->discdata_out.opt_data, scp->addrrem, scp->addrloc);
@@ -708,7 +708,7 @@ void dn_nsp_send_conninit(struct sock *sk, unsigned char msgflg)
708 if (aux > 0) 708 if (aux > 0)
709 memcpy(skb_put(skb, aux), scp->accessdata.acc_acc, aux); 709 memcpy(skb_put(skb, aux), scp->accessdata.acc_acc, aux);
710 710
711 aux = scp->conndata_out.opt_optl; 711 aux = (__u8)dn_ntohs(scp->conndata_out.opt_optl);
712 *skb_put(skb, 1) = aux; 712 *skb_put(skb, 1) = aux;
713 if (aux > 0) 713 if (aux > 0)
714 memcpy(skb_put(skb,aux), scp->conndata_out.opt_data, aux); 714 memcpy(skb_put(skb,aux), scp->conndata_out.opt_data, aux);
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
index 3407f190afe8..d7037fe3cafe 100644
--- a/net/decnet/dn_route.c
+++ b/net/decnet/dn_route.c
@@ -133,9 +133,9 @@ static struct dst_ops dn_dst_ops = {
133 .entries = ATOMIC_INIT(0), 133 .entries = ATOMIC_INIT(0),
134}; 134};
135 135
136static __inline__ unsigned dn_hash(unsigned short src, unsigned short dst) 136static __inline__ unsigned dn_hash(__le16 src, __le16 dst)
137{ 137{
138 unsigned short tmp = src ^ dst; 138 __u16 tmp = (__u16 __force)(src ^ dst);
139 tmp ^= (tmp >> 3); 139 tmp ^= (tmp >> 3);
140 tmp ^= (tmp >> 5); 140 tmp ^= (tmp >> 5);
141 tmp ^= (tmp >> 10); 141 tmp ^= (tmp >> 10);
@@ -379,9 +379,9 @@ static int dn_return_short(struct sk_buff *skb)
379{ 379{
380 struct dn_skb_cb *cb; 380 struct dn_skb_cb *cb;
381 unsigned char *ptr; 381 unsigned char *ptr;
382 dn_address *src; 382 __le16 *src;
383 dn_address *dst; 383 __le16 *dst;
384 dn_address tmp; 384 __le16 tmp;
385 385
386 /* Add back headers */ 386 /* Add back headers */
387 skb_push(skb, skb->data - skb->nh.raw); 387 skb_push(skb, skb->data - skb->nh.raw);
@@ -394,9 +394,9 @@ static int dn_return_short(struct sk_buff *skb)
394 ptr = skb->data + 2; 394 ptr = skb->data + 2;
395 *ptr++ = (cb->rt_flags & ~DN_RT_F_RQR) | DN_RT_F_RTS; 395 *ptr++ = (cb->rt_flags & ~DN_RT_F_RQR) | DN_RT_F_RTS;
396 396
397 dst = (dn_address *)ptr; 397 dst = (__le16 *)ptr;
398 ptr += 2; 398 ptr += 2;
399 src = (dn_address *)ptr; 399 src = (__le16 *)ptr;
400 ptr += 2; 400 ptr += 2;
401 *ptr = 0; /* Zero hop count */ 401 *ptr = 0; /* Zero hop count */
402 402
@@ -475,7 +475,8 @@ static int dn_route_rx_packet(struct sk_buff *skb)
475 struct dn_skb_cb *cb = DN_SKB_CB(skb); 475 struct dn_skb_cb *cb = DN_SKB_CB(skb);
476 printk(KERN_DEBUG 476 printk(KERN_DEBUG
477 "DECnet: dn_route_rx_packet: rt_flags=0x%02x dev=%s len=%d src=0x%04hx dst=0x%04hx err=%d type=%d\n", 477 "DECnet: dn_route_rx_packet: rt_flags=0x%02x dev=%s len=%d src=0x%04hx dst=0x%04hx err=%d type=%d\n",
478 (int)cb->rt_flags, devname, skb->len, cb->src, cb->dst, 478 (int)cb->rt_flags, devname, skb->len,
479 dn_ntohs(cb->src), dn_ntohs(cb->dst),
479 err, skb->pkt_type); 480 err, skb->pkt_type);
480 } 481 }
481 482
@@ -505,7 +506,7 @@ static int dn_route_rx_long(struct sk_buff *skb)
505 506
506 /* Destination info */ 507 /* Destination info */
507 ptr += 2; 508 ptr += 2;
508 cb->dst = dn_htons(dn_eth2dn(ptr)); 509 cb->dst = dn_eth2dn(ptr);
509 if (memcmp(ptr, dn_hiord_addr, 4) != 0) 510 if (memcmp(ptr, dn_hiord_addr, 4) != 0)
510 goto drop_it; 511 goto drop_it;
511 ptr += 6; 512 ptr += 6;
@@ -513,7 +514,7 @@ static int dn_route_rx_long(struct sk_buff *skb)
513 514
514 /* Source info */ 515 /* Source info */
515 ptr += 2; 516 ptr += 2;
516 cb->src = dn_htons(dn_eth2dn(ptr)); 517 cb->src = dn_eth2dn(ptr);
517 if (memcmp(ptr, dn_hiord_addr, 4) != 0) 518 if (memcmp(ptr, dn_hiord_addr, 4) != 0)
518 goto drop_it; 519 goto drop_it;
519 ptr += 6; 520 ptr += 6;
@@ -541,9 +542,9 @@ static int dn_route_rx_short(struct sk_buff *skb)
541 skb_pull(skb, 5); 542 skb_pull(skb, 5);
542 skb->h.raw = skb->data; 543 skb->h.raw = skb->data;
543 544
544 cb->dst = *(dn_address *)ptr; 545 cb->dst = *(__le16 *)ptr;
545 ptr += 2; 546 ptr += 2;
546 cb->src = *(dn_address *)ptr; 547 cb->src = *(__le16 *)ptr;
547 ptr += 2; 548 ptr += 2;
548 cb->hops = *ptr & 0x3f; 549 cb->hops = *ptr & 0x3f;
549 550
@@ -575,7 +576,7 @@ int dn_route_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type
575{ 576{
576 struct dn_skb_cb *cb; 577 struct dn_skb_cb *cb;
577 unsigned char flags = 0; 578 unsigned char flags = 0;
578 __u16 len = dn_ntohs(*(__u16 *)skb->data); 579 __u16 len = dn_ntohs(*(__le16 *)skb->data);
579 struct dn_dev *dn = (struct dn_dev *)dev->dn_ptr; 580 struct dn_dev *dn = (struct dn_dev *)dev->dn_ptr;
580 unsigned char padlen = 0; 581 unsigned char padlen = 0;
581 582
@@ -782,7 +783,7 @@ static int dn_rt_bug(struct sk_buff *skb)
782 struct dn_skb_cb *cb = DN_SKB_CB(skb); 783 struct dn_skb_cb *cb = DN_SKB_CB(skb);
783 784
784 printk(KERN_DEBUG "dn_rt_bug: skb from:%04x to:%04x\n", 785 printk(KERN_DEBUG "dn_rt_bug: skb from:%04x to:%04x\n",
785 cb->src, cb->dst); 786 dn_ntohs(cb->src), dn_ntohs(cb->dst));
786 } 787 }
787 788
788 kfree_skb(skb); 789 kfree_skb(skb);
@@ -823,7 +824,7 @@ static int dn_rt_set_next_hop(struct dn_route *rt, struct dn_fib_res *res)
823 return 0; 824 return 0;
824} 825}
825 826
826static inline int dn_match_addr(__u16 addr1, __u16 addr2) 827static inline int dn_match_addr(__le16 addr1, __le16 addr2)
827{ 828{
828 __u16 tmp = dn_ntohs(addr1) ^ dn_ntohs(addr2); 829 __u16 tmp = dn_ntohs(addr1) ^ dn_ntohs(addr2);
829 int match = 16; 830 int match = 16;
@@ -834,9 +835,9 @@ static inline int dn_match_addr(__u16 addr1, __u16 addr2)
834 return match; 835 return match;
835} 836}
836 837
837static __u16 dnet_select_source(const struct net_device *dev, __u16 daddr, int scope) 838static __le16 dnet_select_source(const struct net_device *dev, __le16 daddr, int scope)
838{ 839{
839 __u16 saddr = 0; 840 __le16 saddr = 0;
840 struct dn_dev *dn_db = dev->dn_ptr; 841 struct dn_dev *dn_db = dev->dn_ptr;
841 struct dn_ifaddr *ifa; 842 struct dn_ifaddr *ifa;
842 int best_match = 0; 843 int best_match = 0;
@@ -861,14 +862,14 @@ static __u16 dnet_select_source(const struct net_device *dev, __u16 daddr, int s
861 return saddr; 862 return saddr;
862} 863}
863 864
864static inline __u16 __dn_fib_res_prefsrc(struct dn_fib_res *res) 865static inline __le16 __dn_fib_res_prefsrc(struct dn_fib_res *res)
865{ 866{
866 return dnet_select_source(DN_FIB_RES_DEV(*res), DN_FIB_RES_GW(*res), res->scope); 867 return dnet_select_source(DN_FIB_RES_DEV(*res), DN_FIB_RES_GW(*res), res->scope);
867} 868}
868 869
869static inline __u16 dn_fib_rules_map_destination(__u16 daddr, struct dn_fib_res *res) 870static inline __le16 dn_fib_rules_map_destination(__le16 daddr, struct dn_fib_res *res)
870{ 871{
871 __u16 mask = dnet_make_mask(res->prefixlen); 872 __le16 mask = dnet_make_mask(res->prefixlen);
872 return (daddr&~mask)|res->fi->fib_nh->nh_gw; 873 return (daddr&~mask)|res->fi->fib_nh->nh_gw;
873} 874}
874 875
@@ -892,12 +893,13 @@ static int dn_route_output_slow(struct dst_entry **pprt, const struct flowi *old
892 struct dn_fib_res res = { .fi = NULL, .type = RTN_UNICAST }; 893 struct dn_fib_res res = { .fi = NULL, .type = RTN_UNICAST };
893 int err; 894 int err;
894 int free_res = 0; 895 int free_res = 0;
895 __u16 gateway = 0; 896 __le16 gateway = 0;
896 897
897 if (decnet_debug_level & 16) 898 if (decnet_debug_level & 16)
898 printk(KERN_DEBUG 899 printk(KERN_DEBUG
899 "dn_route_output_slow: dst=%04x src=%04x mark=%d" 900 "dn_route_output_slow: dst=%04x src=%04x mark=%d"
900 " iif=%d oif=%d\n", oldflp->fld_dst, oldflp->fld_src, 901 " iif=%d oif=%d\n", dn_ntohs(oldflp->fld_dst),
902 dn_ntohs(oldflp->fld_src),
901 oldflp->fld_fwmark, loopback_dev.ifindex, oldflp->oif); 903 oldflp->fld_fwmark, loopback_dev.ifindex, oldflp->oif);
902 904
903 /* If we have an output interface, verify its a DECnet device */ 905 /* If we have an output interface, verify its a DECnet device */
@@ -961,8 +963,9 @@ source_ok:
961 if (decnet_debug_level & 16) 963 if (decnet_debug_level & 16)
962 printk(KERN_DEBUG 964 printk(KERN_DEBUG
963 "dn_route_output_slow: initial checks complete." 965 "dn_route_output_slow: initial checks complete."
964 " dst=%o4x src=%04x oif=%d try_hard=%d\n", fl.fld_dst, 966 " dst=%o4x src=%04x oif=%d try_hard=%d\n",
965 fl.fld_src, fl.oif, try_hard); 967 dn_ntohs(fl.fld_dst), dn_ntohs(fl.fld_src),
968 fl.oif, try_hard);
966 969
967 /* 970 /*
968 * N.B. If the kernel is compiled without router support then 971 * N.B. If the kernel is compiled without router support then
@@ -1218,8 +1221,8 @@ static int dn_route_input_slow(struct sk_buff *skb)
1218 struct neighbour *neigh = NULL; 1221 struct neighbour *neigh = NULL;
1219 unsigned hash; 1222 unsigned hash;
1220 int flags = 0; 1223 int flags = 0;
1221 __u16 gateway = 0; 1224 __le16 gateway = 0;
1222 __u16 local_src = 0; 1225 __le16 local_src = 0;
1223 struct flowi fl = { .nl_u = { .dn_u = 1226 struct flowi fl = { .nl_u = { .dn_u =
1224 { .daddr = cb->dst, 1227 { .daddr = cb->dst,
1225 .saddr = cb->src, 1228 .saddr = cb->src,
@@ -1266,7 +1269,7 @@ static int dn_route_input_slow(struct sk_buff *skb)
1266 res.type = RTN_LOCAL; 1269 res.type = RTN_LOCAL;
1267 flags |= RTCF_DIRECTSRC; 1270 flags |= RTCF_DIRECTSRC;
1268 } else { 1271 } else {
1269 __u16 src_map = fl.fld_src; 1272 __le16 src_map = fl.fld_src;
1270 free_res = 1; 1273 free_res = 1;
1271 1274
1272 out_dev = DN_FIB_RES_DEV(res); 1275 out_dev = DN_FIB_RES_DEV(res);
diff --git a/net/decnet/dn_rules.c b/net/decnet/dn_rules.c
index 1060de70bc0c..f2c299dfe030 100644
--- a/net/decnet/dn_rules.c
+++ b/net/decnet/dn_rules.c
@@ -46,11 +46,11 @@ struct dn_fib_rule
46 unsigned char r_action; 46 unsigned char r_action;
47 unsigned char r_dst_len; 47 unsigned char r_dst_len;
48 unsigned char r_src_len; 48 unsigned char r_src_len;
49 dn_address r_src; 49 __le16 r_src;
50 dn_address r_srcmask; 50 __le16 r_srcmask;
51 dn_address r_dst; 51 __le16 r_dst;
52 dn_address r_dstmask; 52 __le16 r_dstmask;
53 dn_address r_srcmap; 53 __le16 r_srcmap;
54 u8 r_flags; 54 u8 r_flags;
55#ifdef CONFIG_DECNET_ROUTE_FWMARK 55#ifdef CONFIG_DECNET_ROUTE_FWMARK
56 u32 r_fwmark; 56 u32 r_fwmark;
@@ -208,8 +208,8 @@ int dn_fib_lookup(const struct flowi *flp, struct dn_fib_res *res)
208{ 208{
209 struct dn_fib_rule *r, *policy; 209 struct dn_fib_rule *r, *policy;
210 struct dn_fib_table *tb; 210 struct dn_fib_table *tb;
211 dn_address saddr = flp->fld_src; 211 __le16 saddr = flp->fld_src;
212 dn_address daddr = flp->fld_dst; 212 __le16 daddr = flp->fld_dst;
213 int err; 213 int err;
214 214
215 read_lock(&dn_fib_rules_lock); 215 read_lock(&dn_fib_rules_lock);
@@ -259,7 +259,7 @@ int dn_fib_lookup(const struct flowi *flp, struct dn_fib_res *res)
259 return -ESRCH; 259 return -ESRCH;
260} 260}
261 261
262unsigned dnet_addr_type(__u16 addr) 262unsigned dnet_addr_type(__le16 addr)
263{ 263{
264 struct flowi fl = { .nl_u = { .dn_u = { .daddr = addr } } }; 264 struct flowi fl = { .nl_u = { .dn_u = { .daddr = addr } } };
265 struct dn_fib_res res; 265 struct dn_fib_res res;
@@ -277,7 +277,7 @@ unsigned dnet_addr_type(__u16 addr)
277 return ret; 277 return ret;
278} 278}
279 279
280__u16 dn_fib_rules_policy(__u16 saddr, struct dn_fib_res *res, unsigned *flags) 280__le16 dn_fib_rules_policy(__le16 saddr, struct dn_fib_res *res, unsigned *flags)
281{ 281{
282 struct dn_fib_rule *r = res->r; 282 struct dn_fib_rule *r = res->r;
283 283
diff --git a/net/decnet/dn_table.c b/net/decnet/dn_table.c
index 6f8b5658cb4e..0ebc46af1bdd 100644
--- a/net/decnet/dn_table.c
+++ b/net/decnet/dn_table.c
@@ -46,7 +46,7 @@ struct dn_zone
46 u32 dz_hashmask; 46 u32 dz_hashmask;
47#define DZ_HASHMASK(dz) ((dz)->dz_hashmask) 47#define DZ_HASHMASK(dz) ((dz)->dz_hashmask)
48 int dz_order; 48 int dz_order;
49 u16 dz_mask; 49 __le16 dz_mask;
50#define DZ_MASK(dz) ((dz)->dz_mask) 50#define DZ_MASK(dz) ((dz)->dz_mask)
51}; 51};
52 52
@@ -84,14 +84,14 @@ static int dn_fib_hash_zombies;
84 84
85static inline dn_fib_idx_t dn_hash(dn_fib_key_t key, struct dn_zone *dz) 85static inline dn_fib_idx_t dn_hash(dn_fib_key_t key, struct dn_zone *dz)
86{ 86{
87 u16 h = ntohs(key.datum)>>(16 - dz->dz_order); 87 u16 h = dn_ntohs(key.datum)>>(16 - dz->dz_order);
88 h ^= (h >> 10); 88 h ^= (h >> 10);
89 h ^= (h >> 6); 89 h ^= (h >> 6);
90 h &= DZ_HASHMASK(dz); 90 h &= DZ_HASHMASK(dz);
91 return *(dn_fib_idx_t *)&h; 91 return *(dn_fib_idx_t *)&h;
92} 92}
93 93
94static inline dn_fib_key_t dz_key(u16 dst, struct dn_zone *dz) 94static inline dn_fib_key_t dz_key(__le16 dst, struct dn_zone *dz)
95{ 95{
96 dn_fib_key_t k; 96 dn_fib_key_t k;
97 k.datum = dst & DZ_MASK(dz); 97 k.datum = dst & DZ_MASK(dz);
@@ -250,7 +250,7 @@ static int dn_fib_nh_match(struct rtmsg *r, struct nlmsghdr *nlh, struct dn_kern
250 250
251 for_nexthops(fi) { 251 for_nexthops(fi) {
252 int attrlen = nhlen - sizeof(struct rtnexthop); 252 int attrlen = nhlen - sizeof(struct rtnexthop);
253 dn_address gw; 253 __le16 gw;
254 254
255 if (attrlen < 0 || (nhlen -= nhp->rtnh_len) < 0) 255 if (attrlen < 0 || (nhlen -= nhp->rtnh_len) < 0)
256 return -EINVAL; 256 return -EINVAL;
@@ -457,7 +457,7 @@ static int dn_fib_table_insert(struct dn_fib_table *tb, struct rtmsg *r, struct
457 457
458 dz_key_0(key); 458 dz_key_0(key);
459 if (rta->rta_dst) { 459 if (rta->rta_dst) {
460 dn_address dst; 460 __le16 dst;
461 memcpy(&dst, rta->rta_dst, 2); 461 memcpy(&dst, rta->rta_dst, 2);
462 if (dst & ~DZ_MASK(dz)) 462 if (dst & ~DZ_MASK(dz))
463 return -EINVAL; 463 return -EINVAL;
@@ -593,7 +593,7 @@ static int dn_fib_table_delete(struct dn_fib_table *tb, struct rtmsg *r, struct
593 593
594 dz_key_0(key); 594 dz_key_0(key);
595 if (rta->rta_dst) { 595 if (rta->rta_dst) {
596 dn_address dst; 596 __le16 dst;
597 memcpy(&dst, rta->rta_dst, 2); 597 memcpy(&dst, rta->rta_dst, 2);
598 if (dst & ~DZ_MASK(dz)) 598 if (dst & ~DZ_MASK(dz))
599 return -EINVAL; 599 return -EINVAL;
diff --git a/net/decnet/sysctl_net_decnet.c b/net/decnet/sysctl_net_decnet.c
index 0e9d2c571165..bda5920215fd 100644
--- a/net/decnet/sysctl_net_decnet.c
+++ b/net/decnet/sysctl_net_decnet.c
@@ -86,9 +86,9 @@ static void strip_it(char *str)
86 * Simple routine to parse an ascii DECnet address 86 * Simple routine to parse an ascii DECnet address
87 * into a network order address. 87 * into a network order address.
88 */ 88 */
89static int parse_addr(dn_address *addr, char *str) 89static int parse_addr(__le16 *addr, char *str)
90{ 90{
91 dn_address area, node; 91 __u16 area, node;
92 92
93 while(*str && !ISNUM(*str)) str++; 93 while(*str && !ISNUM(*str)) str++;
94 94
@@ -139,7 +139,7 @@ static int dn_node_address_strategy(ctl_table *table, int __user *name, int nlen
139 void **context) 139 void **context)
140{ 140{
141 size_t len; 141 size_t len;
142 dn_address addr; 142 __le16 addr;
143 143
144 if (oldval && oldlenp) { 144 if (oldval && oldlenp) {
145 if (get_user(len, oldlenp)) 145 if (get_user(len, oldlenp))
@@ -147,14 +147,14 @@ static int dn_node_address_strategy(ctl_table *table, int __user *name, int nlen
147 if (len) { 147 if (len) {
148 if (len != sizeof(unsigned short)) 148 if (len != sizeof(unsigned short))
149 return -EINVAL; 149 return -EINVAL;
150 if (put_user(decnet_address, (unsigned short __user *)oldval)) 150 if (put_user(decnet_address, (__le16 __user *)oldval))
151 return -EFAULT; 151 return -EFAULT;
152 } 152 }
153 } 153 }
154 if (newval && newlen) { 154 if (newval && newlen) {
155 if (newlen != sizeof(unsigned short)) 155 if (newlen != sizeof(unsigned short))
156 return -EINVAL; 156 return -EINVAL;
157 if (get_user(addr, (unsigned short __user *)newval)) 157 if (get_user(addr, (__le16 __user *)newval))
158 return -EFAULT; 158 return -EFAULT;
159 159
160 dn_dev_devices_off(); 160 dn_dev_devices_off();
@@ -173,7 +173,7 @@ static int dn_node_address_handler(ctl_table *table, int write,
173{ 173{
174 char addr[DN_ASCBUF_LEN]; 174 char addr[DN_ASCBUF_LEN];
175 size_t len; 175 size_t len;
176 dn_address dnaddr; 176 __le16 dnaddr;
177 177
178 if (!*lenp || (*ppos && !write)) { 178 if (!*lenp || (*ppos && !write)) {
179 *lenp = 0; 179 *lenp = 0;