mac802154: use header operations to create/parse headers
Use the operations on 802.15.4 header structs introduced in a previous patch to create and parse all headers in the mac802154 stack. This patch reduces code duplication between different parts of the mac802154 stack that needed information from headers, and also fixes a few bugs that seem to have gone unnoticed until now: * 802.15.4 dgram sockets would return a slightly incorrect value for the SIOCINQ ioctl * mac802154 would not drop frames with the "security enabled" bit set, even though it does not support security, in violation of the standard Signed-off-by: Phoebe Buckheister <phoebe.buckheister@itwm.fraunhofer.de> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
94b4f6c21c
commit
e6278d9200
@@ -216,23 +216,17 @@ static inline struct ieee802154_mac_cb *mac_cb(struct sk_buff *skb)
|
||||
|
||||
#define MAC_CB_FLAG_ACKREQ (1 << 3)
|
||||
#define MAC_CB_FLAG_SECEN (1 << 4)
|
||||
#define MAC_CB_FLAG_INTRAPAN (1 << 5)
|
||||
|
||||
static inline int mac_cb_is_ackreq(struct sk_buff *skb)
|
||||
static inline bool mac_cb_is_ackreq(struct sk_buff *skb)
|
||||
{
|
||||
return mac_cb(skb)->flags & MAC_CB_FLAG_ACKREQ;
|
||||
}
|
||||
|
||||
static inline int mac_cb_is_secen(struct sk_buff *skb)
|
||||
static inline bool mac_cb_is_secen(struct sk_buff *skb)
|
||||
{
|
||||
return mac_cb(skb)->flags & MAC_CB_FLAG_SECEN;
|
||||
}
|
||||
|
||||
static inline int mac_cb_is_intrapan(struct sk_buff *skb)
|
||||
{
|
||||
return mac_cb(skb)->flags & MAC_CB_FLAG_INTRAPAN;
|
||||
}
|
||||
|
||||
static inline int mac_cb_type(struct sk_buff *skb)
|
||||
{
|
||||
return mac_cb(skb)->flags & MAC_CB_FLAG_TYPEMASK;
|
||||
|
Reference in New Issue
Block a user