[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>
This commit is contained in:
@@ -158,14 +158,15 @@ static inline int bnep_net_mc_filter(struct sk_buff *skb, struct bnep_session *s
|
||||
static inline u16 bnep_net_eth_proto(struct sk_buff *skb)
|
||||
{
|
||||
struct ethhdr *eh = (void *) skb->data;
|
||||
u16 proto = ntohs(eh->h_proto);
|
||||
|
||||
if (ntohs(eh->h_proto) >= 1536)
|
||||
return eh->h_proto;
|
||||
if (proto >= 1536)
|
||||
return proto;
|
||||
|
||||
if (get_unaligned((u16 *) skb->data) == 0xFFFF)
|
||||
return htons(ETH_P_802_3);
|
||||
if (get_unaligned((__be16 *) skb->data) == htons(0xFFFF))
|
||||
return ETH_P_802_3;
|
||||
|
||||
return htons(ETH_P_802_2);
|
||||
return ETH_P_802_2;
|
||||
}
|
||||
|
||||
static inline int bnep_net_proto_filter(struct sk_buff *skb, struct bnep_session *s)
|
||||
|
Reference in New Issue
Block a user