radiotap: Fix compiler issues with packed structures
Replace the Radiotap parser platform.h file with use of helper functions
from utils/common.h to avoid compiler issues with the updated design and
getting pointers to members of packet structs.
Silence the warning about _next_bitmap assignment. This pointer is
dereferenced only with operations that are safe for unaligned access, so
the compiler warning is not helpful here.
__packed might not be defined in this context, so use STRUCT_PACKED from
utils/common.h.
Fixes: e6ac269433
("radiotap: Update radiotap parser")
Signed-off-by: Jouni Malinen <j@w1.fi>
master
parent
fcdf5d93ea
commit
10502ad59f
@ -1,21 +1,18 @@
|
||||
/*
|
||||
* Platform definitions for Radiotap parser
|
||||
* Copyright (c) 2021, Jouni Malinen <j@w1.fi>
|
||||
*
|
||||
* This software may be distributed under the terms of the BSD license.
|
||||
* See README for more details.
|
||||
*/
|
||||
|
||||
#ifndef PLATFORM_H
|
||||
#define PLATFORM_H
|
||||
|
||||
#include "includes.h"
|
||||
#include "common.h"
|
||||
|
||||
#define le16_to_cpu le_to_host16
|
||||
#define le32_to_cpu le_to_host32
|
||||
|
||||
#define get_unaligned(p) \
|
||||
({ \
|
||||
struct packed_dummy_struct { \
|
||||
typeof(*(p)) __val; \
|
||||
} __attribute__((packed)) *__ptr = (void *) (p); \
|
||||
\
|
||||
__ptr->__val; \
|
||||
})
|
||||
#define get_unaligned_le16(p) le16_to_cpu(get_unaligned((le16 *)(p)))
|
||||
#define get_unaligned_le32(p) le32_to_cpu(get_unaligned((le32 *)(p)))
|
||||
#define get_unaligned_le16(p) WPA_GET_LE16((void *) (p))
|
||||
#define get_unaligned_le32(p) WPA_GET_LE32((void *) (p))
|
||||
|
||||
#endif /* PLATFORM_H */
|
||||
|
Loading…
Reference in New Issue