[BusyBox 0000752]: ifconfig error reporting missing; bogus exit status

bugs at busybox.net bugs at busybox.net
Wed Nov 29 00:22:55 UTC 2006


A NOTE has been added to this issue. 
====================================================================== 
http://busybox.net/bugs/view.php?id=752 
====================================================================== 
Reported By:                schweikhardt
Assigned To:                BusyBox
====================================================================== 
Project:                    BusyBox
Issue ID:                   752
Category:                   Other
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     assigned
====================================================================== 
Date Submitted:             02-21-2006 01:37 PST
Last Modified:              11-28-2006 16:22 PST
====================================================================== 
Summary:                    ifconfig error reporting missing; bogus exit status
Description: 
The ifconfig utility silently ignores certain erroneous invocations.
On the other hand, it reports certain successful invocations with a
non-zero exit status. This makes ifconfig pretty much unsusable in shell
scripts using "set -e" as well as Makefiles.

How to reproduce on BusyBox v1.00-rc3 (2004.10.07-07:15+0000) multi-call
binary:

# ifconfig lo inet 127.0.0.1/8   <--invalid syntax
#  (no error message, exit status 2)


# ifconfig lo inet 127.0.0.1          
# echo $?
1    # What's wrong? Should be 0.
# ifconfig eth2 inet 10.0.0.1 netmask 0xFF000000
# echo $?
1    # What's wrong? Should be 0.
  
Could someone please review all the places where ifconfig does exit() or
return from main() for consistency? Ideally 0 and 1 should be the only two
exit status values ever seen, just like for many POSIX utilities. Thanks a
bunch!

====================================================================== 

---------------------------------------------------------------------- 
 schweikhardt - 03-09-06 08:14  
---------------------------------------------------------------------- 
It was brought to my attention that specifying the protocol familiy with
"inet"
is not supported by busybox ifconfig. If that is correct, this would
explain
exit status 1 for the second and third example in my original
description.
But still, there's no error message which is extremely confusing because
it misleads one to think everything went fine, when in fact the command
failed.

Jens Schweikhardt 

---------------------------------------------------------------------- 
 vda - 11-28-06 16:22  
---------------------------------------------------------------------- 
Fixed in current svn:

./busybox ifconfig lo inet 127.0.0.1; echo $?
ifconfig: inet: Unknown host

# ./busybox ifconfig lo inet 10.0.0.1 netmask 0xFF000000
ifconfig: inet: Unknown host

# ./busybox ifconfig lo -inet 10.0.0.1 netmask 0xFF000000
ifconfig: -inet: Unknown host

Actually ifconfig does not support "inet", no mention of this in --help:

# ./busybox ifconfig --help
BusyBox v1.2.2.svn (2006-11-28 20:46:20 CET) multi-call binary

Usage: ifconfig [-a] <interface> [<address>]

configure a network interface

Options:
        [add <address>[/<prefixlen>]]
        [del <address>[/<prefixlen>]]
        [[-]broadcast [<address>]]  [[-]pointopoint [<address>]]
        [netmask <address>]  [dstaddr <address>]
        [outfill <NN>] [keepalive <NN>]
        [hw ether <address>]  [metric <NN>]  [mtu <NN>]
        [[-]trailers]  [[-]arp]  [[-]allmulti]
        [multicast]  [[-]promisc]  [txqueuelen <NN>]  [[-]dynamic]
        [mem_start <NN>]  [io_addr <NN>]  [irq <NN>]
        [up|down] ... 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
02-21-06 01:37  schweikhardt   New Issue                                    
02-21-06 01:37  schweikhardt   Status                   new => assigned     
02-21-06 01:37  schweikhardt   Assigned To               => BusyBox         
03-09-06 08:14  schweikhardt   Note Added: 0001180                          
11-28-06 16:22  vda            Note Added: 0001830                          
======================================================================




More information about the busybox-cvs mailing list