lldpd: add management IP setting
authorDaniel A. Maierhofer <git@damadmai.at>
Wed, 26 Feb 2020 20:44:45 +0000 (21:44 +0100)
committerStijn Tintel <stijn@linux-ipv6.be>
Fri, 8 May 2020 02:54:39 +0000 (05:54 +0300)
add option to set management IP pattern

also add missing 'unconfigure system hostname'

for example pattern '!192.168.1.1' makes it possible that
WAN IP is selected instead of LAN IP

Signed-off-by: Daniel A. Maierhofer <git@damadmai.at>
[grammar and spelling fixes in commit message]
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
package/network/services/lldpd/Makefile
package/network/services/lldpd/files/lldpd.config
package/network/services/lldpd/files/lldpd.init

index 48a39934925596e91c8004b5e294c5c38e6c2a1f..7c006850085b211e1fc47ea9e573af839ba37884 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=lldpd
 PKG_VERSION:=1.0.5
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://media.luffy.cx/files/lldpd
index e16643c1f7154160a5c7db41ebb968bb21eefb7d..5e7c51ba7e593c964d87360197aa272154372623 100644 (file)
@@ -5,7 +5,7 @@ config lldpd config
        option enable_edp 1
 
        option agentxsocket /var/run/agentx.sock
-       
+
        option lldp_class 4
        option lldp_location "2:FR:6:Commercial Rd:3:Roseville:19:4"
 
@@ -13,6 +13,8 @@ config lldpd config
        #option lldp_description "OpenWrt System"
        #option lldp_hostname "Modified Hostname"
 
+       #option lldp_mgmt_ip "!192.168.1.1"
+
        # interfaces to listen on
        list interface "loopback"
        list interface "lan"
index 9fb3a825599555be37e0e57e165cb8453266c658..7a5b25e016047756bb7833647835a4b5e3d7cccd 100644 (file)
@@ -42,11 +42,15 @@ write_lldpd_conf()
                fi
        done
 
+       local lldp_mgmt_ip
+       config_get lldp_mgmt_ip 'config' 'lldp_mgmt_ip'
+
        # Clear out the config file first
        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"
+       [ -n "$lldp_mgmt_ip" ] && echo "configure system ip management pattern" "\"$lldp_mgmt_ip\"" >> "$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
@@ -103,6 +107,8 @@ reload_service() {
                unconfigure lldp custom-tlv
                unconfigure system interface pattern
                unconfigure system description
+               unconfigure system hostname
+               unconfigure system ip management pattern
        EOF
        # Rewrite lldpd.conf
        # If something changed it should be included by the lldpcli call