aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/bnep
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2006-11-08 03:27:36 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-03 00:21:27 -0500
commite41d21697326a38a0a871c515db88fa310177e24 (patch)
tree36a5048080ea2e63e15fe8be51fcb1b830877a42 /net/bluetooth/bnep
parentae08e1f092210619fe49551aa3ed0dc0003d5880 (diff)
[BLUETOOTH] bnep endianness bug: filtering by packet type
<= and => don't work well on net-endian... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bluetooth/bnep')
-rw-r--r--net/bluetooth/bnep/core.c16
-rw-r--r--net/bluetooth/bnep/netdev.c11
2 files changed, 14 insertions, 13 deletions
diff --git a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c
index 4d3424c2421c..4e822f08b87b 100644
--- a/net/bluetooth/bnep/core.c
+++ b/net/bluetooth/bnep/core.c
@@ -117,14 +117,14 @@ static int bnep_send_rsp(struct bnep_session *s, u8 ctrl, u16 resp)
117static inline void bnep_set_default_proto_filter(struct bnep_session *s) 117static inline void bnep_set_default_proto_filter(struct bnep_session *s)
118{ 118{
119 /* (IPv4, ARP) */ 119 /* (IPv4, ARP) */
120 s->proto_filter[0].start = htons(0x0800); 120 s->proto_filter[0].start = ETH_P_IP;
121 s->proto_filter[0].end = htons(0x0806); 121 s->proto_filter[0].end = ETH_P_ARP;
122 /* (RARP, AppleTalk) */ 122 /* (RARP, AppleTalk) */
123 s->proto_filter[1].start = htons(0x8035); 123 s->proto_filter[1].start = ETH_P_RARP;
124 s->proto_filter[1].end = htons(0x80F3); 124 s->proto_filter[1].end = ETH_P_AARP;
125 /* (IPX, IPv6) */ 125 /* (IPX, IPv6) */
126 s->proto_filter[2].start = htons(0x8137); 126 s->proto_filter[2].start = ETH_P_IPX;
127 s->proto_filter[2].end = htons(0x86DD); 127 s->proto_filter[2].end = ETH_P_IPV6;
128} 128}
129#endif 129#endif
130 130
@@ -150,8 +150,8 @@ static int bnep_ctrl_set_netfilter(struct bnep_session *s, u16 *data, int len)
150 int i; 150 int i;
151 151
152 for (i = 0; i < n; i++) { 152 for (i = 0; i < n; i++) {
153 f[i].start = get_unaligned(data++); 153 f[i].start = ntohs(get_unaligned(data++));
154 f[i].end = get_unaligned(data++); 154 f[i].end = ntohs(get_unaligned(data++));
155 155
156 BT_DBG("proto filter start %d end %d", 156 BT_DBG("proto filter start %d end %d",
157 f[i].start, f[i].end); 157 f[i].start, f[i].end);
diff --git a/net/bluetooth/bnep/netdev.c b/net/bluetooth/bnep/netdev.c
index 7f7b27db6a8f..67a002a9751a 100644
--- a/net/bluetooth/bnep/netdev.c
+++ b/net/bluetooth/bnep/netdev.c
@@ -158,14 +158,15 @@ static inline int bnep_net_mc_filter(struct sk_buff *skb, struct bnep_session *s
158static inline u16 bnep_net_eth_proto(struct sk_buff *skb) 158static inline u16 bnep_net_eth_proto(struct sk_buff *skb)
159{ 159{
160 struct ethhdr *eh = (void *) skb->data; 160 struct ethhdr *eh = (void *) skb->data;
161 u16 proto = ntohs(eh->h_proto);
161 162
162 if (ntohs(eh->h_proto) >= 1536) 163 if (proto >= 1536)
163 return eh->h_proto; 164 return proto;
164 165
165 if (get_unaligned((u16 *) skb->data) == 0xFFFF) 166 if (get_unaligned((__be16 *) skb->data) == htons(0xFFFF))
166 return htons(ETH_P_802_3); 167 return ETH_P_802_3;
167 168
168 return htons(ETH_P_802_2); 169 return ETH_P_802_2;
169} 170}
170 171
171static inline int bnep_net_proto_filter(struct sk_buff *skb, struct bnep_session *s) 172static inline int bnep_net_proto_filter(struct sk_buff *skb, struct bnep_session *s)