aboutsummaryrefslogtreecommitdiffstats
path: root/net/decnet/dn_nsp_in.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/dn_nsp_in.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/dn_nsp_in.c')
-rw-r--r--net/decnet/dn_nsp_in.c28
1 files changed, 14 insertions, 14 deletions
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;