Add compile time sanity check for interface name lengths.
Because our interfaces include UNIX domain sockets, we are using UNIX_PATH_MAX of 108 bytes for our interface names. Even though IF_NAMESIZE is much smaller (16 bytes), there is nothing that guarantees this. This patch adds a compile time sanity check that tests whether the interface name will fit. Signed-off-by: Richard Cochran <richardcochran@gmail.com>master
parent
d513ecac9c
commit
20a229e168
4
config.h
4
config.h
|
@ -32,6 +32,10 @@
|
||||||
|
|
||||||
#define MAX_IFNAME_SIZE 108 /* = UNIX_PATH_MAX */
|
#define MAX_IFNAME_SIZE 108 /* = UNIX_PATH_MAX */
|
||||||
|
|
||||||
|
#if (IF_NAMESIZE > MAX_IFNAME_SIZE)
|
||||||
|
#error if_namesize larger than expected.
|
||||||
|
#endif
|
||||||
|
|
||||||
/** Defines a network interface, with PTP options. */
|
/** Defines a network interface, with PTP options. */
|
||||||
struct interface {
|
struct interface {
|
||||||
STAILQ_ENTRY(interface) list;
|
STAILQ_ENTRY(interface) list;
|
||||||
|
|
Loading…
Reference in New Issue