xinetd: add processing of redirect option in init script 20264/head
authorHelge Mader <ma@dev.tdt.de>
Wed, 11 Jan 2023 09:33:10 +0000 (10:33 +0100)
committerHelge Mader <ma@dev.tdt.de>
Wed, 11 Jan 2023 10:49:17 +0000 (11:49 +0100)
Signed-off-by: Helge Mader <ma@dev.tdt.de>
net/xinetd/Makefile
net/xinetd/files/xinetd.init

index 62e90bdded1a11bd4062c3e3c8ec620ceb2d1f16..1d52a1b5e00544eae222da331c220e12a47645bf 100644 (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
index 9e3872fce28a0d14653243d64fb6f131c10eb927..5e89b5b63e4eb08cf8bcaf8c4f55c88cda9c0520 100644 (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