compat: Only create interface when configured to do so.

Add config option <compat_create_interfaces>:

  Denotes where or not to create interfaces when compat_* settings are
  active and it would be necessary to create an interface to be fully
  compliant.  This could happen when inheriting bridge VLAN settings to
  an interface within a bridges bridge-ports setting but no interface
  stanza is found.  Valid values are 0 and 1, the default is 1.

Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
This commit is contained in:
Maximilian Wilhelm 2020-10-18 05:14:03 +02:00
parent d86297f29c
commit 480fc5eecb
5 changed files with 27 additions and 1 deletions

View file

@ -68,7 +68,7 @@ compat_ifupdown2_bridge_ports_inherit_vlans(struct lif_dict *collection)
if (entry)
bridge_port = entry->data;
else
else if (lif_config.compat_create_interfaces)
{
bridge_port = lif_interface_collection_find(collection, tokenp);
if (bridge_port == NULL)
@ -78,6 +78,14 @@ compat_ifupdown2_bridge_ports_inherit_vlans(struct lif_dict *collection)
}
}
/* We would have to creaet an interface, but shouldn't */
else
{
fprintf(stderr, "compat: Missing interface stanza for bridge-port \"%s\" but should not create one.\n",
tokenp);
continue;
}
/* Maybe pimp bridge-pvid */
struct lif_dict_entry *port_pvid = lif_dict_find(&bridge_port->vars, "bridge-pvid");
if (bridge_pvid && !port_pvid)