isc-dhcpd: handle extra spaces in routes 15554/head
authorPhilip Prindeville <philipp@redfish-solutions.com>
Sat, 1 May 2021 02:39:10 +0000 (20:39 -0600)
committerPhilip Prindeville <philipp@redfish-solutions.com>
Mon, 3 May 2021 00:44:09 +0000 (18:44 -0600)
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
net/isc-dhcp/Makefile
net/isc-dhcp/files/dhcpd.init

index 8a2056ca6f59deb20240c85dcf09ce2bc38cb060..46921ba3f329ea87c4bdae4fc958ca2545de61f6 100644 (file)
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
 PKG_NAME:=isc-dhcp
 UPSTREAM_NAME:=dhcp
 PKG_VERSION:=4.4.1
-PKG_RELEASE:=17
+PKG_RELEASE:=18
 
 PKG_LICENSE:=BSD-3-Clause
 PKG_LICENSE_FILES:=LICENSE
index 06415729e751f2435ad754a7472e3c4b2adaef55..680c112d132448bc3f413aba69e59a60bc35d18b 100755 (executable)
@@ -48,6 +48,13 @@ time2seconds() {
        echo $(( number * multiplier ))
 }
 
+trim()
+{
+       local arg="$1"
+
+       echo "$arg" | sed -e 's/^ *//' -e 's/ *$//'
+}
+
 # duplicated from dnsmasq init script
 hex_to_hostid() {
        local var="$1"
@@ -122,12 +129,14 @@ append_routes() {
        for tuple in $tuples; do
                local network prefix router save octets compacted
 
+               tuple="$(trim "$tuple")"
+
                save="${tuple% *}"
-               router="${tuple#${save} }"
+               router="$(trim "${tuple#${save} }")"
+
+               network="$(trim "${save%/[0-9]*}")"
 
-               network="${save%/[0-9]*}"
-               prefix="${save##${network}}"
-               prefix="${prefix:1}"
+               prefix="$(trim "${save##${network}/}")"
 
                octets=$((($prefix + 7) / 8))
                compacted="$(echo "$network" | cut -d. -f1-$octets)"