From: Baptiste Daroussin Date: Wed, 12 Aug 2015 12:40:45 +0000 (+0200) Subject: cdp: make the default platform name really the kernel name X-Git-Tag: 0.7.17~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fc37317f7cd2259fb37ae0fe3dae2a810638f3cd;p=thirdparty%2Flldpd.git 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. --- 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)) &&