mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-30 10:39:04 +00:00
lldpd: add option to force SONMP enabled
add option to force SONMP to be enabled even when no peer detected Signed-off-by: Stephen Howell <howels@allthatwemight.be>
This commit is contained in:
parent
1be2088a52
commit
4ac134aa78
@ -79,7 +79,8 @@ ifneq ($(CONFIG_LLDPD_WITH_EDP),y)
|
|||||||
sed -i -e '/edp/d' $(1)/etc/init.d/lldpd $(1)/etc/config/lldpd
|
sed -i -e '/edp/d' $(1)/etc/init.d/lldpd $(1)/etc/config/lldpd
|
||||||
endif
|
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 's/CONFIG_LLDPD_WITH_SONMP=y/CONFIG_LLDPD_WITH_SONMP=n/g' $(1)/etc/init.d/lldpd
|
||||||
|
sed -i -e '/sonmp/d' $(1)/etc/config/lldpd
|
||||||
endif
|
endif
|
||||||
ifneq ($(CONFIG_LLDPD_WITH_SNMP),y)
|
ifneq ($(CONFIG_LLDPD_WITH_SNMP),y)
|
||||||
sed -i -e '/agentxsocket/d' $(1)/etc/init.d/lldpd $(1)/etc/config/lldpd
|
sed -i -e '/agentxsocket/d' $(1)/etc/init.d/lldpd $(1)/etc/config/lldpd
|
||||||
|
@ -7,6 +7,7 @@ STOP=01
|
|||||||
CONFIG_LLDPD_WITH_CDP=y
|
CONFIG_LLDPD_WITH_CDP=y
|
||||||
CONFIG_LLDPD_WITH_FDP=y
|
CONFIG_LLDPD_WITH_FDP=y
|
||||||
CONFIG_LLDPD_WITH_LLDPMED=y
|
CONFIG_LLDPD_WITH_LLDPMED=y
|
||||||
|
CONFIG_LLDPD_WITH_SONMP=y
|
||||||
|
|
||||||
USE_PROCD=1
|
USE_PROCD=1
|
||||||
LLDPDBIN=/usr/sbin/lldpd
|
LLDPDBIN=/usr/sbin/lldpd
|
||||||
@ -57,7 +58,10 @@ get_config_restart_hash() {
|
|||||||
config_get_bool v 'config' 'enable_fdp'; append _string "$v" ","
|
config_get_bool v 'config' 'enable_fdp'; append _string "$v" ","
|
||||||
config_get_bool v 'config' 'force_fdp'; append _string "$v" ","
|
config_get_bool v 'config' 'force_fdp'; append _string "$v" ","
|
||||||
fi
|
fi
|
||||||
|
if [ "$CONFIG_LLDPD_WITH_SONMP" == "y" ]; then
|
||||||
config_get_bool v 'config' 'enable_sonmp'; append _string "$v" ","
|
config_get_bool v 'config' 'enable_sonmp'; append _string "$v" ","
|
||||||
|
config_get_bool v 'config' 'force_sonmp'; append _string "$v" ","
|
||||||
|
fi
|
||||||
|
|
||||||
_hash=`echo -n "${_string}" | md5sum | awk '{ print \$1 }'`
|
_hash=`echo -n "${_string}" | md5sum | awk '{ print \$1 }'`
|
||||||
export -n "$var=$_hash"
|
export -n "$var=$_hash"
|
||||||
@ -150,6 +154,7 @@ start_service() {
|
|||||||
local enable_fdp
|
local enable_fdp
|
||||||
local force_fdp
|
local force_fdp
|
||||||
local enable_sonmp
|
local enable_sonmp
|
||||||
|
local force_sonmp
|
||||||
local enable_edp
|
local enable_edp
|
||||||
local lldp_class
|
local lldp_class
|
||||||
local lldp_location
|
local lldp_location
|
||||||
@ -172,7 +177,10 @@ start_service() {
|
|||||||
config_get_bool enable_fdp 'config' 'enable_fdp' 0
|
config_get_bool enable_fdp 'config' 'enable_fdp' 0
|
||||||
config_get_bool force_fdp 'config' 'force_fdp' 0
|
config_get_bool force_fdp 'config' 'force_fdp' 0
|
||||||
fi
|
fi
|
||||||
|
if [ "$CONFIG_LLDPD_WITH_SONMP" == "y" ]; then
|
||||||
config_get_bool enable_sonmp 'config' 'enable_sonmp' 0
|
config_get_bool enable_sonmp 'config' 'enable_sonmp' 0
|
||||||
|
config_get_bool force_sonmp 'config' 'force_sonmp' 0
|
||||||
|
fi
|
||||||
config_get_bool enable_edp 'config' 'enable_edp' 0
|
config_get_bool enable_edp 'config' 'enable_edp' 0
|
||||||
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'
|
||||||
@ -236,8 +244,18 @@ start_service() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ $enable_sonmp -gt 0 ] && procd_append_param command '-s'
|
if [ "$CONFIG_LLDPD_WITH_SONMP" == "y" ] && [ $enable_sonmp -gt 0 ]; then
|
||||||
|
if [ $force_sonmp -gt 0 ]; then
|
||||||
|
# SONMP enabled and forced
|
||||||
|
procd_append_param command '-ss'
|
||||||
|
else
|
||||||
|
# SONMP enabled
|
||||||
|
procd_append_param command '-s'
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
[ $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'
|
||||||
[ $lldp_no_version -gt 0 ] && procd_append_param commanpackage/network/services/lldpd/Makefile package/network/services/lldpd/files/lldpd.initd '-k'
|
[ $lldp_no_version -gt 0 ] && procd_append_param commanpackage/network/services/lldpd/Makefile package/network/services/lldpd/files/lldpd.initd '-k'
|
||||||
[ "$CONFIG_LLDPD_WITH_LLDPMED" == "y" ] && [ $lldpmed_no_inventory -gt 0 ] && procd_append_param command '-i'
|
[ "$CONFIG_LLDPD_WITH_LLDPMED" == "y" ] && [ $lldpmed_no_inventory -gt 0 ] && procd_append_param command '-i'
|
||||||
|
Loading…
Reference in New Issue
Block a user