1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2008-2012 OpenWrt.org
10 [ -s /etc
/openwrt_release
] && .
/etc
/openwrt_release
11 [ -z "$DISTRIB_DESCRIPTION" ] && [ -s /etc
/openwrt_version
] && \
12 DISTRIB_DESCRIPTION
="$(cat /etc/openwrt_version)"
14 echo "${DISTRIB_DESCRIPTION:-Unknown OpenWrt release} @ $(cat /proc/sys/kernel/hostname)"
18 .
/lib
/functions
/network.sh
26 local lldp_description
29 config_get_bool enable_cdp
'config' 'enable_cdp' 0
30 config_get_bool enable_fdp
'config' 'enable_fdp' 0
31 config_get_bool enable_sonmp
'config' 'enable_sonmp' 0
32 config_get_bool enable_edp
'config' 'enable_edp' 0
33 config_get lldp_class
'config' 'lldp_class'
34 config_get lldp_location
'config' 'lldp_location'
35 config_get lldp_description
'config' 'lldp_description' "$(find_release_info)"
38 config_get ifaces
'config' 'interface'
40 local iface ifnames
=""
41 for iface
in $ifaces; do
43 if network_get_device ifname
"$iface" ||
[ -e "/sys/class/net/$iface" ]; then
44 append ifnames
"${ifname:-$iface}" ","
48 [ -n "$ifnames" ] && append args
"-I $ifnames"
49 [ $enable_cdp -gt 0 ] && append args
'-c'
50 [ $enable_fdp -gt 0 ] && append args
'-f'
51 [ $enable_sonmp -gt 0 ] && append args
'-s'
52 [ $enable_edp -gt 0 ] && append args
'-e'
54 mkdir
-p /var
/run
/lldp
55 chown lldp
:lldp
/var
/run
/lldp
57 service_start
/usr
/sbin
/lldpd
$args \
58 ${lldp_class:+ -M $lldp_class} \
59 ${lldp_description:+ -S "$lldp_description"}
61 [ -n "$lldp_location" ] && {
63 /usr
/sbin
/lldpctl
-L "$lldp_location" > /dev
/null
2>&1
68 service_stop
/usr
/sbin
/lldpd
69 rm -f /var
/run
/lldpd.socket
/var
/run
/lldpd.pid