projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add check for __Static_assert() and asserts on struct sizes
[tinc]
/
src
/
ethernet.h
diff --git
a/src/ethernet.h
b/src/ethernet.h
index
4ef9dab
..
ddb0a7c
100644
(file)
--- a/
src/ethernet.h
+++ b/
src/ethernet.h
@@
-68,6
+68,8
@@
struct ether_header {
};
#endif
};
#endif
+STATIC_ASSERT(sizeof(struct ether_header) == 14, "ether_header has incorrect size");
+
#ifndef HAVE_STRUCT_ARPHDR
struct arphdr {
uint16_t ar_hrd;
#ifndef HAVE_STRUCT_ARPHDR
struct arphdr {
uint16_t ar_hrd;
@@
-86,6
+88,8
@@
struct arphdr {
#define ARPOP_NAK 10
#endif
#define ARPOP_NAK 10
#endif
+STATIC_ASSERT(sizeof(struct arphdr) == 8, "arphdr has incorrect size");
+
#ifndef HAVE_STRUCT_ETHER_ARP
struct ether_arp {
struct arphdr ea_hdr;
#ifndef HAVE_STRUCT_ETHER_ARP
struct ether_arp {
struct arphdr ea_hdr;
@@
-101,4
+105,6
@@
struct ether_arp {
#define arp_op ea_hdr.ar_op
#endif
#define arp_op ea_hdr.ar_op
#endif
+STATIC_ASSERT(sizeof(struct ether_arp) == 28, "ether_arp has incorrect size");
+
#endif
#endif