isc-dhcpd: handle extra spaces in routes
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
This commit is contained in:
parent
ce44e3f291
commit
b428e46355
2 changed files with 15 additions and 6 deletions
|
@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
|
||||||
PKG_NAME:=isc-dhcp
|
PKG_NAME:=isc-dhcp
|
||||||
UPSTREAM_NAME:=dhcp
|
UPSTREAM_NAME:=dhcp
|
||||||
PKG_VERSION:=4.4.1
|
PKG_VERSION:=4.4.1
|
||||||
PKG_RELEASE:=17
|
PKG_RELEASE:=18
|
||||||
|
|
||||||
PKG_LICENSE:=BSD-3-Clause
|
PKG_LICENSE:=BSD-3-Clause
|
||||||
PKG_LICENSE_FILES:=LICENSE
|
PKG_LICENSE_FILES:=LICENSE
|
||||||
|
|
|
@ -48,6 +48,13 @@ time2seconds() {
|
||||||
echo $(( number * multiplier ))
|
echo $(( number * multiplier ))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
trim()
|
||||||
|
{
|
||||||
|
local arg="$1"
|
||||||
|
|
||||||
|
echo "$arg" | sed -e 's/^ *//' -e 's/ *$//'
|
||||||
|
}
|
||||||
|
|
||||||
# duplicated from dnsmasq init script
|
# duplicated from dnsmasq init script
|
||||||
hex_to_hostid() {
|
hex_to_hostid() {
|
||||||
local var="$1"
|
local var="$1"
|
||||||
|
@ -122,12 +129,14 @@ append_routes() {
|
||||||
for tuple in $tuples; do
|
for tuple in $tuples; do
|
||||||
local network prefix router save octets compacted
|
local network prefix router save octets compacted
|
||||||
|
|
||||||
save="${tuple% *}"
|
tuple="$(trim "$tuple")"
|
||||||
router="${tuple#${save} }"
|
|
||||||
|
|
||||||
network="${save%/[0-9]*}"
|
save="${tuple% *}"
|
||||||
prefix="${save##${network}}"
|
router="$(trim "${tuple#${save} }")"
|
||||||
prefix="${prefix:1}"
|
|
||||||
|
network="$(trim "${save%/[0-9]*}")"
|
||||||
|
|
||||||
|
prefix="$(trim "${save##${network}/}")"
|
||||||
|
|
||||||
octets=$((($prefix + 7) / 8))
|
octets=$((($prefix + 7) / 8))
|
||||||
compacted="$(echo "$network" | cut -d. -f1-$octets)"
|
compacted="$(echo "$network" | cut -d. -f1-$octets)"
|
||||||
|
|
Loading…
Reference in a new issue