aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pppoe.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2007-08-23 02:55:33 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:52:04 -0400
commitb963dc1df78399a2166c2e6e3eb726a2dc98cf11 (patch)
tree5a14d7d2cf9bebaaa1591c457fc30a42c3000b6d /drivers/net/pppoe.c
parent53c03f5c9e3c05a2484ad6bb1d88c0aa54befa47 (diff)
pppoe: endianness
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/pppoe.c')
-rw-r--r--drivers/net/pppoe.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c
index ba2eb04aac9f..d48b7b73d896 100644
--- a/drivers/net/pppoe.c
+++ b/drivers/net/pppoe.c
@@ -103,7 +103,7 @@ static inline int cmp_2_addr(struct pppoe_addr *a, struct pppoe_addr *b)
103 (memcmp(a->remote, b->remote, ETH_ALEN) == 0)); 103 (memcmp(a->remote, b->remote, ETH_ALEN) == 0));
104} 104}
105 105
106static inline int cmp_addr(struct pppoe_addr *a, unsigned long sid, char *addr) 106static inline int cmp_addr(struct pppoe_addr *a, __be16 sid, char *addr)
107{ 107{
108 return (a->sid == sid && 108 return (a->sid == sid &&
109 (memcmp(a->remote,addr,ETH_ALEN) == 0)); 109 (memcmp(a->remote,addr,ETH_ALEN) == 0));
@@ -113,7 +113,7 @@ static inline int cmp_addr(struct pppoe_addr *a, unsigned long sid, char *addr)
113#error 8 must be a multiple of PPPOE_HASH_BITS 113#error 8 must be a multiple of PPPOE_HASH_BITS
114#endif 114#endif
115 115
116static int hash_item(unsigned int sid, unsigned char *addr) 116static int hash_item(__be16 sid, unsigned char *addr)
117{ 117{
118 unsigned char hash = 0; 118 unsigned char hash = 0;
119 unsigned int i; 119 unsigned int i;
@@ -122,7 +122,7 @@ static int hash_item(unsigned int sid, unsigned char *addr)
122 hash ^= addr[i]; 122 hash ^= addr[i];
123 } 123 }
124 for (i = 0 ; i < sizeof(sid_t)*8 ; i += 8 ){ 124 for (i = 0 ; i < sizeof(sid_t)*8 ; i += 8 ){
125 hash ^= sid>>i; 125 hash ^= (__force __u32)sid>>i;
126 } 126 }
127 for (i = 8 ; (i>>=1) >= PPPOE_HASH_BITS ; ) { 127 for (i = 8 ; (i>>=1) >= PPPOE_HASH_BITS ; ) {
128 hash ^= hash>>i; 128 hash ^= hash>>i;
@@ -139,7 +139,7 @@ static struct pppox_sock *item_hash_table[PPPOE_HASH_SIZE];
139 * Set/get/delete/rehash items (internal versions) 139 * Set/get/delete/rehash items (internal versions)
140 * 140 *
141 **********************************************************************/ 141 **********************************************************************/
142static struct pppox_sock *__get_item(unsigned long sid, unsigned char *addr, int ifindex) 142static struct pppox_sock *__get_item(__be16 sid, unsigned char *addr, int ifindex)
143{ 143{
144 int hash = hash_item(sid, addr); 144 int hash = hash_item(sid, addr);
145 struct pppox_sock *ret; 145 struct pppox_sock *ret;
@@ -171,7 +171,7 @@ static int __set_item(struct pppox_sock *po)
171 return 0; 171 return 0;
172} 172}
173 173
174static struct pppox_sock *__delete_item(unsigned long sid, char *addr, int ifindex) 174static struct pppox_sock *__delete_item(__be16 sid, char *addr, int ifindex)
175{ 175{
176 int hash = hash_item(sid, addr); 176 int hash = hash_item(sid, addr);
177 struct pppox_sock *ret, **src; 177 struct pppox_sock *ret, **src;
@@ -197,7 +197,7 @@ static struct pppox_sock *__delete_item(unsigned long sid, char *addr, int ifind
197 * Set/get/delete/rehash items 197 * Set/get/delete/rehash items
198 * 198 *
199 **********************************************************************/ 199 **********************************************************************/
200static inline struct pppox_sock *get_item(unsigned long sid, 200static inline struct pppox_sock *get_item(__be16 sid,
201 unsigned char *addr, int ifindex) 201 unsigned char *addr, int ifindex)
202{ 202{
203 struct pppox_sock *po; 203 struct pppox_sock *po;
@@ -224,7 +224,7 @@ static inline struct pppox_sock *get_item_by_addr(struct sockaddr_pppox *sp)
224 return get_item(sp->sa_addr.pppoe.sid, sp->sa_addr.pppoe.remote, ifindex); 224 return get_item(sp->sa_addr.pppoe.sid, sp->sa_addr.pppoe.remote, ifindex);
225} 225}
226 226
227static inline struct pppox_sock *delete_item(unsigned long sid, char *addr, int ifindex) 227static inline struct pppox_sock *delete_item(__be16 sid, char *addr, int ifindex)
228{ 228{
229 struct pppox_sock *ret; 229 struct pppox_sock *ret;
230 230
@@ -400,7 +400,7 @@ static int pppoe_rcv(struct sk_buff *skb,
400 400
401 ph = pppoe_hdr(skb); 401 ph = pppoe_hdr(skb);
402 402
403 po = get_item((unsigned long) ph->sid, eth_hdr(skb)->h_source, dev->ifindex); 403 po = get_item(ph->sid, eth_hdr(skb)->h_source, dev->ifindex);
404 if (po != NULL) 404 if (po != NULL)
405 return sk_receive_skb(sk_pppox(po), skb, 0); 405 return sk_receive_skb(sk_pppox(po), skb, 0);
406drop: 406drop:
@@ -437,7 +437,7 @@ static int pppoe_disc_rcv(struct sk_buff *skb,
437 if (ph->code != PADT_CODE) 437 if (ph->code != PADT_CODE)
438 goto abort; 438 goto abort;
439 439
440 po = get_item((unsigned long) ph->sid, eth_hdr(skb)->h_source, dev->ifindex); 440 po = get_item(ph->sid, eth_hdr(skb)->h_source, dev->ifindex);
441 if (po) { 441 if (po) {
442 struct sock *sk = sk_pppox(po); 442 struct sock *sk = sk_pppox(po);
443 443