[BusyBox 0001122]: ifupdown on non-existent interface segfaults, busybox-1.3

bugs at busybox.net bugs at busybox.net
Wed Dec 20 07:50:00 UTC 2006


A NOTE has been added to this issue. 
====================================================================== 
http://busybox.net/bugs/view.php?id=1122 
====================================================================== 
Reported By:                espakman
Assigned To:                BusyBox
====================================================================== 
Project:                    BusyBox
Issue ID:                   1122
Category:                   Networking Support
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     feedback
====================================================================== 
Date Submitted:             12-17-2006 12:10 PST
Last Modified:              12-19-2006 23:50 PST
====================================================================== 
Summary:                    ifupdown on non-existent interface segfaults,
busybox-1.3
Description: 
When running ifup on a non-existent interface (but configured in
/etc/network/interfaces) gives a segfault. Revision 16646 seems to
introduce the segfault.
====================================================================== 

---------------------------------------------------------------------- 
 vda - 12-18-06 11:57  
---------------------------------------------------------------------- 
Show your /etc/network/interfaces please. 

---------------------------------------------------------------------- 
 vda - 12-18-06 13:00  
---------------------------------------------------------------------- 
Try attached c.patch and let us know whether that works 

---------------------------------------------------------------------- 
 vda - 12-18-06 13:02  
---------------------------------------------------------------------- 
c.patch applied in rev 16994, waiting for feedback 

---------------------------------------------------------------------- 
 espakman - 12-19-06 11:52  
---------------------------------------------------------------------- 
The segfault is gone, but now the following message is displayed on every
interface:
"ifup: don't see to have all variables for ethx/inet"
(x is 0, 1, ..)

I think it's because of the "[[ ip ....%gateway% ]]". Removed extra spaces
w/o checking" change. But haven't tested it yet. 

---------------------------------------------------------------------- 
 espakman - 12-19-06 12:37  
---------------------------------------------------------------------- 
Just tested and the "don't seem to have all variables" problem is not gone
with reverting the "Removed extra spaces w/o checking" part (although I'm
not sure why you did that). 

---------------------------------------------------------------------- 
 vda - 12-19-06 12:42  
---------------------------------------------------------------------- 
>(although I'm not sure why you did that)

Because there is no reason why we should issue " ip ... " with leading
space, I think.

Show your /etc/network/interfaces. Please. 

---------------------------------------------------------------------- 
 espakman - 12-19-06 12:46  
---------------------------------------------------------------------- 
My /etc/network/interfaces file:

# Loopback interface.
auto lo
iface lo inet loopback

# dhcp
auto eth0
iface eth0 inet dhcp

# fixed
auto eth1
iface eth1 inet static
	address 192.168.1.254
	netmask 255.255.255.0
	broadcast 192.168.1.255 

---------------------------------------------------------------------- 
 bernhardf - 12-19-06 13:29  
---------------------------------------------------------------------- 
1) add -a in the commands below, if you specify it please.
Just curious as to what libc are you using?
$ ifdown -v
$ ifup -v 

---------------------------------------------------------------------- 
 espakman - 12-19-06 14:05  
---------------------------------------------------------------------- 
> Just curious as to what libc are you using?

Using uClibc-0.9.28

> $ ifdown -va
> $ ifup -v

I have to run it in Qemu, running it on my router will bring my connection
down and hard to repair (have to switch busybox too..). I will give the
differences in output between busybox-1.2.2.1 and 1.3.0 + your ifupdown
patch.

ifdown -va
with 1.3.0:
....
ip addr flush dev eth1
Nothing to flush.
ip link set eth1 down

with 1.2.2.1:
ip addr flush dev eth1
ip link set eth1 down

ifup -va
with 1.3.0:
......
ifup: don't seem to have all the variables for eth1/inet

with 1.2.2.1:
......
run-parts /etc/network/if-pre-up.d
ip addr add 192.168.1.254/24 broadcast 192.168.1.255 dev eth1  label eth1
ip link set    eth1 up

run-parts /etc/network/if-up.d


The /etc/network/interfaces file is exactly the same in both cases. 

---------------------------------------------------------------------- 
 vda - 12-19-06 14:06  
---------------------------------------------------------------------- 
Hmmm.... indeed. Looks like parse() returning "" and returning NULL
actually means different things! Attached (possibly fixed) ifup comes
further on my system:

# ./ifup eth1
run-parts: cannot open '/etc/network/if-pre-up.d': No such file or
directory

Please test-and-report and/or send me your entire /etc/network/*. 

---------------------------------------------------------------------- 
 espakman - 12-19-06 14:24  
---------------------------------------------------------------------- 
Still the same problem:

ifup: don't seem to have all the variables for eth1/inet

The contents of my /etc/network/ directory:
if-down.d/
if-post-down.d/
if-pre-up.d/
if-up.d/
interfaces

For testing the if-* directories contains no files. 

---------------------------------------------------------------------- 
 vda - 12-19-06 15:00  
---------------------------------------------------------------------- 
I created empty directories and renamed eth1 to if (my real ethernet iface
name). Then:

# ifup -vn if
run-parts /etc/network/if-pre-up.d
ip addr add 192.168.1.254/24 dev if label if
ip link set if up

run-parts /etc/network/if-up.d

# ifup -v if
run-parts /etc/network/if-pre-up.d
ip addr add 192.168.1.254/24 dev if label if
ip link set if up

run-parts /etc/network/if-up.d

# ip a
1: lo: <LOOPBACK,UP,10000> mtu 16436 qdisc noqueue
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
2: if: <BROADCAST,MULTICAST,UP,10000> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:16:17:6d:77:db brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.111/24 brd 192.168.1.255 scope global if
    inet 192.168.1.254/24 scope global secondary if

So it works for me with /etc/network exactly as yours. I also
double-checked that I really use ifupdown.c like one attached on this
page. 

---------------------------------------------------------------------- 
 espakman - 12-19-06 23:50  
---------------------------------------------------------------------- 
My latest tests also indicate that, when using 1 interface. When using two
interfaces eth0 and eth1 (and loopback) the "don't seem to have all
variables" message showed up on the second physical interface (busybox
1.3.0, not with 1.2.2.1).

I don't have the tools at the moment to doublecheck, will do that this
evening (UTC). 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
12-17-06 12:10  espakman       New Issue                                    
12-17-06 12:10  espakman       Status                   new => assigned     
12-17-06 12:10  espakman       Assigned To               => BusyBox         
12-18-06 11:57  vda            Note Added: 0001877                          
12-18-06 13:00  vda            File Added: c.patch                          
12-18-06 13:00  vda            Note Added: 0001878                          
12-18-06 13:02  vda            Note Added: 0001879                          
12-18-06 14:52  vda            Status                   assigned => feedback
12-19-06 11:52  espakman       Note Added: 0001886                          
12-19-06 12:37  espakman       Note Added: 0001887                          
12-19-06 12:42  vda            Note Added: 0001888                          
12-19-06 12:46  espakman       Note Added: 0001889                          
12-19-06 13:29  bernhardf      Note Added: 0001890                          
12-19-06 14:05  espakman       Note Added: 0001891                          
12-19-06 14:06  vda            Note Added: 0001892                          
12-19-06 14:06  vda            File Added: ifupdown.c                       
12-19-06 14:24  espakman       Note Added: 0001893                          
12-19-06 15:00  vda            Note Added: 0001894                          
12-19-06 23:50  espakman       Note Added: 0001897                          
======================================================================




More information about the busybox-cvs mailing list