diff options
author | James <> | 2013-03-17 12:16:37 +0000 |
---|---|---|
committer | James <> | 2013-03-17 12:16:37 +0000 |
commit | 27b76ab0671089c47506615a796a261e993896a7 (patch) | |
tree | 61213d67e7fa87b20356b23798558e2c4212c42f /package/network/ipv6/6relayd | |
download | trunk-36060-master.tar.gz trunk-36060-master.tar.bz2 trunk-36060-master.zip |
Diffstat (limited to 'package/network/ipv6/6relayd')
10 files changed, 647 insertions, 0 deletions
diff --git a/package/network/ipv6/6relayd/.svn/entries b/package/network/ipv6/6relayd/.svn/entries new file mode 100644 index 0000000..f0c85b4 --- /dev/null +++ b/package/network/ipv6/6relayd/.svn/entries @@ -0,0 +1,65 @@ +10 + +dir +36060 +svn://svn.openwrt.org/openwrt/trunk/package/network/ipv6/6relayd +svn://svn.openwrt.org/openwrt + + + +2013-02-28T16:37:20.110304Z +35836 +cyrus + + + + + + + + + + + + + + +3c298f89-4303-0410-b956-a3cf2f4a3e73 + +files +dir + +Makefile +file + + + + +2013-03-17T12:13:19.000000Z +f5afb33903e6de931a3cb199b6df4d25 +2013-02-28T16:37:20.110304Z +35836 +cyrus + + + + + + + + + + + + + + + + + + + + + +1747 + diff --git a/package/network/ipv6/6relayd/.svn/text-base/Makefile.svn-base b/package/network/ipv6/6relayd/.svn/text-base/Makefile.svn-base new file mode 100644 index 0000000..1747a0c --- /dev/null +++ b/package/network/ipv6/6relayd/.svn/text-base/Makefile.svn-base @@ -0,0 +1,57 @@ +# +# Copyright (C) 2012 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:=6relayd +PKG_VERSION:=2013-02-28.1 +PKG_RELEASE=$(PKG_SOURCE_VERSION) + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_URL:=git://github.com/sbyx/6relayd.git +PKG_SOURCE_PROTO:=git +PKG_SOURCE_VERSION:=be18c9722e8fa76ca96de16fb927b85bfe3197bc + +PKG_MAINTAINER:=Steven Barth <steven@midlink.org> + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk + +define Package/6relayd + SECTION:=ipv6 + CATEGORY:=IPv6 + TITLE:=IPv6-Relay and Server (RD-, DHCPv6- & NDP-Proxy) + DEPENDS:=+kmod-ipv6 +endef + +define Package/6relayd/description + 6relayd is an IPv6-tool that relays IPv6-management protocols like router + discovery, neighbor discovery and DHCPv6 so that clients on routed (non- + bridged) interfaces can use the public address prefix, DHCPv6 and DNS-service + of a master interface. This is useful to avoid NAT in chained IPv6-routers. + + It can also be used as a lightweight router advertisement daemon and provide + stateless DHCPv6 service where size matters. +endef + +define Package/6relayd/conffiles +/etc/config/6relayd +endef + +define Package/6relayd/install + $(INSTALL_DIR) $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/6relayd $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/hotplug.d/iface + $(INSTALL_DATA) ./files/6relayd.hotplug $(1)/etc/hotplug.d/iface/30-6relay + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/6relayd.config $(1)/etc/config/6relayd + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/6relayd.init $(1)/etc/init.d/6relayd +endef + +$(eval $(call BuildPackage,6relayd)) diff --git a/package/network/ipv6/6relayd/Makefile b/package/network/ipv6/6relayd/Makefile new file mode 100644 index 0000000..1747a0c --- /dev/null +++ b/package/network/ipv6/6relayd/Makefile @@ -0,0 +1,57 @@ +# +# Copyright (C) 2012 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:=6relayd +PKG_VERSION:=2013-02-28.1 +PKG_RELEASE=$(PKG_SOURCE_VERSION) + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_URL:=git://github.com/sbyx/6relayd.git +PKG_SOURCE_PROTO:=git +PKG_SOURCE_VERSION:=be18c9722e8fa76ca96de16fb927b85bfe3197bc + +PKG_MAINTAINER:=Steven Barth <steven@midlink.org> + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk + +define Package/6relayd + SECTION:=ipv6 + CATEGORY:=IPv6 + TITLE:=IPv6-Relay and Server (RD-, DHCPv6- & NDP-Proxy) + DEPENDS:=+kmod-ipv6 +endef + +define Package/6relayd/description + 6relayd is an IPv6-tool that relays IPv6-management protocols like router + discovery, neighbor discovery and DHCPv6 so that clients on routed (non- + bridged) interfaces can use the public address prefix, DHCPv6 and DNS-service + of a master interface. This is useful to avoid NAT in chained IPv6-routers. + + It can also be used as a lightweight router advertisement daemon and provide + stateless DHCPv6 service where size matters. +endef + +define Package/6relayd/conffiles +/etc/config/6relayd +endef + +define Package/6relayd/install + $(INSTALL_DIR) $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/6relayd $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/hotplug.d/iface + $(INSTALL_DATA) ./files/6relayd.hotplug $(1)/etc/hotplug.d/iface/30-6relay + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/6relayd.config $(1)/etc/config/6relayd + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/6relayd.init $(1)/etc/init.d/6relayd +endef + +$(eval $(call BuildPackage,6relayd)) diff --git a/package/network/ipv6/6relayd/files/.svn/entries b/package/network/ipv6/6relayd/files/.svn/entries new file mode 100644 index 0000000..02e80a3 --- /dev/null +++ b/package/network/ipv6/6relayd/files/.svn/entries @@ -0,0 +1,130 @@ +10 + +dir +36060 +svn://svn.openwrt.org/openwrt/trunk/package/network/ipv6/6relayd/files +svn://svn.openwrt.org/openwrt + + + +2013-02-26T12:50:52.933860Z +35804 +cyrus + + + + + + + + + + + + + + +3c298f89-4303-0410-b956-a3cf2f4a3e73 + +6relayd.hotplug +file + + + + +2013-03-17T12:13:19.000000Z +bd1477ea6cb06081071bc688a0843f8f +2013-01-13T17:25:38.265787Z +35133 +cyrus + + + + + + + + + + + + + + + + + + + + + +131 + +6relayd.init +file + + + + +2013-03-17T12:13:19.000000Z +74a289472660a10ee22b6b98c6e0b0d7 +2013-02-26T12:50:52.933860Z +35804 +cyrus + + + + + + + + + + + + + + + + + + + + + +3388 + +6relayd.config +file + + + + +2013-03-17T12:13:19.000000Z +784924a6963693b36d249277c24374ac +2013-02-26T12:42:53.360009Z +35803 +cyrus + + + + + + + + + + + + + + + + + + + + + +681 + diff --git a/package/network/ipv6/6relayd/files/.svn/text-base/6relayd.config.svn-base b/package/network/ipv6/6relayd/files/.svn/text-base/6relayd.config.svn-base new file mode 100644 index 0000000..a4376c0 --- /dev/null +++ b/package/network/ipv6/6relayd/files/.svn/text-base/6relayd.config.svn-base @@ -0,0 +1,28 @@ +config server default + option master wan6 + list network lan + option rd server + option dhcpv6 server + option fallback_relay 'rd dhcpv6 ndp' + option compat_ula 1 + + +# Example #1: Create a relay for several networks in proxy mode +# This can be used to proxy Router Discovery, DHCPv6 and NDP. + +#config server examplerelay +# option master 'wan' +# option network 'lan' +# option rd 'relay' +# option dhcpv6 'relay' +# option ndp 'relay' + + +# Example #2: Provide Router Discovery and stateless DHCPv6 in server mode +# This can be used as a small radvd and stateless DHCPv6-server replacement. + +#config server exampleserver +# option network 'lan' +# option rd 'server' +# option dhcpv6 'server' + diff --git a/package/network/ipv6/6relayd/files/.svn/text-base/6relayd.hotplug.svn-base b/package/network/ipv6/6relayd/files/.svn/text-base/6relayd.hotplug.svn-base new file mode 100644 index 0000000..7905282 --- /dev/null +++ b/package/network/ipv6/6relayd/files/.svn/text-base/6relayd.hotplug.svn-base @@ -0,0 +1,6 @@ +#!/bin/sh +/etc/init.d/6relayd enabled || exit 0 +[ -n "$INTERFACE" ] || exit 0 + +. /etc/init.d/6relayd +restart_affected "$INTERFACE" diff --git a/package/network/ipv6/6relayd/files/.svn/text-base/6relayd.init.svn-base b/package/network/ipv6/6relayd/files/.svn/text-base/6relayd.init.svn-base new file mode 100644 index 0000000..ef0c711 --- /dev/null +++ b/package/network/ipv6/6relayd/files/.svn/text-base/6relayd.init.svn-base @@ -0,0 +1,135 @@ +#!/bin/sh /etc/rc.common +# Copyright (c) 2011-2012 OpenWrt.org +START=80 + +start_6relayd() { + local cfg="$1" + local mode="$2" + local args="" + + SERVICE_DAEMONIZE=1 + SERVICE_WRITE_PID=1 + SERVICE_PID_FILE="/var/run/6relayd-$cfg.pid" + [ -f "$SERVICE_PID_FILE" ] && { + if grep -q 6relayd "/proc/$(cat $SERVICE_PID_FILE)/cmdline"; then + return 0 + else + rm -f "$SERVICE_PID_FILE" + fi + } + + # Detect master interface + local master masterif + config_get masterif "$cfg" master + network_get_device master "$masterif" + [ -z "$master" ] && master="." + + # Detect slave interfaces + local slaves="" + local slaveifs + config_get slaveifs "$cfg" network + for slaveif in $slaveifs; do + local slave + network_get_device slave "$slaveif" + # Compatibility with old config format + if [ "$mode" = "relay" -a "$master" = "." ]; then + [ -z "$slave" ] && return 0 + master="$slave" + else + [ -n "$slave" ] && append slaves "$slave" + fi + done + + # Bail if no slaves are active + [ -z "$slaves" ] && return 0 + + # Configure services + local rd dhcpv6 ndp + config_get rd "$cfg" rd + config_get dhcpv6 "$cfg" dhcpv6 + config_get ndp "$cfg" ndp + + # Test for fallback mode + local fallback fallback_relay + config_get fallback_relay "$cfg" fallback_relay + + if [ -n "$fallback_relay" -a "$master" != "." ]; then + local prefix + network_get_prefix6 prefix "$masterif" + [ -z "$prefix" ] && fallback=1 + fi + + if [ -n "$fallback" ]; then + for service in $fallback_relay; do + eval "$service=relay" + done + fi + + # Configure feature options + local always_rewrite_dns rewrite_dns_addr + config_get_bool always_rewrite_dns "$cfg" always_rewrite_dns 0 + config_get rewrite_dns_addr "$cfg" rewrite_dns_addr + [ "$always_rewrite_dns" -eq 1 -o -n "$rewrite_dns_addr" ] && append args "-n$rewrite_dns_addr" + + local always_assume_default + config_get_bool always_assume_default "$cfg" always_assume_default 0 + [ "$always_assume_default" -eq 1 ] && append args "-u" + + local compat_ula + config_get_bool compat_ula "$cfg" compat_ula 0 + [ "$compat_ula" -eq 1 ] && append args "-c" + + [ "$ndp" = "relay" ] && append args "-N -s -l" + [ "$rd" = "relay" ] && append args "-Rrelay" + [ "$rd" = "server" ] && append args "-Rserver" + [ "$dhcpv6" = "relay" ] && append args "-Drelay" + [ "$dhcpv6" = "server" ] && append args "-Dserver" + [ "$ndp" != "relay" -a "$rd" != "relay" -a "$dhcpv6" != "relay" ] && master="." + + service_start /usr/sbin/6relayd $args $master $slaves +} + +restart_affected_6relayd() { + local cfg="$1" + local net="$2" + local mode="$3" + + local master slaves + config_get master "$cfg" master + config_get slaves "$cfg" network + + for iface in $master $slaves; do + if [ "$iface" = "$net" ]; then + SERVICE_PID_FILE="/var/run/6relayd-$cfg.pid" + service_stop /usr/sbin/6relayd + rm -f "$SERVICE_PID_FILE" + start_6relayd "$cfg" "$mode" + fi + done +} + +restart_affected() { + . /lib/functions/service.sh + . /lib/functions/network.sh + local net="$1" + config_load 6relayd + config_foreach restart_affected_6relayd server "$net" + config_foreach restart_affected_6relayd relay "$net" "relay" +} + +stop() { + . /lib/functions/service.sh + for pid in /var/run/6relayd-*.pid; do + SERVICE_PID_FILE="$pid" + service_stop /usr/sbin/6relayd + rm -f "$SERVICE_PID_FILE" + done +} + +start() { + . /lib/functions/service.sh + . /lib/functions/network.sh + config_load 6relayd + config_foreach start_6relayd server + config_foreach start_6relayd relay relay +} diff --git a/package/network/ipv6/6relayd/files/6relayd.config b/package/network/ipv6/6relayd/files/6relayd.config new file mode 100644 index 0000000..a4376c0 --- /dev/null +++ b/package/network/ipv6/6relayd/files/6relayd.config @@ -0,0 +1,28 @@ +config server default + option master wan6 + list network lan + option rd server + option dhcpv6 server + option fallback_relay 'rd dhcpv6 ndp' + option compat_ula 1 + + +# Example #1: Create a relay for several networks in proxy mode +# This can be used to proxy Router Discovery, DHCPv6 and NDP. + +#config server examplerelay +# option master 'wan' +# option network 'lan' +# option rd 'relay' +# option dhcpv6 'relay' +# option ndp 'relay' + + +# Example #2: Provide Router Discovery and stateless DHCPv6 in server mode +# This can be used as a small radvd and stateless DHCPv6-server replacement. + +#config server exampleserver +# option network 'lan' +# option rd 'server' +# option dhcpv6 'server' + diff --git a/package/network/ipv6/6relayd/files/6relayd.hotplug b/package/network/ipv6/6relayd/files/6relayd.hotplug new file mode 100644 index 0000000..7905282 --- /dev/null +++ b/package/network/ipv6/6relayd/files/6relayd.hotplug @@ -0,0 +1,6 @@ +#!/bin/sh +/etc/init.d/6relayd enabled || exit 0 +[ -n "$INTERFACE" ] || exit 0 + +. /etc/init.d/6relayd +restart_affected "$INTERFACE" diff --git a/package/network/ipv6/6relayd/files/6relayd.init b/package/network/ipv6/6relayd/files/6relayd.init new file mode 100644 index 0000000..ef0c711 --- /dev/null +++ b/package/network/ipv6/6relayd/files/6relayd.init @@ -0,0 +1,135 @@ +#!/bin/sh /etc/rc.common +# Copyright (c) 2011-2012 OpenWrt.org +START=80 + +start_6relayd() { + local cfg="$1" + local mode="$2" + local args="" + + SERVICE_DAEMONIZE=1 + SERVICE_WRITE_PID=1 + SERVICE_PID_FILE="/var/run/6relayd-$cfg.pid" + [ -f "$SERVICE_PID_FILE" ] && { + if grep -q 6relayd "/proc/$(cat $SERVICE_PID_FILE)/cmdline"; then + return 0 + else + rm -f "$SERVICE_PID_FILE" + fi + } + + # Detect master interface + local master masterif + config_get masterif "$cfg" master + network_get_device master "$masterif" + [ -z "$master" ] && master="." + + # Detect slave interfaces + local slaves="" + local slaveifs + config_get slaveifs "$cfg" network + for slaveif in $slaveifs; do + local slave + network_get_device slave "$slaveif" + # Compatibility with old config format + if [ "$mode" = "relay" -a "$master" = "." ]; then + [ -z "$slave" ] && return 0 + master="$slave" + else + [ -n "$slave" ] && append slaves "$slave" + fi + done + + # Bail if no slaves are active + [ -z "$slaves" ] && return 0 + + # Configure services + local rd dhcpv6 ndp + config_get rd "$cfg" rd + config_get dhcpv6 "$cfg" dhcpv6 + config_get ndp "$cfg" ndp + + # Test for fallback mode + local fallback fallback_relay + config_get fallback_relay "$cfg" fallback_relay + + if [ -n "$fallback_relay" -a "$master" != "." ]; then + local prefix + network_get_prefix6 prefix "$masterif" + [ -z "$prefix" ] && fallback=1 + fi + + if [ -n "$fallback" ]; then + for service in $fallback_relay; do + eval "$service=relay" + done + fi + + # Configure feature options + local always_rewrite_dns rewrite_dns_addr + config_get_bool always_rewrite_dns "$cfg" always_rewrite_dns 0 + config_get rewrite_dns_addr "$cfg" rewrite_dns_addr + [ "$always_rewrite_dns" -eq 1 -o -n "$rewrite_dns_addr" ] && append args "-n$rewrite_dns_addr" + + local always_assume_default + config_get_bool always_assume_default "$cfg" always_assume_default 0 + [ "$always_assume_default" -eq 1 ] && append args "-u" + + local compat_ula + config_get_bool compat_ula "$cfg" compat_ula 0 + [ "$compat_ula" -eq 1 ] && append args "-c" + + [ "$ndp" = "relay" ] && append args "-N -s -l" + [ "$rd" = "relay" ] && append args "-Rrelay" + [ "$rd" = "server" ] && append args "-Rserver" + [ "$dhcpv6" = "relay" ] && append args "-Drelay" + [ "$dhcpv6" = "server" ] && append args "-Dserver" + [ "$ndp" != "relay" -a "$rd" != "relay" -a "$dhcpv6" != "relay" ] && master="." + + service_start /usr/sbin/6relayd $args $master $slaves +} + +restart_affected_6relayd() { + local cfg="$1" + local net="$2" + local mode="$3" + + local master slaves + config_get master "$cfg" master + config_get slaves "$cfg" network + + for iface in $master $slaves; do + if [ "$iface" = "$net" ]; then + SERVICE_PID_FILE="/var/run/6relayd-$cfg.pid" + service_stop /usr/sbin/6relayd + rm -f "$SERVICE_PID_FILE" + start_6relayd "$cfg" "$mode" + fi + done +} + +restart_affected() { + . /lib/functions/service.sh + . /lib/functions/network.sh + local net="$1" + config_load 6relayd + config_foreach restart_affected_6relayd server "$net" + config_foreach restart_affected_6relayd relay "$net" "relay" +} + +stop() { + . /lib/functions/service.sh + for pid in /var/run/6relayd-*.pid; do + SERVICE_PID_FILE="$pid" + service_stop /usr/sbin/6relayd + rm -f "$SERVICE_PID_FILE" + done +} + +start() { + . /lib/functions/service.sh + . /lib/functions/network.sh + config_load 6relayd + config_foreach start_6relayd server + config_foreach start_6relayd relay relay +} |