Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at

Bug 1258941

Summary: Netstat tool does not throw correct exit code on wrong parameter
Product: [Fedora] Fedora Reporter: Tomáš Hozza <thozza>
Component: net-toolsAssignee: Jiri Popelka <jpopelka>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 23CC: jpopelka, mtoth, odehnal.tomas136, qe-baseos-daemons
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: net-tools-2.0-0.37.20160329git.fc24 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1257549 Environment:
Last Closed: 2016-04-02 15:54:38 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:
Bug Depends On:    
Bug Blocks: 1257549    
Description Flags
Fix exit code (urecognized argument)
netstat: Fix exit code (unrecognized argument) none

Description Tomáš Hozza 2015-09-01 14:37:47 UTC
+++ This bug was initially created as a clone of Bug #1257549 +++

Description of problem:
netstat tool does not throw any exit code other then 0. 
You can provide any input parameter and still get error code 0.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Issue any arbitrary parameter to netstat
$ netstat --asd
netstat: unrecognized option '--asd'
usage: netstat [-vWeenNcCF] [<Af>] -r         netstat {-V|--version|-h|--help}
       netstat [-vWnNcaeol] [<Socket> ...]
       netstat { [-vWeenNac] -I[<Iface>] | [-veenNac] -i | [-cnNe] -M | -s [-6tuw] } [delay]

        -r, --route              display routing table
        -I, --interfaces=<Iface> display interface table for <Iface>
        -i, --interfaces         display interface table
        -g, --groups             display multicast group memberships
        -s, --statistics         display networking statistics (like SNMP)
        -M, --masquerade         display masqueraded connections

        -v, --verbose            be verbose
        -W, --wide               don't truncate IP addresses
        -n, --numeric            don't resolve names
        --numeric-hosts          don't resolve host names
        --numeric-ports          don't resolve port names
        --numeric-users          don't resolve user names
        -N, --symbolic           resolve hardware names
        -e, --extend             display other/more information
        -p, --programs           display PID/Program name for sockets
        -o, --timers             display timers
        -c, --continuous         continuous listing

        -l, --listening          display listening server sockets
        -a, --all                display all sockets (default: connected)
        -F, --fib                display Forwarding Information Base (default)
        -C, --cache              display routing cache instead of FIB
        -Z, --context            display SELinux security context for sockets

  <Socket>={-t|--tcp} {-u|--udp} {-U|--udplite} {-w|--raw} {-x|--unix}
           --ax25 --ipx --netrom
  <AF>=Use '-6|-4' or '-A <af>' or '--<af>'; default: inet
  List of possible address families (which support routing):
    inet (DARPA Internet) inet6 (IPv6) ax25 (AMPR AX.25) 
    netrom (AMPR NET/ROM) ipx (Novell IPX) ddp (Appletalk DDP) 
    x25 (CCITT X.25) 

2. Observe the exit code
$ echo $?

Actual results:
Exit code is always 0

Expected results:
Exit differs from 0

Additional info:
In RHEL6 & net-tools-1.60-110.el6_2 I can see exit code "4" when provided given wrong input parameter.
Also, this error is present in various distributions like Fedora 19, 22 and Gentoo

--- Additional comment from RHEL Product and Program Management on 2015-08-27 12:27:48 CEST ---

Since this bug report was entered in bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.

Comment 1 Tomáš Odehnal 2015-09-10 07:02:04 UTC
Created attachment 1072034 [details]
Fix exit code (urecognized argument)

Comment 2 Jiri Popelka 2015-09-10 07:53:36 UTC
Tomáš & Michael:

Can we use
instead of

Also, can you create a patch against upstream git repo, so we can send it upstream ?

$ git config --global "John Doe"
$ git config --global johndoe
$ git clone git:// net-tools
$ cd net-tools
apply your change
$ git commit -am "netstat: Fix exit code (urecognized argument)"
$ git format-patch HEAD~1
attach the 0001-*.patch


Comment 3 Tomáš Odehnal 2015-09-10 10:38:30 UTC
Created attachment 1072083 [details]
netstat: Fix exit code (unrecognized argument)

Comment 4 Jiri Popelka 2015-10-30 14:41:39 UTC
Merged upstream:

Comment 5 Mike McCune 2016-03-28 22:49:28 UTC
This bug was accidentally moved from POST to MODIFIED via an error in automation, please see mmccune with any questions

Comment 6 Fedora Update System 2016-03-30 14:39:23 UTC
net-tools-2.0-0.37.20160329git.fc24 has been submitted as an update to Fedora 24.

Comment 7 Fedora Update System 2016-03-30 22:25:06 UTC
net-tools-2.0-0.37.20160329git.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See for
instructions on how to install test updates.
You can provide feedback for this update here:

Comment 8 Fedora Update System 2016-04-02 15:54:36 UTC
net-tools-2.0-0.37.20160329git.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.