From ef9c91609f6bae0923cad221dbd7b8f9636aed12 Mon Sep 17 00:00:00 2001
From: Ryo Nakamura <upa@haeena.net>
Date: Fri, 19 Dec 2014 19:27:55 +0900
Subject: support "remote" attribute of VXLAN tunnel

---
 templates/interfaces/vxlan/node.def | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

(limited to 'templates/interfaces/vxlan/node.def')

diff --git a/templates/interfaces/vxlan/node.def b/templates/interfaces/vxlan/node.def
index 780ef8d8..150fe3ec 100644
--- a/templates/interfaces/vxlan/node.def
+++ b/templates/interfaces/vxlan/node.def
@@ -5,8 +5,6 @@ help: Virtual eXtensible LAN interface
 val_help: <vxlanN>; VXLAN interface name
 syntax:expression: pattern $VAR(@) "vxlan[0-9]+$"
 
-commit:expression: $VAR(./group/) != "";	\
-		   "Must configure vxlan group for $VAR(@)"
 commit:expression: $VAR(./vni/) != "";			\
 		   "Must configure vxlan vni for $VAR(@)"
 
@@ -20,14 +18,27 @@ create:
     exit 1
   fi
 
+  VXLAN_GROUP=""
   VXLAN_VNI="id $VAR(./vni/@)"
-  VXLAN_GROUP="group $VAR(./group/@)"
   VXLAN_TTL="ttl 16"
 
   if [ ! $VAR(./link/) == "" ]; then
     VXLAN_DEV="dev $VAR(./link/@)"
   fi
 
+  if [ ! $VAR(./group/) == "" ]; then
+    VXLAN_GROUP="group $VAR(./group/@)"
+  fi
+
+  if [ ! $VAR(./remote/) == "" ]; then
+    VXLAN_GROUP="remote $VAR(./remote/@)"
+  fi
+
+  if [ -z "$VXLAN_GROUP" ]; then
+    echo "group or remote must be configured."
+    exit 1
+  fi
+
   ip link add name $VAR(@) type vxlan 	\
 	$VXLAN_VNI $VXLAN_GROUP $VXLAN_TTL $VXLAN_DEV
   ip link set $VAR(@) up
-- 
cgit v1.2.3

