diff options
author | Guy Harris <gharris@sonic.net> | 2020-07-01 02:15:40 -0700 |
---|---|---|
committer | Guy Harris <gharris@sonic.net> | 2020-07-01 02:15:40 -0700 |
commit | 5a68762e8b0cae345e4f42ff2dc4eee9ce32329d (patch) | |
tree | 86aa6ef65f73ee37f2ac80031ae2f81bb2d3c457 /pcap-npf.c | |
parent | 89b721fb41bf47b21662752221a4dd13a464da99 (diff) |
Handle the pcap_t+private data in a fashion that makes fewer assumptions.
The sizeof operator and alignof macro can be given a type "name" that's
anonymous, e.g. sizeof(struct { int a; char *b; }). Have
pcap_create_common() and pcap_open_offline_common() take, as arguments,
the total size of a structure containing both the pcap_t and the private
data as members, and the offset of the private data in that structure,
and define macros that calculate those given, as an argument, the data
type of the private data.
This avoids making assumptions about the alignment of those two items
within the structure; that *might* fix GitHub issue #940 if the issue is
that the ARM compiler being used does 16-byte alignment of the private
structure, rather than the 8-byte alignment we were wiring in.
Diffstat (limited to 'pcap-npf.c')
-rw-r--r-- | pcap-npf.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -1315,7 +1315,7 @@ pcap_create_interface(const char *device _U_, char *ebuf) { pcap_t *p; - p = pcap_create_common(ebuf, sizeof(struct pcap_win)); + p = PCAP_CREATE_COMMON(ebuf, struct pcap_win); if (p == NULL) return (NULL); |