diff options
author | Philip Prindeville <philipp@redfish-solutions.com> | 2021-04-30 20:39:10 -0600 |
---|---|---|
committer | Philip Prindeville <philipp@redfish-solutions.com> | 2021-05-02 18:44:09 -0600 |
commit | b428e46355de9cf7a8aea7b299d556a9b70e545e (patch) | |
tree | 7f0554d4a1496f99f180fa1fd858bb7c3934e562 /net | |
parent | ce44e3f2910d674d14759d356258f0cd00081945 (diff) |
isc-dhcpd: handle extra spaces in routes
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/isc-dhcp/Makefile | 2 | ||||
-rwxr-xr-x | net/isc-dhcp/files/dhcpd.init | 17 |
2 files changed, 14 insertions, 5 deletions
diff --git a/net/isc-dhcp/Makefile b/net/isc-dhcp/Makefile index 8a2056ca6..46921ba3f 100644 --- a/net/isc-dhcp/Makefile +++ b/net/isc-dhcp/Makefile @@ -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 diff --git a/net/isc-dhcp/files/dhcpd.init b/net/isc-dhcp/files/dhcpd.init index 06415729e..680c112d1 100755 --- a/net/isc-dhcp/files/dhcpd.init +++ b/net/isc-dhcp/files/dhcpd.init @@ -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)" |