fatal("localchassis", "failed to set minimal system description");
}
}
+ if (cfg->g_config.c_platform == NULL)
+ cfg->g_config.c_platform = strdup(un.sysname);
/* Check routing */
if (lldpd_routing_enabled(cfg)) {
#if defined (ENABLE_CDP) || defined (ENABLE_FDP)
-#include <sys/utsname.h>
-
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
cdp_send(struct lldpd *global,
struct lldpd_hardware *hardware, int version)
{
- const char *platform;
- struct utsname utsname;
+ const char *platform = "Unknown";
struct lldpd_chassis *chassis;
struct lldpd_mgmt *mgmt;
struct lldpd_port *port;
goto toobig;
/* Platform */
- if (global && global->g_config.c_platform)
- platform = global->g_config.c_platform;
- else {
- uname(&utsname);
- platform = utsname.sysname;
- }
+ if (global && global->g_config.c_platform) platform = global->g_config.c_platform;
if (!(
POKE_START_CDP_TLV(CDP_TLV_PLATFORM) &&
struct packet *pkt;
in_addr_t addr;
struct lldpd_mgmt *mgmt;
+ struct lldpd cfg = {
+ .g_config = {
+ .c_platform = "Linux"
+ }
+ };
/* Populate port and chassis */
hardware.h_lport.p_id_subtype = LLDP_PORTID_SUBTYPE_IFNAME;
TAILQ_INSERT_TAIL(&chassis.c_mgmt, mgmt, m_entries);
/* Build packet */
- n = cdpv1_send(NULL, &hardware);
+ n = cdpv1_send(&cfg, &hardware);
if (n != 0) {
fail("unable to build packet");
return;
in_addr_t addr2;
struct lldpd_mgmt *mgmt1;
struct lldpd_mgmt *mgmt2;
+ struct lldpd cfg = {
+ .g_config = {
+ .c_platform = "Linux"
+ }
+ };
/* Populate port and chassis */
hardware.h_lport.p_id_subtype = LLDP_PORTID_SUBTYPE_LLADDR;
TAILQ_INSERT_TAIL(&chassis.c_mgmt, mgmt2, m_entries);
/* Build packet */
- n = cdpv2_send(NULL, &hardware);
+ n = cdpv2_send(&cfg, &hardware);
if (n != 0) {
fail("unable to build packet");
return;