xinetd: add processing of redirect option in init script

Signed-off-by: Helge Mader <ma@dev.tdt.de>
This commit is contained in:
Helge Mader 2023-01-11 10:33:10 +01:00
parent 8f68e1bd91
commit c80fc6c343
2 changed files with 17 additions and 2 deletions

View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=xinetd
PKG_VERSION:=2.3.15
PKG_RELEASE:=13
PKG_RELEASE:=14
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/xinetd-org/xinetd/archive

View File

@ -62,7 +62,22 @@ config_cb() {
local option="$1"
local value="$2"
[ -n "$value" ] && [ "$option" != "name" ] && echo -e "\t$option = $value" >> $GENERATED_CONF_FILE
# for the redirect option we have to convert the '[ip address]:port' notation
# in config file to 'ip_address port' in the xinetd config file
if [ "$option" = "redirect" ] && [ -n "$value" ]; then
local redirect_ip=""
local redirect_port=""
redirect_ip="$(echo ${value%:*})"
redirect_ip="$(echo ${redirect_ip//\[/})"
redirect_ip="$(echo ${redirect_ip//\]/})"
redirect_port="$(echo ${value##*:})"
echo -e "\t$option = $redirect_ip $redirect_port" >> $GENERATED_CONF_FILE
else
[ -n "$value" ] && [ "$option" != "name" ] && echo -e "\t$option = $value" >> $GENERATED_CONF_FILE
fi
}
# redefined callback for lists when calling config_load