This adds the lsm package to feeds/packages. It includes a shorewall-lite hook so that if one has lsm and shorewall-lite installed, lsm will cycle shorewall-lite on a link transition.
Signed-off-by: Brian J. Murrell <br...@interlinx.bc.ca> commit ead559262149c4d2d625fda0bb100ea6bd8a7871 Author: Brian J. Murrell <br...@interlinx.bc.ca> Date: Tue Sep 14 11:18:09 2010 -0400 add lsm 0.53 to feeds/packages include support for calling shorewall-lite from LSM to shorewall-lite package diff --git a/net/lsm/Makefile b/net/lsm/Makefile new file mode 100644 index 0000000..c970fc3 --- /dev/null +++ b/net/lsm/Makefile @@ -0,0 +1,58 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=lsm +PKG_VERSION:=0.53 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://lsm.foobar.fi/download +PKG_MD5SUM:=983911b434a3c649fcefdc99e6ea2f37 + +include $(INCLUDE_DIR)/package.mk + +define Package/lsm + SECTION:=net + CATEGORY:=Network + TITLE:=A link state monitor + URL:=http://lsm.foobar.fi/ +endef + +define Package/lsm/description + lsm is a link state monitor for carrying out actions when a link + transistions from the up to down state or vice versa. +endef + +define Package/lsm/conffiles +/etc/lsm/lsm.conf +endef + +define Build/Prepare + $(call Build/Prepare/Default) + rmdir $(PKG_BUILD_DIR) + mv $(BUILD_DIR)/lsm $(PKG_BUILD_DIR) +endef + +define Build/Compile + echo sed -ie 's/\$$$$(CC)/mipsel-openwrt-linux-uclibc-gcc/g' $(PKG_BUILD_DIR)/Makefile + $(MAKE) -C $(PKG_BUILD_DIR) CC=$(TARGET_CC) +endef + +define Package/lsm/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/lsm $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/lsm + $(INSTALL_DIR) $(1)/etc/lsm/script.d + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_DATA) ./files/lsm.conf $(1)/etc/lsm/lsm.conf + $(INSTALL_BIN) ./files/lsm_script $(1)/etc/lsm/script + $(INSTALL_BIN) ./files/lsm.init $(1)/etc/init.d/lsm +endef + +$(eval $(call BuildPackage,lsm)) diff --git a/net/lsm/files/lsm.conf b/net/lsm/files/lsm.conf new file mode 100644 index 0000000..74ab7ad --- /dev/null +++ b/net/lsm/files/lsm.conf @@ -0,0 +1,42 @@ + +# +# (C) 2009 Mika Ilmaranta <il...@nullnet.fi> +# +# License: GPLv2 +# + +# +# Debug level: 0 .. 8 are normal, 9 gives lots of stuff and 100 doesn't +# bother to detach +# +#debug=10 +#debug=9 +debug=8 + +# +# Defaults for the connection entries +# +defaults { + name=defaults + checkip=127.0.0.1 + eventscript=/etc/lsm/script + max_packet_loss=15 + max_successive_pkts_lost=7 + min_packet_loss=5 + min_successive_pkts_rcvd=10 + interval_ms=2000 + timeout_ms=2000 + warn_email=root + check_arp=0 + sourceip= +# if using ping probes for monitoring only then defaults should +# not define a default device for packets to autodiscover their path +# to destination +# device=eth0 +# use system default ttl + ttl=0 +} + +include /etc/lsm/connections.conf + +#EOF diff --git a/net/lsm/files/lsm.init b/net/lsm/files/lsm.init new file mode 100644 index 0000000..e9d3162 --- /dev/null +++ b/net/lsm/files/lsm.init @@ -0,0 +1,12 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org +START=50 + +start() { + lsm /etc/lsm/lsm.conf +} + +stop() { + killall lsm +} + diff --git a/net/lsm/files/lsm_script b/net/lsm/files/lsm_script new file mode 100644 index 0000000..b701c34 --- /dev/null +++ b/net/lsm/files/lsm_script @@ -0,0 +1,66 @@ +#!/bin/sh +# +# (C) 2009 Mika Ilmaranta <il...@nullnet.fi> +# +# License: GPLv2 +# + +# +# default event handling script +# + +DATE=$(/bin/date) + +STATE=${1} +NAME=${2} +CHECKIP=${3} +DEVICE=${4} +WARN_EMAIL=${5} +REPLIED=${6} +WAITING=${7} +TIMEOUT=${8} +REPLY_LATE=${9} +CONS_RCVD=${10} +CONS_WAIT=${11} +CONS_MISS=${12} +AVG_RTT=${13} + +cat <<EOM | mail -s "LSM: ${NAME} ${STATE}, IP ${CHECKIP}" ${WARN_EMAIL} + +Hi, + +Your connection ${NAME} has changed it's state to ${STATE} at ${DATE}. + +Following parameters were passed: +newstate = ${STATE} +name = ${NAME} +checkip = ${CHECKIP} +device = ${DEVICE} +warn_email = ${WARN_EMAIL} + +Packet statuses: +replied = ${REPLIED} packets replied +waiting = ${WAITING} packets waiting for reply +timeout = ${TIMEOUT} packets that have timeout (= packet loss) +reply_late = ${REPLY_LATE} packets that received a reply after timeout +cons_rcvd = ${CONS_RCVD} consecutively received replies in sequence +cons_wait = ${CONS_WAIT} consecutive packets waiting for reply +cons_miss = ${CONS_MISS} consecutive packets that have timed out +avg_rtt = ${AVG_RTT} average rtt [usec], calculated from received packets + +BR, +Your LSM installation + +EOM + +cd /etc/lsm/script.d/ +for script in $(ls); do + if [ ! -x $script ]; then + continue + fi + ./$script "$@" +done + +exit 0; + +#EOF diff --git a/net/shorewall-lite/Makefile b/net/shorewall-lite/Makefile index 8c4ed05..bc98dad 100644 --- a/net/shorewall-lite/Makefile +++ b/net/shorewall-lite/Makefile @@ -49,6 +49,7 @@ endef define Package/shorewall-lite/install $(INSTALL_DIR) $(1)/sbin $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_DIR) $(1)/etc/lsm/script.d $(INSTALL_DIR) $(1)/etc/hotplug.d/iface $(INSTALL_DIR) $(1)/etc/shorewall-lite $(INSTALL_DIR) $(1)/usr/share @@ -57,6 +58,7 @@ define Package/shorewall-lite/install $(INSTALL_BIN) $(PKG_INSTALL_DIR)/sbin/shorewall-lite $(1)/sbin $(CP) $(PKG_INSTALL_DIR)/usr/share/shorewall-lite $(1)/usr/share $(INSTALL_BIN) ./files/hostname $(1)/usr/share/shorewall-lite + $(INSTALL_BIN) ./files/lsm_script $(1)/etc/lsm/script.d/shorewall-lite $(CP) $(PKG_INSTALL_DIR)/etc/shorewall-lite $(1)/etc $(CP) ./files/vardir $(1)/etc/shorewall-lite endef
signature.asc
Description: This is a digitally signed message part
_______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel