Skip to content
Snippets Groups Projects
Unverified Commit 4fe106af authored by Leon M. George's avatar Leon M. George Committed by Christian Marangi
Browse files

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: default avatarLeon M. George <leon@georgemail.eu>
parent 00a20335
Branches
No related tags found
1 merge request!461openwrt-core OpenWrt 23.05.0-rc3 uplift
......@@ -61,10 +61,17 @@ BEGIN {
start=or(network,and(ip2int(ARGV[3]),compl32(netmask)))
limit=network+1
if (start<limit) start=limit
if (start==ipaddr) start=ipaddr+1
end=start+ARGV[4]
limit=or(network,compl32(netmask))-1
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 "END="int2ip(end)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment