pimbd: First package release
authorOryon <pierre@darou.fr>
Tue, 18 Aug 2015 12:28:32 +0000 (05:28 -0700)
committerOryon <pierre@darou.fr>
Tue, 18 Aug 2015 12:28:32 +0000 (05:28 -0700)
pimbd/Makefile [new file with mode: 0644]
pimbd/files/firewall-uci.sh [new file with mode: 0644]
pimbd/files/pimbd.init [new file with mode: 0644]

diff --git a/pimbd/Makefile b/pimbd/Makefile
new file mode 100644 (file)
index 0000000..55aec74
--- /dev/null
@@ -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 <pierre.pfister@darou.fr>
+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 (file)
index 0000000..5ee20b3
--- /dev/null
@@ -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 (file)
index 0000000..20b27bd
--- /dev/null
@@ -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
+}
+
+