gluon/patches/lede/0030-vxlan-add-new-package-for-netifd-VXLAN-proto.patch
Matthias Schiffer a8f5051104
modules: update LEDE (2017-10-02)
783465d783 odhcpd: don't enable server mode on non-static lan port
c92c1894a5 odhcpd: backport fixes from master branch (FS#402, FS#524)
4b4a4af814 dnsmasq: bump to v2.78
b8357e87d7 base-files: create /etc/config/ directory
3350137bd3 sunxi: clean up modules definitions
a881323cb2 ltq-vdsl-mei: revert disable optimized firmware download
f483a35f08 curl: fix security problems
e232c6754d mbedtls: update to 2.6.0 CVE-2017-14032
37e1bd27d0 generic: drop 704-phy-no-genphy-soft-reset.patch
720b0e2e2d kernel: update 4.4 to 4.4.89
b428f45c06 ltq-vdsl-mei: disable optimized firmware download
39e5cd9556 ltq-vdsl: fix PM thread suspend and resume handling
86f0e8b091 openvpn: add "extra-certs" option
af802bc687 lantiq: fix missing otg_cap on danube platform
12a0da6315 tcpdump: noop commit to refer CVEs fixed in 4.9.2
f66c6e1d8a tcpdump: bump to 4.9.2
a131f7cb69 utils/tcpdump: Rework URLs
7f1359c14e base-files: fix wan6 interface config generation for pppoe
97ebdf93a3 ipq806x: Archer C2600: fix switch ports numbering
d33f7905df treewide: fix shellscript syntax errors/typos
4f162ac3ce ramips: fix hg255d LED status support
2017-10-02 21:08:11 +02:00

199 lines
4.5 KiB
Diff

From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Fri, 10 Mar 2017 01:23:50 +0100
Subject: vxlan: add new package for netifd VXLAN proto
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/package/network/config/vxlan/Makefile b/package/network/config/vxlan/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..a471d4e90cbe30c1d1dd01dbf7553995d8c0485e
--- /dev/null
+++ b/package/network/config/vxlan/Makefile
@@ -0,0 +1,32 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=vxlan
+PKG_VERSION:=1
+PKG_LICENSE:=GPL-2.0
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/vxlan
+ SECTION:=net
+ CATEGORY:=Network
+ MAINTAINER:=Matthias Schiffer <mschiffer@universe-factory.net>
+ TITLE:=Virtual eXtensible LAN config support
+ DEPENDS:=+kmod-vxlan
+endef
+
+define Package/vxlan/description
+ Virtual eXtensible LAN config support in /etc/config/network.
+endef
+
+define Build/Compile
+endef
+
+define Build/Configure
+endef
+
+define Package/vxlan/install
+ $(INSTALL_DIR) $(1)/lib/netifd/proto
+ $(INSTALL_BIN) ./files/vxlan.sh $(1)/lib/netifd/proto/vxlan.sh
+endef
+
+$(eval $(call BuildPackage,vxlan))
diff --git a/package/network/config/vxlan/files/vxlan.sh b/package/network/config/vxlan/files/vxlan.sh
new file mode 100755
index 0000000000000000000000000000000000000000..27ccd8f12759f69c7c226cac0c923335b8ccc6a8
--- /dev/null
+++ b/package/network/config/vxlan/files/vxlan.sh
@@ -0,0 +1,148 @@
+#!/bin/sh
+
+[ -n "$INCLUDE_ONLY" ] || {
+ . /lib/functions.sh
+ . /lib/functions/network.sh
+ . ../netifd-proto.sh
+ init_proto "$@"
+}
+
+vxlan_generic_setup() {
+ local cfg="$1"
+ local mode="$2"
+ local local="$3"
+ local remote="$4"
+
+ local link="$cfg"
+
+ local port vid ttl tos mtu macaddr zone
+ json_get_vars port vid ttl tos mtu macaddr zone
+
+
+ proto_init_update "$link" 1
+
+ proto_add_tunnel
+ json_add_string mode "$mode"
+
+ [ -n "$tunlink" ] && json_add_string link "$tunlink"
+ [ -n "$local" ] && json_add_string local "$local"
+ [ -n "$remote" ] && json_add_string remote "$remote"
+
+ [ -n "$ttl" ] && json_add_int ttl "$ttl"
+ [ -n "$tos" ] && json_add_string tos "$tos"
+ [ -n "$mtu" ] && json_add_int mtu "$mtu"
+
+ json_add_object 'data'
+ [ -n "$port" ] && json_add_int port "$port"
+ [ -n "$vid" ] && json_add_int id "$vid"
+ [ -n "$macaddr" ] && json_add_string macaddr "$macaddr"
+ json_close_object
+
+ proto_close_tunnel
+
+ proto_add_data
+ [ -n "$zone" ] && json_add_string zone "$zone"
+ proto_close_data
+
+ proto_send_update "$cfg"
+}
+
+proto_vxlan_setup() {
+ local cfg="$1"
+
+ local ipaddr peeraddr
+ json_get_vars ipaddr peeraddr tunlink
+
+ [ -z "$peeraddr" ] && {
+ proto_notify_error "$cfg" "MISSING_ADDRESS"
+ proto_block_restart "$cfg"
+ exit
+ }
+
+ ( proto_add_host_dependency "$cfg" '' "$tunlink" )
+
+ [ -z "$ipaddr" ] && {
+ local wanif="$tunlink"
+ if [ -z "$wanif" ] && ! network_find_wan wanif; then
+ proto_notify_error "$cfg" "NO_WAN_LINK"
+ exit
+ fi
+
+ if ! network_get_ipaddr ipaddr "$wanif"; then
+ proto_notify_error "$cfg" "NO_WAN_LINK"
+ exit
+ fi
+ }
+
+ vxlan_generic_setup "$cfg" 'vxlan' "$ipaddr" "$peeraddr"
+}
+
+proto_vxlan6_setup() {
+ local cfg="$1"
+
+ local ip6addr peer6addr
+ json_get_vars ip6addr peer6addr tunlink
+
+ [ -z "$peer6addr" ] && {
+ proto_notify_error "$cfg" "MISSING_ADDRESS"
+ proto_block_restart "$cfg"
+ exit
+ }
+
+ ( proto_add_host_dependency "$cfg" '' "$tunlink" )
+
+ [ -z "$ip6addr" ] && {
+ local wanif="$tunlink"
+ if [ -z "$wanif" ] && ! network_find_wan6 wanif; then
+ proto_notify_error "$cfg" "NO_WAN_LINK"
+ exit
+ fi
+
+ if ! network_get_ipaddr6 ip6addr "$wanif"; then
+ proto_notify_error "$cfg" "NO_WAN_LINK"
+ exit
+ fi
+ }
+
+ vxlan_generic_setup "$cfg" 'vxlan6' "$ip6addr" "$peer6addr"
+}
+
+proto_vxlan_teardown() {
+ local cfg="$1"
+}
+
+proto_vxlan6_teardown() {
+ local cfg="$1"
+}
+
+vxlan_generic_init_config() {
+ no_device=1
+ available=1
+
+ proto_config_add_string "tunlink"
+ proto_config_add_string "zone"
+
+ proto_config_add_int "vid"
+ proto_config_add_int "port"
+ proto_config_add_int "ttl"
+ proto_config_add_int "tos"
+ proto_config_add_int "mtu"
+ proto_config_add_string "macaddr"
+}
+
+proto_vxlan_init_config() {
+ vxlan_generic_init_config
+ proto_config_add_string "ipaddr"
+ proto_config_add_string "peeraddr"
+}
+
+proto_vxlan6_init_config() {
+ vxlan_generic_init_config
+ proto_config_add_string "ip6addr"
+ proto_config_add_string "peer6addr"
+}
+
+[ -n "$INCLUDE_ONLY" ] || {
+ add_protocol vxlan
+ add_protocol vxlan6
+}