mrd6: adopted from packages-feed
authorSteven Barth <steven@midlink.org>
Fri, 14 Mar 2014 08:21:45 +0000 (09:21 +0100)
committerSteven Barth <steven@midlink.org>
Fri, 14 Mar 2014 08:21:45 +0000 (09:21 +0100)
mrd6/Makefile [new file with mode: 0644]
mrd6/files/mrd6.conf [new file with mode: 0644]
mrd6/files/mrd6.init [new file with mode: 0644]
mrd6/patches/002-missing_netlink_defs.patch [new file with mode: 0644]
mrd6/patches/101-Accept-default-routes-without-RTA_DST.patch [new file with mode: 0644]
mrd6/patches/102-Metric-should-be-more-important-than-distance.patch [new file with mode: 0644]

diff --git a/mrd6/Makefile b/mrd6/Makefile
new file mode 100644 (file)
index 0000000..252a151
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Copyright (C) 2006-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:=mrd6
+PKG_SOURCE_VERSION:=c805eb33255dbc0b6647d463c6c67d1c9d3105a0
+PKG_VERSION:=2013-11-30-$(PKG_SOURCE_VERSION)
+PKG_RELEASE:=1
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=git://github.com/hugosantos/mrd6.git
+PKG_MAINTAINER:=Steven Barth <cyrus@openwrt.org>
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+
+PKG_BUILD_PARALLEL:=1
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/mrd6
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=IPv6 multicast routing daemon
+  URL:=http://fivebits.net/proj/mrd6
+  DEPENDS:=@IPV6 +libstdcpp
+endef
+
+define Package/mrd6/description
+ Multicast is becoming a major component in next generation networks, used 
+ in several scenarios, from video broadcasting to multimedia conferencing. 
+ In order to be implemented, new technology needs supporting hardware and 
+ software across a set of devices and systems. MRD6 is an implementation of 
+ a modular IPv6 Multicast Routing Framework for the Linux operating system 
+ and provides MLDv2 (as well as MLDv1), PIM-SM and MBGP support.
+endef
+
+MRD6_MAKEFLAGS:= \
+       $(TARGET_CONFIGURE_OPTS) \
+       OPTIMIZE=yes \
+       SPACE_OPTIMIZE=yes \
+       FULL_STATIC=no \
+       CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) -DNO_INET6_OPTION -fno-builtin -fno-rtti" \
+       LDFLAGS="$(TARGET_LDFLAGS) -ldl -lm" \
+       MODULE_CXX="\$$$$(CC) -shared \$$$$(CXXFLAGS) \$$$$(LDFLAGS)" \
+       DESTDIR="$(PKG_INSTALL_DIR)" \
+       PREFIX="/usr"
+
+define Build/Compile
+       +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/src $(MRD6_MAKEFLAGS) all
+endef
+
+define Build/Install
+       $(MAKE) -C $(PKG_BUILD_DIR)/src $(MRD6_MAKEFLAGS) install
+endef
+
+define Package/mrd6/conffiles
+/etc/mrd6.conf
+endef
+
+define Package/mrd6/install
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_CONF) ./files/mrd6.conf $(1)/etc
+       $(INSTALL_BIN) ./files/mrd6.init $(1)/etc/init.d/mrd6
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/mrd $(1)/usr/sbin/mrd6
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mrd6sh $(1)/usr/bin/mrd6sh
+       $(INSTALL_DIR) $(1)/usr/lib/mrd6
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/mrd6/bgp.so $(1)/usr/lib/mrd6/bgp.so
+endef
+
+$(eval $(call BuildPackage,mrd6))
diff --git a/mrd6/files/mrd6.conf b/mrd6/files/mrd6.conf
new file mode 100644 (file)
index 0000000..e3ad78a
--- /dev/null
@@ -0,0 +1,14 @@
+log {
+       attach stderr normal;
+       attach default "/var/log/mrd6.log" message_err;
+}
+
+//interfaces disable br-lan;  // Should be vlan0 + eth1 but Linux bridge seems broken for multicast
+//interfaces disable eth0; // Interface to internal bridge
+//handle-proper-bridge = true;    // use ETH_P_ALL to see all packets on wrt54g
+
+// The default configured RP is m6bone's Renater RP.
+// Change this according to your setup
+
+groups ff00::/8 pim rp = 2001:660:3007:300:1::;
+
diff --git a/mrd6/files/mrd6.init b/mrd6/files/mrd6.init
new file mode 100644 (file)
index 0000000..2481840
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=50
+
+start() {
+       service_start /usr/sbin/mrd6 -f /etc/mrd6.conf -D
+}
+
+stop() {
+       service_stop /usr/sbin/mrd6
+}
+
diff --git a/mrd6/patches/002-missing_netlink_defs.patch b/mrd6/patches/002-missing_netlink_defs.patch
new file mode 100644 (file)
index 0000000..28ab711
--- /dev/null
@@ -0,0 +1,58 @@
+Index: mrd6-0.9.5/include/mrdpriv/linux/netlink_missing_defs.h
+===================================================================
+--- /dev/null  1970-01-01 00:00:00.000000000 +0000
++++ mrd6-0.9.5/include/mrdpriv/linux/netlink_missing_defs.h    2007-09-21 13:19:06.000000000 +0200
+@@ -0,0 +1,41 @@
++#include <linux/version.h>
++
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
++
++#include <linux/if_link.h>
++#include <linux/if_addr.h>
++#include <linux/neighbour.h>
++
++#ifndef IFA_RTA
++#define IFA_RTA(r) \
++       ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifaddrmsg))))
++#endif
++#ifndef IFA_PAYLOAD
++#define IFA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifaddrmsg))
++#endif
++
++#ifndef IFLA_RTA
++#define IFLA_RTA(r) \
++       ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifinfomsg))))
++#endif
++#ifndef IFLA_PAYLOAD
++#define IFLA_PAYLOAD(n)        NLMSG_PAYLOAD(n,sizeof(struct ifinfomsg))
++#endif
++
++#ifndef NDA_RTA
++#define NDA_RTA(r) \
++       ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ndmsg))))
++#endif
++#ifndef NDA_PAYLOAD
++#define NDA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ndmsg))
++#endif
++
++#ifndef NDTA_RTA
++#define NDTA_RTA(r) \
++       ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ndtmsg))))
++#endif
++#ifndef NDTA_PAYLOAD
++#define NDTA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ndtmsg))
++#endif
++
++#endif
+Index: mrd6-0.9.5/src/linux/linux_unicast_route.cpp
+===================================================================
+--- mrd6-0.9.5.orig/src/linux/linux_unicast_route.cpp  2007-09-21 13:19:05.000000000 +0200
++++ mrd6-0.9.5/src/linux/linux_unicast_route.cpp       2007-09-21 13:19:06.000000000 +0200
+@@ -23,6 +23,7 @@
+  */
+ #include <mrdpriv/linux/unicast_route.h>
++#include <mrdpriv/linux/netlink_missing_defs.h>
+ #include <mrd/mrd.h>
+ #include <mrd/interface.h>
diff --git a/mrd6/patches/101-Accept-default-routes-without-RTA_DST.patch b/mrd6/patches/101-Accept-default-routes-without-RTA_DST.patch
new file mode 100644 (file)
index 0000000..660e707
--- /dev/null
@@ -0,0 +1,34 @@
+From b70c7d519ddd178b76d89bca7d3fe1fd186af862 Mon Sep 17 00:00:00 2001
+From: Oryon <pierre@darou.fr>
+Date: Tue, 11 Mar 2014 12:12:07 +0100
+Subject: [PATCH 1/2] Accept default routes without RTA_DST
+
+---
+ src/linux/linux_unicast_route.cpp | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/linux/linux_unicast_route.cpp b/src/linux/linux_unicast_route.cpp
+index 331a7a0..7919cc2 100644
+--- a/src/linux/linux_unicast_route.cpp
++++ b/src/linux/linux_unicast_route.cpp
+@@ -334,7 +334,7 @@ void linux_unicast_router::handle_route_event(bool isnew, nlmsghdr *hdr) {
+       netlink_msg::parse_rtatable(tb, RTA_MAX, RTM_RTA(NLMSG_DATA(hdr)),
+                               hdr->nlmsg_len - NLMSG_LENGTH(sizeof(rtmsg)));
+-      if (tb[RTA_DST]) {
++      //if (tb[RTA_DST]) { /* Accept default routes */
+               lookup_result res;
+               parse_prefix_rec(tb, msg->r.rtm_dst_len,
+@@ -360,7 +360,7 @@ void linux_unicast_router::handle_route_event(bool isnew, nlmsghdr *hdr) {
+               }
+               prefix_changed(isnew, res);
+-      }
++      //}
+ }
+ void linux_unicast_router::handle_intf_event(bool isnew, nlmsghdr *hdr) {
+-- 
+1.9.0
+
diff --git a/mrd6/patches/102-Metric-should-be-more-important-than-distance.patch b/mrd6/patches/102-Metric-should-be-more-important-than-distance.patch
new file mode 100644 (file)
index 0000000..359f671
--- /dev/null
@@ -0,0 +1,38 @@
+From 46093914a5f95f50c9aef088b7172d6774d204cb Mon Sep 17 00:00:00 2001
+From: Oryon <pierre@darou.fr>
+Date: Tue, 11 Mar 2014 16:03:58 +0100
+Subject: [PATCH 2/2] Metric should be more important than distance at lookup
+
+---
+ src/mrib.cpp | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/src/mrib.cpp b/src/mrib.cpp
+index e51fed7..707d601 100644
+--- a/src/mrib.cpp
++++ b/src/mrib.cpp
+@@ -327,16 +327,16 @@ mrib_def::mrib_node *mrib_def::prefix_lookup_y(const inet6_addr &source) const {
+ void mrib_def::insert_prefix_in_node(mrib_node *n, prefix *p) {
+       prefix *curr = n->head, *prev = 0;
+-      /* first check the proper place based on distance */
+-      while (curr && curr->distance < p->distance) {
++      /* first check the proper place based on metric */
++      while (curr && curr->metric < p->metric) {
+               prev = curr;
+               curr = curr->next;
+       }
+-      if (prev && prev->distance == p->distance) {
+-              /* if distance matches, take metric into place */
++      if (prev && prev->metric == p->metric) {
++              /* if metric matches, take distance into place */
+               curr = prev;
+-              while (curr && curr->metric <= p->metric) {
++              while (curr && curr->distance <= p->distance) {
+                       prev = curr;
+                       curr = curr->next;
+               }
+-- 
+1.9.0
+