From 84b32864207813c5f4b9989f66303a577cb01ba0 Mon Sep 17 00:00:00 2001 From: Ethan Jackson Date: Mon, 25 Apr 2011 16:06:54 -0700 Subject: [PATCH] bridge: Create new "null" interface type. Null interfaces are completely ignored by Open vSwitch. --- vswitchd/bridge.c | 21 +++++++++++++-------- vswitchd/vswitch.xml | 2 ++ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index 20ecca356..84ed03e80 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -2951,12 +2951,12 @@ port_reconfigure(struct port *port, const struct ovsrec_port *cfg) port->cfg = cfg; - /* Add new interfaces and update 'cfg' member of existing ones. */ sset_init(&new_ifaces); for (i = 0; i < cfg->n_interfaces; i++) { const struct ovsrec_interface *if_cfg = cfg->interfaces[i]; struct iface *iface; + const char *type; if (!sset_add(&new_ifaces, if_cfg->name)) { VLOG_WARN("port %s: %s specified twice as port interface", @@ -2965,8 +2965,18 @@ port_reconfigure(struct port *port, const struct ovsrec_port *cfg) continue; } + /* Determine interface type. The local port always has type + * "internal". Other ports take their type from the database and + * default to "system" if none is specified. */ + type = (!strcmp(if_cfg->name, port->bridge->name) ? "internal" + : if_cfg->type[0] ? if_cfg->type + : "system"); + iface = iface_lookup(port->bridge, if_cfg->name); - if (iface) { + if (!strcmp(type, "null")) { + iface_destroy(iface); + continue; + } else if (iface) { if (iface->port != port) { VLOG_ERR("bridge %s: %s interface is on multiple ports, " "removing from %s", @@ -2978,12 +2988,7 @@ port_reconfigure(struct port *port, const struct ovsrec_port *cfg) iface = iface_create(port, if_cfg); } - /* Determine interface type. The local port always has type - * "internal". Other ports take their type from the database and - * default to "system" if none is specified. */ - iface->type = (!strcmp(if_cfg->name, port->bridge->name) ? "internal" - : if_cfg->type[0] ? if_cfg->type - : "system"); + iface->type = type; } sset_destroy(&new_ifaces); diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml index 4cdc1b1ca..ce00cbd70 100644 --- a/vswitchd/vswitch.xml +++ b/vswitchd/vswitch.xml @@ -1047,6 +1047,8 @@ +
null
+
An ignored interface.
-- 2.43.0