3 [ -n "$INCLUDE_ONLY" ] ||
{
5 .
/lib
/functions
/network.sh
10 vxlan_generic_setup
() {
18 local port vid ttl tos mtu macaddr zone rxcsum txcsum
19 json_get_vars port vid ttl tos mtu macaddr zone rxcsum txcsum
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"
39 [ -n "$rxcsum" ] && json_add_boolean rxcsum
"$rxcsum"
40 [ -n "$txcsum" ] && json_add_boolean txcsum
"$txcsum"
46 [ -n "$zone" ] && json_add_string zone
"$zone"
49 proto_send_update
"$cfg"
56 json_get_vars ipaddr peeraddr tunlink
58 ( proto_add_host_dependency
"$cfg" '' "$tunlink" )
61 local wanif
="$tunlink"
62 if [ -z "$wanif" ] && ! network_find_wan wanif
; then
63 proto_notify_error
"$cfg" "NO_WAN_LINK"
67 if ! network_get_ipaddr ipaddr
"$wanif"; then
68 proto_notify_error
"$cfg" "NO_WAN_LINK"
73 vxlan_generic_setup
"$cfg" 'vxlan' "$ipaddr" "$peeraddr"
76 proto_vxlan6_setup
() {
79 local ip6addr peer6addr
80 json_get_vars ip6addr peer6addr tunlink
82 ( proto_add_host_dependency
"$cfg" '' "$tunlink" )
84 [ -z "$ip6addr" ] && {
85 local wanif
="$tunlink"
86 if [ -z "$wanif" ] && ! network_find_wan6 wanif
; then
87 proto_notify_error
"$cfg" "NO_WAN_LINK"
91 if ! network_get_ipaddr6 ip6addr
"$wanif"; then
92 proto_notify_error
"$cfg" "NO_WAN_LINK"
97 vxlan_generic_setup
"$cfg" 'vxlan6' "$ip6addr" "$peer6addr"
100 proto_vxlan_teardown
() {
104 proto_vxlan6_teardown
() {
108 vxlan_generic_init_config
() {
112 proto_config_add_string
"tunlink"
113 proto_config_add_string
"zone"
115 proto_config_add_int
"vid"
116 proto_config_add_int
"port"
117 proto_config_add_int
"ttl"
118 proto_config_add_int
"tos"
119 proto_config_add_int
"mtu"
120 proto_config_add_boolean
"rxcsum"
121 proto_config_add_boolean
"txcsum"
122 proto_config_add_string
"macaddr"
125 proto_vxlan_init_config
() {
126 vxlan_generic_init_config
127 proto_config_add_string
"ipaddr"
128 proto_config_add_string
"peeraddr"
131 proto_vxlan6_init_config
() {
132 vxlan_generic_init_config
133 proto_config_add_string
"ip6addr"
134 proto_config_add_string
"peer6addr"
137 [ -n "$INCLUDE_ONLY" ] ||
{