From: Vincent Bernat Date: Sat, 6 Dec 2014 22:48:47 +0000 (+0100) Subject: lldpd: use a macro to define offset of permanent port info X-Git-Tag: 0.7.13~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=28414fbdbefb6cd7a4830364f2f20fad297c36ed;p=thirdparty%2Flldpd.git lldpd: use a macro to define offset of permanent port info --- diff --git a/src/daemon/lldpd.c b/src/daemon/lldpd.c index 9ec7ac7c..437efc2b 100644 --- a/src/daemon/lldpd.c +++ b/src/daemon/lldpd.c @@ -299,7 +299,7 @@ lldpd_reset_timer(struct lldpd *cfg) u_int32_t cksum; u_int8_t *output = NULL; ssize_t output_len; - char save[offsetof(struct lldpd_port, p_id_subtype)]; + char save[LLDPD_PORT_START_MARKER]; memcpy(save, port, sizeof(save)); /* coverity[suspicious_sizeof] We intentionally partially memset port */ diff --git a/src/lldpd-structs.h b/src/lldpd-structs.h index 5455e9cc..e9727681 100644 --- a/src/lldpd-structs.h +++ b/src/lldpd-structs.h @@ -225,8 +225,8 @@ struct lldpd_port { u_int8_t p_hidden_in:1; /* Considered as hidden for reception */ u_int8_t p_hidden_out:2; /* Considered as hidden for emission */ /* Important: all fields that should be ignored to check if a port has - * been changed should be before p_id_subtype. Check - * `lldpd_reset_timer()`. */ + * been changed should be before this mark. */ +#define LLDPD_PORT_START_MARKER (offsetof(struct lldpd_port, p_id_subtype)) u_int8_t p_id_subtype; char *p_id; int p_id_len;