]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
lldpd: use a macro to define offset of permanent port info
authorVincent Bernat <vincent@bernat.im>
Sat, 6 Dec 2014 22:48:47 +0000 (23:48 +0100)
committerVincent Bernat <vincent@bernat.im>
Sat, 6 Dec 2014 22:48:47 +0000 (23:48 +0100)
src/daemon/lldpd.c
src/lldpd-structs.h

index 9ec7ac7c8bebd4d2493cd0c15e3e12fe4dce44ac..437efc2bd8138060ebb25a0edfc7477c008ff633 100644 (file)
@@ -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 */
index 5455e9cc382ee98ebd5ef674a47f6798271bb936..e97276813e8b8e6bfa714964b327d13c8f7da0a1 100644 (file)
@@ -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;