Bug 58410 - /bin/ipcalc input bugs
/bin/ipcalc input bugs
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: initscripts (Show other bugs)
7.2
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Bill Nottingham
Brock Organ
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-01-15 21:26 EST by Steve Bonneville
Modified: 2014-03-16 22:25 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-01-24 01:58:59 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Steve Bonneville 2002-01-15 21:26:02 EST
Three related input parsing bugs with /bin/ipcalc:

1) CIDR short-form.

If a user attempts to use ipcalc by specifying a network/prefix pair (i.e.,
10/8) rather than ip-address/prefix (i.e. 10.0.0.0/8), strange results may
occur.

                network (-n)    broadcast (-b)
 172.0.0.0/8    172.0.0.0       172.255.255.255         (CORRECT)
 172/8          0.0.0.0         0.255.255.255           (INCORRECT)

 172.16.0.0/16  172.16.0.0      172.16.255.255          (CORRECT)
 172.16/16      172.0.0.0       172.0.255.255           (INCORRECT)

 172.16.10.0/24 172.16.10.0     172.16.10.255           (CORRECT)
 172.16.10/24   172.16.0.0      172.16.0.255            (INCORRECT)

Either ipcalc should compute addresses in network/prefix correctly, or it should
reject input in that form.

2) Input checking: CIDR prefix *and* netmask!

Only the -m option complains if a user attempts to give both a CIDR prefix *and*
a subnet mask on the command line.  If the input is so perverse that they
*differ*, the subnet mask takes precedence.

 # ipcalc -n 172.16.1.0/24 255.255.0.0
 NETWORK=172.16.0.0
 # ipcalc -b 172.16.1.0/24 255.255.0.0
 BROADCAST=172.16.255.255
 # ipcalc -p 172.16.1.0/24 255.255.0.0
 PREFIX=16

This input should be rejected outright.

3) (cosmetic bug) ipcalc <IPaddress>/<prefix> silence.

If ipcalc is given an ip-address/prefix but no options, nothing happens. 
If it's given an ip-address and netmask but no options, the usage message is
output.

The usage message should be output in both circumstances.
Comment 1 Bill Nottingham 2002-04-12 18:54:37 EDT
Fixed in 6.63-1.

Note You need to log in before you can comment on or make changes to this bug.