From 600b9681a782f796858229b3519267f3810610a2 Mon Sep 17 00:00:00 2001 From: Oryon Date: Tue, 18 Aug 2015 05:28:32 -0700 Subject: [PATCH] pimbd: First package release --- pimbd/Makefile | 48 +++++++++++++++++++++++++++++++++++++ pimbd/files/firewall-uci.sh | 22 +++++++++++++++++ pimbd/files/pimbd.init | 21 ++++++++++++++++ 3 files changed, 91 insertions(+) create mode 100644 pimbd/Makefile create mode 100644 pimbd/files/firewall-uci.sh create mode 100644 pimbd/files/pimbd.init diff --git a/pimbd/Makefile b/pimbd/Makefile new file mode 100644 index 0000000..55aec74 --- /dev/null +++ b/pimbd/Makefile @@ -0,0 +1,48 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=pimbd +PKG_SOURCE_VERSION:=68f5fc803119e4b33a88b35c096f4d6ac28b6de5 +PKG_VERSION:=2015-08-18-$(PKG_SOURCE_VERSION) +PKG_RELEASE:=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/Oryon/pimbd.git +PKG_MAINTAINER:=Pierre Pfister +PKG_LICENSE:=Apache-2.0 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk + +# Spammy debug builds for now +CMAKE_OPTIONS += -DL_LEVEL=7 + +define Package/pimbd + SECTION:=net + CATEGORY:=Network + TITLE:=PIM BIDIR daemon + URL:=https://github.com/Oryon/pimbd.git + DEPENDS+=+@IPV6 + DEPENDS+=netifd +endef + +define Package/pimbd/description +This package provides a daemon which implements the Protocol Independent +Multicast BIDIR routing protocol. Note that a routing protocol must be +installed and running in order for PIM to function. +endef + +define Package/pimbd/install + $(INSTALL_DIR) $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/pimbd $(1)/usr/sbin/pimbd + $(INSTALL_BIN) $(PKG_BUILD_DIR)/generic/pimbc.sh $(1)/usr/sbin/pimbc + ln -s pimbd $(1)/usr/sbin/pimb-ipc + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/pimbd.init $(1)/etc/init.d/pimbd + $(INSTALL_DIR) $(1)/etc/uci-defaults + $(INSTALL_BIN) files/firewall-uci.sh $(1)/etc/uci-defaults/99_pimbd_firewall +endef + +$(eval $(call BuildPackage,pimbd)) diff --git a/pimbd/files/firewall-uci.sh b/pimbd/files/firewall-uci.sh new file mode 100644 index 0000000..5ee20b3 --- /dev/null +++ b/pimbd/files/firewall-uci.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +pim_rule () { +uci -q batch <<-EOT + delete firewall.$1 + set firewall.$1=rule + set firewall.$1.name='$2 multicast forward for $3' + set firewall.$1.src='*' + set firewall.$1.dest='*' + set firewall.$1.family='$2' + set firewall.$1.proto='udp' + set firewall.$1.dest_ip='$3' + set firewall.$1.target='ACCEPT' +EOT +} + +pim_rule pimbd4 ipv4 224.0.0.0/4 +pim_rule pimbd6 ipv6 ff00::/8 +uci commit firewall + +exit 0 + diff --git a/pimbd/files/pimbd.init b/pimbd/files/pimbd.init new file mode 100644 index 0000000..20b27bd --- /dev/null +++ b/pimbd/files/pimbd.init @@ -0,0 +1,21 @@ +#!/bin/sh /etc/rc.common + +START=90 +STOP=10 +USE_PROCD=1 + +start_service() { + . /lib/functions.sh + . /lib/functions/network.sh + config_load pimb + + procd_open_instance + procd_set_param command /usr/sbin/pimbd + procd_append_param command -S + procd_append_param command -L 6 + + procd_set_param respawn + procd_close_instance +} + + -- 2.30.2