What steps will reproduce the problem?
1. Parse an /etc/network/interfaces files that has allow-hotplug entries.
2. Using the dump operation works fine, but the unparse operation produces
(null)
3. Run the command llconf ifupdown -i /etc/network/interfaces -o - unparse
What is the expected output? What do you see instead?
The expected output is
# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or
# /usr/share/doc/ifupdown/examples for more information.
auto lo eth0 eth1 eth2 eth3
iface lo inet loopback
allow-hotplug eth0
iface eth0 inet dhcp
pre-up touch /lib/init/rw/resolv.conf
iface eth1 inet static
address 192.168.0.1
netmask 255.255.255.0
pre-up touch /lib/init/rw/resolv.conf
allow-hotplug eth2
iface eth2 inet dhcp
pre-up touch /lib/init/rw/resolv.conf
allow-hotplug eth3
iface eth3 inet dhcp
pre-up touch /lib/init/rw/resolv.conf
allow-hotplug wlan0
iface wlan0 inet dhcp
pre-up touch /lib/init/rw/resolv.conf
wpa-ssid ssid
wpa-psk psk
BUT it actually is
# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or
# /usr/share/doc/ifupdown/examples for more information.
auto lo eth0 eth1 eth2 eth3
iface lo inet loopback
(null)
iface eth0 inet dhcp
pre-up touch /lib/init/rw/resolv.conf
iface eth1 inet static
address 192.168.0.1
netmask 255.255.255.0
pre-up touch /lib/init/rw/resolv.conf
(null)
iface eth2 inet dhcp
pre-up touch /lib/init/rw/resolv.conf
(null)
iface eth3 inet dhcp
pre-up touch /lib/init/rw/resolv.conf
(null)
iface wlan0 inet dhcp
pre-up touch /lib/init/rw/resolv.conf
wpa-ssid ssid
wpa-psk psk
What version of the product are you using? On what operating system?
Using 0.4.6.
Please provide any additional information below.
Applying the patch below fixes this:
--- ifupdown-old.c 2009-11-18 14:36:30.000000000 -0500
+++ ifupdown.c 2009-11-18 14:37:09.000000000 -0500
@@ -263,6 +263,16 @@
}
snprintf(b1, 255, "%s\n", b0);
cl_list = append_confline(cl_list, cl =
create_confline(b1));
+ }else if(strncmp(cn_top->name, "allow-", 6) == 0){
+ char buf1[256], *b0 = buf, *b1 = buf1, *tmp;
+
+ snprintf(b0, 255, "%s", cn_top->name);
+ for(cn = cn_top->first_child; cn; cn = cn->next){
+ snprintf(b1, 255, "%s %s", b0, cn->name);
+ tmp = b0; b0 = b1; b1 = tmp;
+ }
+ snprintf(b1, 255, "%s\n", b0);
+ cl_list = append_confline(cl_list, cl =
create_confline(b1));
}else if(strcmp(cn_top->name, "mapping") == 0){
cn = cn_top->first_child;
Original issue reported on code.google.com by
fomoj...@gmail.comon 18 Nov 2009 at 7:49