3 [ -n "$INCLUDE_ONLY" ] ||
{
5 .
/lib
/functions
/network.sh
10 vxlan_generic_setup
() {
18 local port vid ttl tos mtu macaddr zone
19 json_get_vars port vid ttl tos mtu macaddr zone
22 proto_init_update
"$link" 1
25 json_add_string mode
"$mode"
27 [ -n "$tunlink" ] && json_add_string link
"$tunlink"
28 [ -n "$local" ] && json_add_string
local "$local"
29 [ -n "$remote" ] && json_add_string remote
"$remote"
31 [ -n "$ttl" ] && json_add_int ttl
"$ttl"
32 [ -n "$tos" ] && json_add_string tos
"$tos"
33 [ -n "$mtu" ] && json_add_int mtu
"$mtu"
35 json_add_object
'data'
36 [ -n "$port" ] && json_add_int port
"$port"
37 [ -n "$vid" ] && json_add_int id
"$vid"
38 [ -n "$macaddr" ] && json_add_string macaddr
"$macaddr"
44 [ -n "$zone" ] && json_add_string zone
"$zone"
47 proto_send_update
"$cfg"
54 json_get_vars ipaddr peeraddr tunlink
56 [ -z "$peeraddr" ] && {
57 proto_notify_error
"$cfg" "MISSING_ADDRESS"
58 proto_block_restart
"$cfg"
62 ( proto_add_host_dependency
"$cfg" '' "$tunlink" )
65 local wanif
="$tunlink"
66 if [ -z "$wanif" ] && ! network_find_wan wanif
; then
67 proto_notify_error
"$cfg" "NO_WAN_LINK"
71 if ! network_get_ipaddr ipaddr
"$wanif"; then
72 proto_notify_error
"$cfg" "NO_WAN_LINK"
77 vxlan_generic_setup
"$cfg" 'vxlan' "$ipaddr" "$peeraddr"
80 proto_vxlan6_setup
() {
83 local ip6addr peer6addr
84 json_get_vars ip6addr peer6addr tunlink
86 [ -z "$peer6addr" ] && {
87 proto_notify_error
"$cfg" "MISSING_ADDRESS"
88 proto_block_restart
"$cfg"
92 ( proto_add_host_dependency
"$cfg" '' "$tunlink" )
94 [ -z "$ip6addr" ] && {
95 local wanif
="$tunlink"
96 if [ -z "$wanif" ] && ! network_find_wan6 wanif
; then
97 proto_notify_error
"$cfg" "NO_WAN_LINK"
101 if ! network_get_ipaddr6 ip6addr
"$wanif"; then
102 proto_notify_error
"$cfg" "NO_WAN_LINK"
107 vxlan_generic_setup
"$cfg" 'vxlan6' "$ip6addr" "$peer6addr"
110 proto_vxlan_teardown
() {
114 proto_vxlan6_teardown
() {
118 vxlan_generic_init_config
() {
122 proto_config_add_string
"tunlink"
123 proto_config_add_string
"zone"
125 proto_config_add_int
"vid"
126 proto_config_add_int
"port"
127 proto_config_add_int
"ttl"
128 proto_config_add_int
"tos"
129 proto_config_add_int
"mtu"
130 proto_config_add_string
"macaddr"
133 proto_vxlan_init_config
() {
134 vxlan_generic_init_config
135 proto_config_add_string
"ipaddr"
136 proto_config_add_string
"peeraddr"
139 proto_vxlan6_init_config
() {
140 vxlan_generic_init_config
141 proto_config_add_string
"ip6addr"
142 proto_config_add_string
"peer6addr"
145 [ -n "$INCLUDE_ONLY" ] ||
{