3 [ -n "$INCLUDE_ONLY" ] ||
{
5 .
/lib
/functions
/network.sh
14 local df ipaddr peeraddr tunlink ttl tos zone mtu
15 json_get_vars df ipaddr peeraddr tunlink ttl tos zone mtu nohostroute
17 [ -z "$peeraddr" ] && {
18 proto_notify_error
"$cfg" "MISSING_PEER_ADDRESS"
19 proto_block_restart
"$cfg"
23 remoteip
=$
(resolveip
-t 10 -4 "$peeraddr")
25 if [ -z "$remoteip" ]; then
26 proto_notify_error
"$cfg" "PEER_RESOLVE_FAIL"
30 for ip
in $remoteip; do
35 if [ "${nohostroute}" != "1" ]; then
36 ( proto_add_host_dependency
"$cfg" "$peeraddr" "$tunlink" )
40 local wanif
="$tunlink"
41 if [ -z $wanif ] && ! network_find_wan wanif
; then
42 proto_notify_error
"$cfg" "NO_WAN_LINK"
46 if ! network_get_ipaddr ipaddr
"$wanif"; then
47 proto_notify_error
"$cfg" "NO_WAN_LINK"
52 proto_init_update
"ipip-$cfg" 1
55 json_add_string mode
"ipip"
56 json_add_int mtu
"${mtu:-1280}"
57 json_add_int ttl
"${ttl:-64}"
58 [ -n "$tos" ] && json_add_string tos
"$tos"
59 json_add_string
local "$ipaddr"
60 json_add_string remote
"$peeraddr"
61 [ -n "$tunlink" ] && json_add_string link
"$tunlink"
62 json_add_boolean df
"${df:-1}"
67 [ -n "$zone" ] && json_add_string zone
"$zone"
70 proto_send_update
"$cfg"
73 proto_ipip_teardown
() {
77 proto_ipip_init_config
() {
81 proto_config_add_int
"mtu"
82 proto_config_add_int
"ttl"
83 proto_config_add_string
"tos"
84 proto_config_add_string
"tunlink"
85 proto_config_add_string
"zone"
86 proto_config_add_string
"ipaddr"
87 proto_config_add_string
"peeraddr"
88 proto_config_add_boolean
"df"
89 proto_config_add_boolean
"nohostroute"
92 [ -n "$INCLUDE_ONLY" ] ||
{