Commit Graph

8 Commits (34bbbbf9c3b39e7b2d81df590aad5cdbd00280d6)

Author SHA1 Message Date
Jo-Philipp Wich ef0ce72b39 base-files: ipcalc.sh: support bit length as netmask parameter
SVN-Revision: 39100
11 years ago
Luka Perkov 3ceb6b3274 base-files: fix whitespaces
Signed-off-by: Luka Perkov <luka@openwrt.org>

SVN-Revision: 39006
11 years ago
Jo-Philipp Wich ab6e2e6928 base-files: ipcalc.sh: fix broken calculations on 64bit systems
Calculate complements by using awk's xor() function with a mask of 0xffffffff
instead of relying on the compl() function which appears to produce broken
results on certain 64bit architectures.

SVN-Revision: 34875
12 years ago
Jo-Philipp Wich ed8f726dab ipcalc.sh CIDR notation Hi,
the attached patch makes ipcalc.sh accept IP/Netmask combinations in
CIDR notation. Before you could only do:

# sh ipcalc.sh 192.168.0.0 255.255.255.0 1 10
IP=192.168.0.0
NETMASK=255.255.255.0
BROADCAST=192.168.0.255
NETWORK=192.168.0.0
PREFIX=24
START=192.168.0.1
END=192.168.0.11

with this patch you can also execute it with:

sh ipcalc.sh 192.168.0.0/24 1 10
IP=192.168.0.0
NETMASK=255.255.255.0
BROADCAST=192.168.0.255
NETWORK=192.168.0.0
PREFIX=24
START=192.168.0.1
END=192.168.0.11

The patch is based on #1260 [1], i just changed one line to calculate
the START end END ips right. I wonder why that never got included. If
there is no reason not to do i would like to ask you to commit that
patch, because its a functionality i (and probably others) miss quite often.

Btw, i also fixed 4 useless tabs, that might look a bit strange in the
patch.

Regards, Manuel

SVN-Revision: 26930
13 years ago
Felix Fietkau 9f7f8110e7 base-files: remove a stale reference to /usr/lib/common.awk (thx, swalker)
SVN-Revision: 25528
13 years ago
Felix Fietkau 803e9ceb90 base-files: /usr/lib/common.awk is only used by /bin/ipcalc.sh, move the code there
SVN-Revision: 25495
13 years ago
Jo-Philipp Wich 19c12174ee base-files: ipcalc.sh: fix off-by-one in range-calculation
SVN-Revision: 16619
15 years ago
Felix Fietkau e1bb37f2ec upgrade dnsmasq to latest version, rewrite dnsmasq init script for uci, rename /bin/ipcalc to /bin/ipcalc.sh (fixes #1452)
SVN-Revision: 6595
17 years ago