aboutsummaryrefslogtreecommitdiffstats
path: root/package/network/config/vxlan
diff options
context:
space:
mode:
authorJohannes Kimmel <fff@bareminimum.eu>2020-12-15 00:31:52 +0100
committerHans Dedecker <dedeckeh@gmail.com>2020-12-31 11:53:21 +0100
commit3f5619f259de42af4404e0e36d11df4adcef9f5e (patch)
tree2efb3a449cf27b81ea281f53408c855a2ee3af63 /package/network/config/vxlan
parent31554e50d2c3d0707a40f9ed08b0d6999f584ba2 (diff)
downloadupstream-3f5619f259de42af4404e0e36d11df4adcef9f5e.tar.gz
upstream-3f5619f259de42af4404e0e36d11df4adcef9f5e.tar.bz2
upstream-3f5619f259de42af4404e0e36d11df4adcef9f5e.zip
vxlan: allow for dynamic source ip selection (FS#3426)
By setting 'auto', the zero address or the empty string as source address (option ipaddr, option ip6addr), vxlan will choose one dynamically. This helps in setups where a wan ip or prefix changes. This corresponse to setting up an vxlan tunnel with: proto vxlan6: # ip link add vx0 type vxlan id ID local :: ... proto vxlan: # ip link add vx0 type vxlan id ID local 0.0.0.0 ... While it is possible to not specify a source ip at all, the kernel will default to setting up a ipv4 tunnel. The kernel will take any hint from source and peer ips to figure out, what tunnel type to use. To make sure we setup an ipv6 tunnel for proto vxlan6, this workaround is needed. This will not change the behaviour of currently working configurations. However this will allow former broken configurations, namely those not specifying both a source address and tunnel interface, to setup a tunnel interface. Previously those configurations weren't reporting an error and were stueck in a setup loop like in Bug FS#3426. This change lifts the currently very strict behaviour and should fix the following bug: Fixes: FS#3426 Ref: https://bugs.openwrt.org/index.php?do=details&task_id=3426 Signed-off-by: Johannes Kimmel <fff@bareminimum.eu>
Diffstat (limited to 'package/network/config/vxlan')
-rw-r--r--package/network/config/vxlan/Makefile2
-rwxr-xr-xpackage/network/config/vxlan/files/vxlan.sh35
2 files changed, 12 insertions, 25 deletions
diff --git a/package/network/config/vxlan/Makefile b/package/network/config/vxlan/Makefile
index 0b4d6713f9..97972d6d85 100644
--- a/package/network/config/vxlan/Makefile
+++ b/package/network/config/vxlan/Makefile
@@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=vxlan
-PKG_RELEASE:=6
+PKG_RELEASE:=7
PKG_LICENSE:=GPL-2.0
include $(INCLUDE_DIR)/package.mk
diff --git a/package/network/config/vxlan/files/vxlan.sh b/package/network/config/vxlan/files/vxlan.sh
index 5c1c484c47..a087c4a3ce 100755
--- a/package/network/config/vxlan/files/vxlan.sh
+++ b/package/network/config/vxlan/files/vxlan.sh
@@ -114,18 +114,11 @@ proto_vxlan_setup() {
( 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
- }
+ case "$ipaddr" in
+ "auto"|"")
+ ipaddr="0.0.0.0"
+ ;;
+ esac
vxlan_generic_setup "$cfg" 'vxlan' "$ipaddr" "$peeraddr"
}
@@ -138,18 +131,12 @@ proto_vxlan6_setup() {
( 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
- }
+ case "$ip6addr" in
+ "auto"|"")
+ # ensure tunnel via ipv6
+ ip6addr="::"
+ ;;
+ esac
vxlan_generic_setup "$cfg" 'vxlan6' "$ip6addr" "$peer6addr"
}