mirror of
https://git.openwrt.org/openwrt/openwrt.git
synced 2024-10-18 13:29:16 +02:00
base-files: ipcalc.sh: don't include own address in range
Make sure our own address doesn't lie in the calculated range. Signed-off-by: Leon M. George <leon@georgemail.eu>
This commit is contained in:
parent
00a20335ba
commit
4fe106afd1
@ -61,10 +61,17 @@ BEGIN {
|
|||||||
start=or(network,and(ip2int(ARGV[3]),compl32(netmask)))
|
start=or(network,and(ip2int(ARGV[3]),compl32(netmask)))
|
||||||
limit=network+1
|
limit=network+1
|
||||||
if (start<limit) start=limit
|
if (start<limit) start=limit
|
||||||
|
if (start==ipaddr) start=ipaddr+1
|
||||||
|
|
||||||
end=start+ARGV[4]
|
end=start+ARGV[4]
|
||||||
limit=or(network,compl32(netmask))-1
|
limit=or(network,compl32(netmask))-1
|
||||||
if (end>limit) end=limit
|
if (end>limit) end=limit
|
||||||
|
if (end==ipaddr) end=ipaddr-1
|
||||||
|
|
||||||
|
if (ipaddr > start && ipaddr < end) {
|
||||||
|
print "ipaddr inside range" > "/dev/stderr"
|
||||||
|
exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
print "START="int2ip(start)
|
print "START="int2ip(start)
|
||||||
print "END="int2ip(end)
|
print "END="int2ip(end)
|
||||||
|
Loading…
Reference in New Issue
Block a user