aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wan
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2007-12-12 21:50:18 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2007-12-14 16:54:38 -0500
commit6f229d76b4c4a7fae601ea9398b23c2b426ab3b9 (patch)
tree5b3a89235c9b27aeeba84c36f16b40acd3e0a6dc /drivers/net/wan
parent98eb5683fb94c458b3c8d121797bc9aa1baf4e7e (diff)
[SYNCPPP]: Endianness and 64bit fixes.
* trivial annotations * long != 32bit, use __be32 * wrong endianness in sending CISCO_ADDR_REPLY Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/wan')
-rw-r--r--drivers/net/wan/syncppp.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/drivers/net/wan/syncppp.c b/drivers/net/wan/syncppp.c
index 232ecba5340f..61e24b7a45a3 100644
--- a/drivers/net/wan/syncppp.c
+++ b/drivers/net/wan/syncppp.c
@@ -107,24 +107,24 @@
107struct ppp_header { 107struct ppp_header {
108 u8 address; 108 u8 address;
109 u8 control; 109 u8 control;
110 u16 protocol; 110 __be16 protocol;
111}; 111};
112#define PPP_HEADER_LEN sizeof (struct ppp_header) 112#define PPP_HEADER_LEN sizeof (struct ppp_header)
113 113
114struct lcp_header { 114struct lcp_header {
115 u8 type; 115 u8 type;
116 u8 ident; 116 u8 ident;
117 u16 len; 117 __be16 len;
118}; 118};
119#define LCP_HEADER_LEN sizeof (struct lcp_header) 119#define LCP_HEADER_LEN sizeof (struct lcp_header)
120 120
121struct cisco_packet { 121struct cisco_packet {
122 u32 type; 122 __be32 type;
123 u32 par1; 123 __be32 par1;
124 u32 par2; 124 __be32 par2;
125 u16 rel; 125 __be16 rel;
126 u16 time0; 126 __be16 time0;
127 u16 time1; 127 __be16 time1;
128}; 128};
129#define CISCO_PACKET_LEN 18 129#define CISCO_PACKET_LEN 18
130#define CISCO_BIG_PACKET_LEN 20 130#define CISCO_BIG_PACKET_LEN 20
@@ -139,7 +139,7 @@ static struct sk_buff_head tx_queue;
139static void sppp_keepalive (unsigned long dummy); 139static void sppp_keepalive (unsigned long dummy);
140static void sppp_cp_send (struct sppp *sp, u16 proto, u8 type, 140static void sppp_cp_send (struct sppp *sp, u16 proto, u8 type,
141 u8 ident, u16 len, void *data); 141 u8 ident, u16 len, void *data);
142static void sppp_cisco_send (struct sppp *sp, int type, long par1, long par2); 142static void sppp_cisco_send (struct sppp *sp, int type, u32 par1, u32 par2);
143static void sppp_lcp_input (struct sppp *sp, struct sk_buff *m); 143static void sppp_lcp_input (struct sppp *sp, struct sk_buff *m);
144static void sppp_cisco_input (struct sppp *sp, struct sk_buff *m); 144static void sppp_cisco_input (struct sppp *sp, struct sk_buff *m);
145static void sppp_ipcp_input (struct sppp *sp, struct sk_buff *m); 145static void sppp_ipcp_input (struct sppp *sp, struct sk_buff *m);
@@ -447,7 +447,7 @@ static void sppp_keepalive (unsigned long dummy)
447 sppp_cisco_send (sp, CISCO_KEEPALIVE_REQ, ++sp->pp_seq, 447 sppp_cisco_send (sp, CISCO_KEEPALIVE_REQ, ++sp->pp_seq,
448 sp->pp_rseq); 448 sp->pp_rseq);
449 else if (sp->lcp.state == LCP_STATE_OPENED) { 449 else if (sp->lcp.state == LCP_STATE_OPENED) {
450 long nmagic = htonl (sp->lcp.magic); 450 __be32 nmagic = htonl (sp->lcp.magic);
451 sp->lcp.echoid = ++sp->pp_seq; 451 sp->lcp.echoid = ++sp->pp_seq;
452 sppp_cp_send (sp, PPP_LCP, LCP_ECHO_REQ, 452 sppp_cp_send (sp, PPP_LCP, LCP_ECHO_REQ,
453 sp->lcp.echoid, 4, &nmagic); 453 sp->lcp.echoid, 4, &nmagic);
@@ -667,7 +667,7 @@ badreq:
667 dev->name, len); 667 dev->name, len);
668 break; 668 break;
669 } 669 }
670 if (ntohl (*(long*)(h+1)) == sp->lcp.magic) { 670 if (ntohl (*(__be32*)(h+1)) == sp->lcp.magic) {
671 /* Line loopback mode detected. */ 671 /* Line loopback mode detected. */
672 printk (KERN_WARNING "%s: loopback\n", dev->name); 672 printk (KERN_WARNING "%s: loopback\n", dev->name);
673 if_down (dev); 673 if_down (dev);
@@ -680,7 +680,7 @@ badreq:
680 sppp_lcp_open (sp); 680 sppp_lcp_open (sp);
681 break; 681 break;
682 } 682 }
683 *(long*)(h+1) = htonl (sp->lcp.magic); 683 *(__be32 *)(h+1) = htonl (sp->lcp.magic);
684 sppp_cp_send (sp, PPP_LCP, LCP_ECHO_REPLY, h->ident, len-4, h+1); 684 sppp_cp_send (sp, PPP_LCP, LCP_ECHO_REPLY, h->ident, len-4, h+1);
685 break; 685 break;
686 case LCP_ECHO_REPLY: 686 case LCP_ECHO_REPLY:
@@ -692,7 +692,7 @@ badreq:
692 dev->name, len); 692 dev->name, len);
693 break; 693 break;
694 } 694 }
695 if (ntohl (*(long*)(h+1)) != sp->lcp.magic) 695 if (ntohl(*(__be32 *)(h+1)) != sp->lcp.magic)
696 sp->pp_alivecnt = 0; 696 sp->pp_alivecnt = 0;
697 break; 697 break;
698 } 698 }
@@ -765,7 +765,7 @@ static void sppp_cisco_input (struct sppp *sp, struct sk_buff *skb)
765 { 765 {
766 struct in_device *in_dev; 766 struct in_device *in_dev;
767 struct in_ifaddr *ifa; 767 struct in_ifaddr *ifa;
768 __be32 addr = 0, mask = ~0; /* FIXME: is the mask correct? */ 768 __be32 addr = 0, mask = htonl(~0U); /* FIXME: is the mask correct? */
769#ifdef CONFIG_INET 769#ifdef CONFIG_INET
770 rcu_read_lock(); 770 rcu_read_lock();
771 if ((in_dev = __in_dev_get_rcu(dev)) != NULL) 771 if ((in_dev = __in_dev_get_rcu(dev)) != NULL)
@@ -782,8 +782,7 @@ static void sppp_cisco_input (struct sppp *sp, struct sk_buff *skb)
782 } 782 }
783 rcu_read_unlock(); 783 rcu_read_unlock();
784#endif 784#endif
785 /* I hope both addr and mask are in the net order */ 785 sppp_cisco_send (sp, CISCO_ADDR_REPLY, ntohl(addr), ntohl(mask));
786 sppp_cisco_send (sp, CISCO_ADDR_REPLY, addr, mask);
787 break; 786 break;
788 } 787 }
789 } 788 }
@@ -844,7 +843,7 @@ static void sppp_cp_send (struct sppp *sp, u16 proto, u8 type,
844 * Send Cisco keepalive packet. 843 * Send Cisco keepalive packet.
845 */ 844 */
846 845
847static void sppp_cisco_send (struct sppp *sp, int type, long par1, long par2) 846static void sppp_cisco_send (struct sppp *sp, int type, u32 par1, u32 par2)
848{ 847{
849 struct ppp_header *h; 848 struct ppp_header *h;
850 struct cisco_packet *ch; 849 struct cisco_packet *ch;
@@ -868,7 +867,7 @@ static void sppp_cisco_send (struct sppp *sp, int type, long par1, long par2)
868 ch->type = htonl (type); 867 ch->type = htonl (type);
869 ch->par1 = htonl (par1); 868 ch->par1 = htonl (par1);
870 ch->par2 = htonl (par2); 869 ch->par2 = htonl (par2);
871 ch->rel = -1; 870 ch->rel = htons(0xffff);
872 ch->time0 = htons ((u16) (t >> 16)); 871 ch->time0 = htons ((u16) (t >> 16));
873 ch->time1 = htons ((u16) t); 872 ch->time1 = htons ((u16) t);
874 873