--- /dev/null 2009-04-28 19:38:24.265251952 +0200 +++ feeds/packages/net/ladvd/Makefile 2009-05-08 14:48:50.151129057 +0200 @@ -0,0 +1,53 @@ +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=ladvd +PKG_VERSION:=0.6.1 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://blinkenlights.nl/software/ladvd/ +PKG_MD5SUM:=90989dec5200d6cab48dc7a6cff3cbe6 + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install + +include $(INCLUDE_DIR)/package.mk + +define Package/ladvd + SECTION:=net + CATEGORY:=Network + TITLE:=LLDP Advertisement Damon + URL:=http://blinkenlights.nl/software/ladvd/ +endef + +define Package/ladvd/description + ladvd is a cdp / lldp sender for unix. + + ladvd uses cdp / lldp frames to inform switches about connected hosts, + which simplifies ethernet switch management. It does this by creating + a raw socket at startup, and then switching to a non-privileged user for the + remaining runtime. Every 30 seconds it will transmit CDP/LLDP packets + reflecting the current system state. Interfaces (bridge, bonding, wireless), + capabilities (bridging, forwarding, wireless) and addresses (IPv4, IPv6) + are detected dynamically. +endef + +define Package/ladvd/conffiles +/etc/config/ladvd +endef + +define Package/ladvd/install + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/ladvd $(1)/usr/sbin/ + $(INSTALL_BIN) ./files/ladvd.init $(1)/etc/init.d/ladvd + $(INSTALL_DATA) ./files/ladvd.config $(1)/etc/config/ladvd +endef + +$(eval $(call BuildPackage,ladvd)) --- /dev/null 2009-04-28 19:38:24.265251952 +0200 +++ feeds/packages/net/ladvd/files/ladvd.config 2009-05-08 10:58:07.545879833 +0200 @@ -0,0 +1,6 @@ +config ladvdd config + option enable_cdp 0 + option enable_lldp 1 + + option country "DE" + option location "Home" --- /dev/null 2009-04-28 19:38:24.265251952 +0200 +++ feeds/packages/net/ladvd/files/ladvd.init 2009-05-08 10:57:43.486878662 +0200 @@ -0,0 +1,36 @@ +#!/bin/sh /etc/rc.common + +START=90 + +start() { + local enable_cdp + local enable_lldp + local country + local location + local args="-u root" + + config_load ladvd + config_get_bool enable_cdp config enable_cdp + config_get_bool enable_lldp config enable_lldp + config_get country config country + config_get location config location + + [ "$enable_cdp" == 1 ] && append args "-c" + [ "$enable_lldp" == 1 ] && append args "-l" + [ -n "$country" ] && append args "-C $country" + [ -n "$location" ] && append args "-L $location" + + # Check the hostname + nslookup $(cat /proc/sys/kernel/hostname) > /dev/null 2>&1 + if [ $? -eq 0 ]; then + /usr/sbin/ladvd $args + else + echo "Cannot resolve the local hostname $(cat /proc/sys/kernel/hostname), not starting ladvd" + exit 1 + fi + +} + +stop() { + killall ladvd +}