From: Vincent Bernat Date: Thu, 5 Dec 2013 20:37:04 +0000 (+0100) Subject: lldp: do not send system description TLV if empty X-Git-Tag: 0.7.8~62 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d798504262549e68c9a1801687bbcef907b21699;p=thirdparty%2Flldpd.git lldp: do not send system description TLV if empty This makes this TLV optional to send (as authorized in 802.1AB). The user just has to provide an empty TLV, with, for example `-S ""`. --- diff --git a/src/daemon/lldp.c b/src/daemon/lldp.c index 38403aa9..6e5806ad 100644 --- a/src/daemon/lldp.c +++ b/src/daemon/lldp.c @@ -129,12 +129,14 @@ lldp_send(struct lldpd *global, POKE_END_LLDP_TLV)) goto toobig; - /* System description */ - if (!( - POKE_START_LLDP_TLV(LLDP_TLV_SYSTEM_DESCR) && - POKE_BYTES(chassis->c_descr, strlen(chassis->c_descr)) && - POKE_END_LLDP_TLV)) - goto toobig; + /* System description (skip it if empty) */ + if (chassis->c_descr && *chassis->c_descr != '\0') { + if (!( + POKE_START_LLDP_TLV(LLDP_TLV_SYSTEM_DESCR) && + POKE_BYTES(chassis->c_descr, strlen(chassis->c_descr)) && + POKE_END_LLDP_TLV)) + goto toobig; + } /* System capabilities */ if (!(