NETWORK_TRIGGERS_DIR=/usr/lib/network/triggers
NETWORK_SHARE_DIR=/usr/share/network
+NETWORK_IPSEC_CONNS_DIR="${NETWORK_CONFIG_DIR}/vpn/ipsec/connections"
+
# Network file configuration.
NETWORK_SETTINGS_FILE=${NETWORK_CONFIG_DIR}/config
NETWORK_SETTINGS_FILE_PARAMS="DEBUG"
return ${EXIT_ERROR}
fi
- local path="$(ipsec_connection_path "${connection}")/settings"
+ local path="${NETWORK_IPSEC_CONNS_DIR}/${connection}/settings"
if ! settings_write "${path}" ${IPSEC_CONNECTION_CONFIG_SETTINGS}; then
log ERROR "Could not write configuration settings for VPN IPsec connection ${connection}"
list_append args $@
fi
- local path="$(ipsec_connection_path "${connection}")/settings"
+ local path="${NETWORK_IPSEC_CONNS_DIR}/${connection}/settings"
if ! settings_read "${path}" ${args}; then
log ERROR "Could not read settings for VPN IPsec connection ${connection}"
fi
}
-# Returns the path to a the directory for given connection
-ipsec_connection_path() {
- assert [ $# -eq 1 ]
-
- local connection=${1}
-
- echo "${NETWORK_CONFIG_DIR}/vpn/ipsec/connection/${connection}"
-}
-
# This function checks if a vpn ipsec connection exists
# Returns True when yes and false when not
ipsec_connection_exists() {
local connection=${1}
- local path=$(ipsec_connection_path "${connection}")
+ local path="${NETWORK_IPSEC_CONNS_DIR}/${connection}"
[ -d "${path}" ] && return ${EXIT_TRUE} || return ${EXIT_FALSE}
}
log DEBUG "Creating VPN IPsec connection ${connection}"
- if ! mkdir -p $(ipsec_connection_path "${connection}"); then
+ if ! mkdir -p "${NETWORK_IPSEC_CONNS_DIR}/${connection}"; then
log ERROR "Could not create config directory for ${connection}"
return ${EXIT_ERROR}
fi
fi
log DEBUG "Deleting VPN IPsec connection ${connection}"
- if ! rm -rf $(ipsec_connection_path "${connection}"); then
+ if ! rm -rf "${NETWORK_IPSEC_CONNS_DIR}/${connection}"; then
log ERROR "Deleting the VPN IPsec connection ${connection} was not sucessful"
return ${EXIT_ERROR}
fi