Browse Source

strongswan: drop subshell when possible

A subshell caused by $(...) can't persistently modify globals as a
side-effect.

Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
lilik-openwrt-22.03
Philip Prindeville 4 years ago
parent
commit
210640d606
2 changed files with 11 additions and 5 deletions
  1. +1
    -1
      net/strongswan/Makefile
  2. +10
    -4
      net/strongswan/files/swanctl.init

+ 1
- 1
net/strongswan/Makefile View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=strongswan PKG_NAME:=strongswan
PKG_VERSION:=5.9.2 PKG_VERSION:=5.9.2
PKG_RELEASE:=2
PKG_RELEASE:=3
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=https://download.strongswan.org/ https://download2.strongswan.org/ PKG_SOURCE_URL:=https://download.strongswan.org/ https://download2.strongswan.org/


+ 10
- 4
net/strongswan/files/swanctl.init View File

@ -160,11 +160,13 @@ add_esp_proposal() {
parse_esp_proposal() { parse_esp_proposal() {
local conf="$1" local conf="$1"
local var="$2"
local crypto="" local crypto=""
config_list_foreach "$conf" crypto_proposal add_esp_proposal config_list_foreach "$conf" crypto_proposal add_esp_proposal
echo "$crypto"
export -n "$var=$crypto"
} }
add_ike_proposal() { add_ike_proposal() {
@ -190,11 +192,13 @@ add_ike_proposal() {
parse_ike_proposal() { parse_ike_proposal() {
local conf="$1" local conf="$1"
local var="$2"
local crypto="" local crypto=""
config_list_foreach "$conf" crypto_proposal add_ike_proposal config_list_foreach "$conf" crypto_proposal add_ike_proposal
echo "$crypto"
export -n "$var=$crypto"
} }
config_conn() { config_conn() {
@ -228,7 +232,8 @@ config_conn() {
config_get if_id "$1" if_id "" config_get if_id "$1" if_id ""
config_get rekeytime "$1" rekeytime "" config_get rekeytime "$1" rekeytime ""
local esp_proposal="$(parse_esp_proposal "$1")"
local esp_proposal
parse_esp_proposal "$1" esp_proposal
# translate from ipsec to swanctl # translate from ipsec to swanctl
case "$startaction" in case "$startaction" in
@ -387,7 +392,8 @@ config_remote() {
local_gateway=`ip -o route get $ipdest | awk '/ src / { gsub(/^.* src /,""); gsub(/ .*$/, ""); print $0}'` local_gateway=`ip -o route get $ipdest | awk '/ src / { gsub(/^.* src /,""); gsub(/ .*$/, ""); print $0}'`
} }
local ike_proposal="$(parse_ike_proposal "$1")"
local ike_proposal
parse_ike_proposal "$1" ike_proposal
[ -n "$firewall" ] && warning "Firewall not supported" [ -n "$firewall" ] && warning "Firewall not supported"


Loading…
Cancel
Save