lldpd: add option to edit hostname
authorLucian Cristian <lucian.cristian@gmail.com>
Thu, 9 May 2019 21:19:07 +0000 (00:19 +0300)
committerChristian Lamparter <chunkeey@gmail.com>
Sat, 11 May 2019 14:37:11 +0000 (16:37 +0200)
also fixes the annoying repeating syslog
lldp[]: unable to get system name

Signed-off-by: Lucian Cristian <lucian.cristian@gmail.com>
package/network/services/lldpd/files/lldpd.config
package/network/services/lldpd/files/lldpd.init

index 36b43c89da1f9285a5a51c224736207ec0049399..e16643c1f7154160a5c7db41ebb968bb21eefb7d 100644 (file)
@@ -11,6 +11,7 @@ config lldpd config
 
        # if empty, the distribution description is sent
        #option lldp_description "OpenWrt System"
+       #option lldp_hostname "Modified Hostname"
 
        # interfaces to listen on
        list interface "loopback"
index c3d9ba05062fe08bfca5e48742fe9ac7f0317d2b..bc429de484d3f7b47cc557585364aa00fe850673 100644 (file)
@@ -28,6 +28,9 @@ write_lldpd_conf()
        config_load 'lldpd'
        config_get lldp_description 'config' 'lldp_description' "$(find_release_info)"
 
+       local lldp_hostname
+       config_get lldp_hostname 'config' 'lldp_hostname' "$(cat /proc/sys/kernel/hostname)"
+
        local ifaces
        config_get ifaces 'config' 'interface'
 
@@ -43,6 +46,7 @@ write_lldpd_conf()
        echo -n > "$LLDPD_CONF"
        [ -n "$ifnames" ] && echo "configure system interface pattern" "$ifnames" >> "$LLDPD_CONF"
        [ -n "$lldp_description" ] && echo "configure system description" "\"$lldp_description\"" >> "$LLDPD_CONF"
+       [ -n "$lldp_hostname" ] && echo "configure system hostname" "\"$lldp_hostname\"" >> "$LLDPD_CONF"
 
        # Since lldpd's sysconfdir is /tmp, we'll symlink /etc/lldpd.d to /tmp/$LLDPD_CONFS_DIR
        [ -e $LLDPD_CONFS_DIR ] || ln -s /etc/lldpd.d $LLDPD_CONFS_DIR