aboutsummaryrefslogtreecommitdiffstats
path: root/net/decnet/af_decnet.c
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/decnet/af_decnet.c
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/decnet/af_decnet.c')
-rw-r--r--net/decnet/af_decnet.c16
1 files changed, 8 insertions, 8 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);