From 5cff94399d39016790921552a13719214cb46d73 Mon Sep 17 00:00:00 2001 From: "Brian J. Murrell" Date: Wed, 13 Dec 2017 07:48:01 -0500 Subject: [PATCH] foolsm: Add package foolsm Signed-off-by: Brian J. Murrell --- net/foolsm/Makefile | 55 ++++++++++++++++++ net/foolsm/files/connections.conf | 13 +++++ net/foolsm/files/foolsm.conf | 43 ++++++++++++++ net/foolsm/files/foolsm.init | 19 +++++++ net/foolsm/files/foolsm_script | 57 +++++++++++++++++++ .../patches/100-plugin-export-dir.patch | 11 ++++ net/foolsm/patches/110-missing-WAIT_ANY.patch | 11 ++++ 7 files changed, 209 insertions(+) create mode 100644 net/foolsm/Makefile create mode 100644 net/foolsm/files/connections.conf create mode 100644 net/foolsm/files/foolsm.conf create mode 100644 net/foolsm/files/foolsm.init create mode 100644 net/foolsm/files/foolsm_script create mode 100644 net/foolsm/patches/100-plugin-export-dir.patch create mode 100644 net/foolsm/patches/110-missing-WAIT_ANY.patch diff --git a/net/foolsm/Makefile b/net/foolsm/Makefile new file mode 100644 index 000000000..43c1d1d04 --- /dev/null +++ b/net/foolsm/Makefile @@ -0,0 +1,55 @@ +# +# Copyright (C) 2010-2011 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:=foolsm +PKG_VERSION:=1.0.10 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://lsm.foobar.fi/download +PKG_HASH:=33210209ca38b3bfef1a9180f765266a134fc811dea8bc06450a3bd48d1d083e + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/foolsm + SECTION:=net + CATEGORY:=Network + DEPENDS:=+ssmtp + TITLE:=A link state monitor + URL:=http://lsm.foobar.fi/ +endef + +define Package/foolsm/description + foolsm 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/foolsm/conffiles +/etc/foolsm/foolsm.conf +endef + +define Package/foolsm/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/foolsm $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/foolsm/script.d + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_DATA) ./files/connections.conf $(1)/etc/foolsm/connections.conf + $(INSTALL_DATA) ./files/foolsm.conf $(1)/etc/foolsm/foolsm.conf + $(INSTALL_BIN) ./files/foolsm_script $(1)/etc/foolsm/script + $(INSTALL_BIN) ./files/foolsm.init $(1)/etc/init.d/foolsm +endef + +define Package/foolsm/conffiles +/etc/foolsm/connections.conf +/etc/foolsm/foolsm.conf +endef + +$(eval $(call BuildPackage,foolsm)) diff --git a/net/foolsm/files/connections.conf b/net/foolsm/files/connections.conf new file mode 100644 index 000000000..087a895e7 --- /dev/null +++ b/net/foolsm/files/connections.conf @@ -0,0 +1,13 @@ +connection { + name=Provider1 + checkip=1.1.1.1 + device=pppoe-wan + ttl=2 +} + +connection { + name=Provider2 + checkip=2.2.2.2 + device=eth0.2 + ttl=1 +} diff --git a/net/foolsm/files/foolsm.conf b/net/foolsm/files/foolsm.conf new file mode 100644 index 000000000..db3db91fd --- /dev/null +++ b/net/foolsm/files/foolsm.conf @@ -0,0 +1,43 @@ +# +# (C) 2009 Mika Ilmaranta +# +# 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 +# reopen_on_enodev=1 + +# +# Defaults for the connection entries +# +defaults { + name=defaults + checkip=127.0.0.1 + eventscript=/etc/foolsm/script + notifyscript= + max_packet_loss=20 + 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/foolsm/connections.conf + +#EOF diff --git a/net/foolsm/files/foolsm.init b/net/foolsm/files/foolsm.init new file mode 100644 index 000000000..9c4b61f40 --- /dev/null +++ b/net/foolsm/files/foolsm.init @@ -0,0 +1,19 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2010-2011 OpenWrt.org + +START=45 + +SERVICE_USE_PID=1 +SERVICE_PID_FILE=/var/run/foolsm.pid + +start() { + service_start /usr/sbin/foolsm -c /etc/foolsm/foolsm.conf -p $SERVICE_PID_FILE +} + +stop() { + service_stop /usr/sbin/foolsm +} + +reload() { + service_reload /usr/sbin/foolsm +} diff --git a/net/foolsm/files/foolsm_script b/net/foolsm/files/foolsm_script new file mode 100644 index 000000000..07c4ada12 --- /dev/null +++ b/net/foolsm/files/foolsm_script @@ -0,0 +1,57 @@ +#!/bin/sh +# +# (C) 2009 Mika Ilmaranta +# (C) 2009 Tom Eastep +# +# License: GPLv2 +# + +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 <= 9 && errno != ECHILD) + syslog(LOG_ERR, "%s: %s: %d: waitpid failed %s", __FILE__, __FUNCTION__, __LINE__, strerror(errno));