Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1427889

Summary: exit code on wrong parameter is zero for many net-tools binaries
Product: Red Hat Enterprise Linux 7 Reporter: Petr Sklenar <psklenar>
Component: net-toolsAssignee: Michal Ruprich <mruprich>
Status: CLOSED ERRATA QA Contact: Petr Sklenar <psklenar>
Severity: unspecified Docs Contact:
Priority: medium    
Version: 7.4CC: ovasik
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: net-tools-2.0-0.21.20131004git.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1670355 (view as bug list) Environment:
Last Closed: 2017-08-01 16:09:52 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1670355    

Description Petr Sklenar 2017-03-01 13:09:28 UTC
Description of problem:
exit code on wrong parameter is zero

Version-Release number of selected component (if applicable):
net-tools-2.0-0.18.20131004git.el7.x86_64

How reproducible:
always

Steps to Reproduce:
1. zero exit code for wrong usage:

[0 root@qeos-196 ~]# nameif aaaa
usage: nameif [-c configurationfile] [-s] {ifname macaddress}
[0 root@qeos-196 ~]# echo $?
0

2. there are more tools returning ZERO, I tried
bin wrongoption
bin --wrongoption

############## BUG
/bin/netstat wrongoption
usage: netstat [-vWeenNcCF] [<Af>] -r         netstat {-V|--version|-h|--help}
       netstat [-vWnNcaeol] [<Socket> ...]
.......snip........
    netrom (AMPR NET/ROM) ipx (Novell IPX) ddp (Appletalk DDP) 
    x25 (CCITT X.25) 
############## BUG
/sbin/arp --wrongoption
/sbin/arp: unrecognized option '--wrongoption'
Usage:
.......snip........
    irda (IrLAP) x25 (generic X.25) infiniband (InfiniBand) 
    eui64 (Generic EUI-64) 
############## BUG
/sbin/ipmaddr wrongoption
Usage: ipmaddr [ add | del ] MULTIADDR dev STRING
       ipmaddr show [ dev STRING ] [ ipv4 | ipv6 | link | all ]
.......snip........
       ipmaddr show [ dev STRING ] [ ipv4 | ipv6 | link | all ]
       ipmaddr -V | -version
############## BUG
/sbin/ipmaddr --wrongoption
Usage: ipmaddr [ add | del ] MULTIADDR dev STRING
       ipmaddr show [ dev STRING ] [ ipv4 | ipv6 | link | all ]
.......snip........
       ipmaddr show [ dev STRING ] [ ipv4 | ipv6 | link | all ]
       ipmaddr -V | -version
############## BUG
/sbin/iptunnel wrongoption
Usage: iptunnel { add | change | del | show } [ NAME ]
          [ mode { ipip | gre | sit } ] [ remote ADDR ] [ local ADDR ]
.......snip........
       TTL  := { 1..255 | inherit }
       KEY  := { DOTTED_QUAD | NUMBER }
############## BUG
/sbin/iptunnel --wrongoption
Usage: iptunnel { add | change | del | show } [ NAME ]
          [ mode { ipip | gre | sit } ] [ remote ADDR ] [ local ADDR ]
.......snip........
       TTL  := { 1..255 | inherit }
       KEY  := { DOTTED_QUAD | NUMBER }
############## BUG
/sbin/nameif wrongoption
usage: nameif [-c configurationfile] [-s] {ifname macaddress}
.......snip........
usage: nameif [-c configurationfile] [-s] {ifname macaddress}
############## BUG
/sbin/nameif --wrongoption
/sbin/nameif: unrecognized option '--wrongoption'
usage: nameif [-c configurationfile] [-s] {ifname macaddress}
.......snip........
/sbin/nameif: unrecognized option '--wrongoption'
usage: nameif [-c configurationfile] [-s] {ifname macaddress}
############## BUG
/sbin/plipconfig --wrongoption
Usage: plipconfig interface [nibble NN] [trigger NN]
       plipconfig -V | --version
.......snip........
       plipconfig -V | --version
       plipconfig -h | --help
############## BUG
/sbin/route wrongoption
Usage: route [-nNvee] [-FC] [<AF>]           List kernel routing tables
       route [-v] [-FC] {add|del|flush} ...  Modify routing table for AF.
.......snip........
    netrom (AMPR NET/ROM) ipx (Novell IPX) ddp (Appletalk DDP) 
    x25 (CCITT X.25) 
############## BUG
/sbin/route --wrongoption
/sbin/route: unrecognized option '--wrongoption'
Usage: route [-nNvee] [-FC] [<AF>]           List kernel routing tables
.......snip........
    netrom (AMPR NET/ROM) ipx (Novell IPX) ddp (Appletalk DDP) 
    x25 (CCITT X.25) 
############## BUG
/sbin/slattach --wrongoption
Usage: slattach [-ehlLmnqv] [-k keepalive] [-o outfill] [-c cmd] [-s speed] [-p protocol] tty | -
       slattach -V | --version
.......snip........
Usage: slattach [-ehlLmnqv] [-k keepalive] [-o outfill] [-c cmd] [-s speed] [-p protocol] tty | -
       slattach -V | --version





Actual results:
return code is zero

Expected results:
return code shouldn't be zero

Additional info:
see bug 1257549
-----------

TEST:

[0 root@qeos-196 ~]# cat  /tmp/test.sh
#!/bin/bash
log=$(mktemp)
for bin in $(rpm -ql net-tools | grep bin);do
	for option in wrongoption --wrongoption;do
		$bin $option &> $log
		if [ $? -eq 0 ];then
			echo  '############## BUG'
			echo "$bin $option"
			head -n2 $log
			echo '.......snip........'
			tail -n2 $log
		fi
	done
done

Comment 7 errata-xmlrpc 2017-08-01 16:09:52 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:1873