lldpd: add Net-SNMP AgentX support
Enabling this makes it possible to query LLDP neighbors via SNMP. Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be> Acked-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
0d3dc16931
commit
046606a05e
4 changed files with 15 additions and 2 deletions
|
@ -51,4 +51,8 @@ config LLDPD_WITH_JSON
|
||||||
prompt "Enable JSON output for the LLDP Command-Line Interface"
|
prompt "Enable JSON output for the LLDP Command-Line Interface"
|
||||||
default n
|
default n
|
||||||
|
|
||||||
|
config LLDPD_WITH_SNMP
|
||||||
|
bool
|
||||||
|
default n
|
||||||
|
prompt "Enable the use of SNMP"
|
||||||
endmenu
|
endmenu
|
||||||
|
|
|
@ -31,7 +31,7 @@ define Package/lldpd
|
||||||
SUBMENU:=Routing and Redirection
|
SUBMENU:=Routing and Redirection
|
||||||
TITLE:=Link Layer Discovery Protocol daemon
|
TITLE:=Link Layer Discovery Protocol daemon
|
||||||
URL:=https://github.com/vincentbernat/lldpd/wiki
|
URL:=https://github.com/vincentbernat/lldpd/wiki
|
||||||
DEPENDS:=+libevent2 +USE_GLIBC:libbsd +LLDPD_WITH_JSON:libjson-c
|
DEPENDS:=+libevent2 +USE_GLIBC:libbsd +LLDPD_WITH_JSON:libjson-c +LLDPD_WITH_SNMP:libnetsnmp
|
||||||
USERID:=lldp=121:lldp=129
|
USERID:=lldp=121:lldp=129
|
||||||
MENU:=1
|
MENU:=1
|
||||||
endef
|
endef
|
||||||
|
@ -78,6 +78,9 @@ endif
|
||||||
ifneq ($(CONFIG_LLDPD_WITH_SONMP),y)
|
ifneq ($(CONFIG_LLDPD_WITH_SONMP),y)
|
||||||
sed -i -e '/sonmp/d' $(1)/etc/init.d/lldpd $(1)/etc/config/lldpd
|
sed -i -e '/sonmp/d' $(1)/etc/init.d/lldpd $(1)/etc/config/lldpd
|
||||||
endif
|
endif
|
||||||
|
ifneq ($(CONFIG_LLDPD_WITH_SNMP),y)
|
||||||
|
sed -i -e '/agentxsocket/d' $(1)/etc/init.d/lldpd $(1)/etc/config/lldpd
|
||||||
|
endif
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/lldpd/conffiles
|
define Package/lldpd/conffiles
|
||||||
|
@ -103,7 +106,8 @@ CONFIGURE_ARGS += \
|
||||||
$(if $(CONFIG_LLDPD_WITH_DOT3),,--disable-dot3) \
|
$(if $(CONFIG_LLDPD_WITH_DOT3),,--disable-dot3) \
|
||||||
$(if $(CONFIG_LLDPD_WITH_CUSTOM),,--disable-custom) \
|
$(if $(CONFIG_LLDPD_WITH_CUSTOM),,--disable-custom) \
|
||||||
$(if $(CONFIG_LLDPD_WITH_SONMP),,--disable-sonmp) \
|
$(if $(CONFIG_LLDPD_WITH_SONMP),,--disable-sonmp) \
|
||||||
$(if $(CONFIG_LLDPD_WITH_JSON),--with-json=json-c,--with-json=no)
|
$(if $(CONFIG_LLDPD_WITH_JSON),--with-json=json-c,--with-json=no) \
|
||||||
|
$(if $(CONFIG_LLDPD_WITH_SNMP),--with-snmp,)
|
||||||
|
|
||||||
|
|
||||||
$(eval $(call BuildPackage,lldpd))
|
$(eval $(call BuildPackage,lldpd))
|
||||||
|
|
|
@ -3,6 +3,8 @@ config lldpd config
|
||||||
option enable_fdp 1
|
option enable_fdp 1
|
||||||
option enable_sonmp 1
|
option enable_sonmp 1
|
||||||
option enable_edp 1
|
option enable_edp 1
|
||||||
|
|
||||||
|
option agentxsocket /var/run/agentx.sock
|
||||||
|
|
||||||
option lldp_class 4
|
option lldp_class 4
|
||||||
option lldp_location "2:FR:6:Commercial Rd:3:Roseville:19:4"
|
option lldp_location "2:FR:6:Commercial Rd:3:Roseville:19:4"
|
||||||
|
|
|
@ -57,6 +57,7 @@ start_service() {
|
||||||
local lldp_class
|
local lldp_class
|
||||||
local lldp_location
|
local lldp_location
|
||||||
local readonly_mode
|
local readonly_mode
|
||||||
|
local agentxsocket
|
||||||
|
|
||||||
config_load 'lldpd'
|
config_load 'lldpd'
|
||||||
config_get_bool enable_cdp 'config' 'enable_cdp' 0
|
config_get_bool enable_cdp 'config' 'enable_cdp' 0
|
||||||
|
@ -66,6 +67,7 @@ start_service() {
|
||||||
config_get lldp_class 'config' 'lldp_class'
|
config_get lldp_class 'config' 'lldp_class'
|
||||||
config_get lldp_location 'config' 'lldp_location'
|
config_get lldp_location 'config' 'lldp_location'
|
||||||
config_get_bool readonly_mode 'config' 'readonly_mode' 0
|
config_get_bool readonly_mode 'config' 'readonly_mode' 0
|
||||||
|
config_get agentxsocket 'config' 'agentxsocket'
|
||||||
|
|
||||||
mkdir -p /var/run/lldp
|
mkdir -p /var/run/lldp
|
||||||
chown lldp:lldp /var/run/lldp
|
chown lldp:lldp /var/run/lldp
|
||||||
|
@ -83,6 +85,7 @@ start_service() {
|
||||||
[ $enable_edp -gt 0 ] && procd_append_param command '-e'
|
[ $enable_edp -gt 0 ] && procd_append_param command '-e'
|
||||||
[ $readonly_mode -gt 0 ] && procd_append_param command '-r'
|
[ $readonly_mode -gt 0 ] && procd_append_param command '-r'
|
||||||
[ -n "$lldp_class" ] && procd_append_param command -M "$lldp_class"
|
[ -n "$lldp_class" ] && procd_append_param command -M "$lldp_class"
|
||||||
|
[ -n "$agentxsocket" ] && procd_append_param command -x -X "$agentxsocket"
|
||||||
|
|
||||||
# set auto respawn behavior
|
# set auto respawn behavior
|
||||||
procd_set_param respawn
|
procd_set_param respawn
|
||||||
|
|
Loading…
Reference in a new issue