[PATCH] ifupdown: Allow duplicate interface definitions.

Nicolas Cavallari nicolas.cavallari at green-communications.fr
Wed Feb 17 10:51:26 UTC 2016


This patch allow to have multiple interface definitions, much like
Debian's ifupdown.  More specifically, it removes the check for a
duplicate definition, so the impact on binary size should be fairly
minimal.

This configuration:

iface eth0 inet static
	address 192.168.0.15
	netmask 255.255.0.0
	gateway 192.168.0.1

iface eth0 inet static
	address 10.0.0.1
	netmask	255.255.255.0

Will add two addresses to eth0 if ip is used.  If ifconfig is used,
the standards methods will likely not stack, but the administrator may
still use the manual method.  The DHCP method may work depending on the
DHCP client in use.

This is a fairly advanced feature for power users who knows what they
are doing.  There are not many other network configuration systems that
allows multiple addresses on an interface.
---
 networking/ifupdown.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/networking/ifupdown.c b/networking/ifupdown.c
index 766dfab..4e549c0 100644
--- a/networking/ifupdown.c
+++ b/networking/ifupdown.c
@@ -876,14 +876,6 @@ static struct interfaces_file_t *read_interfaces(const char *filename, struct in
 			if (!currif->method)
 				bb_error_msg_and_die("unknown method \"%s\"", method_name);
 
-			for (iface_list = defn->ifaces; iface_list; iface_list = iface_list->link) {
-				struct interface_defn_t *tmp = (struct interface_defn_t *) iface_list->data;
-				if ((strcmp(tmp->iface, currif->iface) == 0)
-				 && (tmp->address_family == currif->address_family)
-				) {
-					bb_error_msg_and_die("duplicate interface \"%s\"", tmp->iface);
-				}
-			}
 			llist_add_to_end(&(defn->ifaces), (char*)currif);
 
 			debug_noise("iface %s %s %s\n", currif->iface, address_family_name, method_name);
-- 
2.7.0



More information about the busybox mailing list