From fc37317f7cd2259fb37ae0fe3dae2a810638f3cd Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Wed, 12 Aug 2015 14:40:45 +0200 Subject: [PATCH] cdp: make the default platform name really the kernel name Instead of hardcoding 'Linux" directly query the kernel name of the user is not overwriting it. --- src/daemon/protocols/cdp.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/daemon/protocols/cdp.c b/src/daemon/protocols/cdp.c index cc6f8318..86013e61 100644 --- a/src/daemon/protocols/cdp.c +++ b/src/daemon/protocols/cdp.c @@ -21,6 +21,8 @@ #if defined (ENABLE_CDP) || defined (ENABLE_FDP) +#include + #include #include #include @@ -31,7 +33,8 @@ static int cdp_send(struct lldpd *global, struct lldpd_hardware *hardware, int version) { - const char *platform = "Linux"; + const char *platform; + struct utsname utsname; struct lldpd_chassis *chassis; struct lldpd_mgmt *mgmt; struct lldpd_port *port; @@ -198,7 +201,13 @@ cdp_send(struct lldpd *global, goto toobig; /* Platform */ - if (global && global->g_config.c_platform) platform = global->g_config.c_platform; + if (global && global->g_config.c_platform) + platform = global->g_config.c_platform; + else { + uname(&utsname); + platform = utsname.sysname; + } + if (!( POKE_START_CDP_TLV(CDP_TLV_PLATFORM) && POKE_BYTES(platform, strlen(platform)) && -- 2.39.5