ifupdown: support 'link' address family
authorKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
Mon, 3 Feb 2014 14:56:20 +0000 (15:56 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Mon, 3 Feb 2014 14:56:20 +0000 (15:56 +0100)
Does not configure anything. L2 configuration hook scripts should do
their job on receiving ADDRFAM=link. Configuration will be done only
once, irrespective of L3 protocols used.

Using the 'link' family in the interfaces file conforms to the Debian
implementation:

http://sources.debian.net/src/ifupdown/0.7.47.1/link.defn

function                                             old     new   delta
link_methods                                           -      12     +12
addr_link                                              -      12     +12
link_up_down                                           -       6      +6
static.addr_fams                                      12      16      +4
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 1/0 up/down: 34/0)               Total: 34 bytes

Signed-off-by: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
networking/ifupdown.c

index 0f0857cb41160b3eec39c696dcb9185f440f078c..e1ea351a419f5cd020f00d34c2428c9ac9ff51d1 100644 (file)
@@ -685,6 +685,18 @@ static const struct address_family_t addr_inet = {
 
 #endif  /* FEATURE_IFUPDOWN_IPV4 */
 
+static int FAST_FUNC link_up_down(struct interface_defn_t *ifd UNUSED_PARAM, execfn *exec UNUSED_PARAM)
+{
+       return 1;
+}
+
+static const struct method_t link_methods[] = {
+       { "none", link_up_down, link_up_down }
+};
+
+static const struct address_family_t addr_link = {
+       "link", ARRAY_SIZE(link_methods), link_methods
+};
 
 /* Returns pointer to the next word, or NULL.
  * In 1st case, advances *buf to the word after this one.
@@ -831,6 +843,7 @@ static struct interfaces_file_t *read_interfaces(const char *filename, struct in
 #if ENABLE_FEATURE_IFUPDOWN_IPV6
                                &addr_inet6,
 #endif
+                               &addr_link,
                                NULL
                        };
                        char *iface_name;