From: Justin Pettit Date: Mon, 6 Apr 2009 23:54:49 +0000 (-0700) Subject: Add hack to get around "." delimiter problem with policing vifs. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ad89e47be6fd59a795ff786e16a0d8ea0dd3d8f6;p=openvswitch Add hack to get around "." delimiter problem with policing vifs. The vswitchd.conf format uses "." as a delimiter. Unfortunately, vifs use a "." in their name. The port is specified as part of the key when ingress policing is enabled, but the cfg parser balks at this. For the time-being, we check all valid ports to see if they have a policing policy defined. This is wasteful, but it works until we change the delimiter. --- diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index 1798ea0b..11a08ff9 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -242,6 +242,34 @@ static struct ofhooks bridge_ofhooks; /* Public functions. */ +/* xxx Temporary to get around "." delimiter vswitchd.conf problem in + * xxx port.c. */ +void +bridge_get_ifaces(struct svec *svec) +{ + struct bridge *br, *next; + size_t i, j; + + LIST_FOR_EACH_SAFE (br, next, struct bridge, node, &all_bridges) { + bridge_fetch_dp_ifaces(br); + for (i = 0; i < br->n_ports; i++) { + struct port *port = br->ports[i]; + + for (j = 0; j < port->n_ifaces; j++) { + struct iface *iface = port->ifaces[j]; + if (iface->dp_ifidx < 0) { + VLOG_ERR("%s interface not in dp%u, ignoring", + iface->name, dpif_id(&br->dpif)); + } else { + if (iface->dp_ifidx != ODPP_LOCAL) { + svec_add(svec, iface->name); + } + } + } + } + } +} + /* The caller must already have called cfg_read(). */ void bridge_init(void) diff --git a/vswitchd/bridge.h b/vswitchd/bridge.h index b6c600ee..22dadf95 100644 --- a/vswitchd/bridge.h +++ b/vswitchd/bridge.h @@ -30,11 +30,14 @@ #include #include "list.h" +struct svec; + void bridge_init(void); void bridge_reconfigure(void); int bridge_run(void); void bridge_wait(void); bool bridge_exists(const char *); uint64_t bridge_get_datapathid(const char *name); +void bridge_get_ifaces(struct svec *svec); #endif /* bridge.h */ diff --git a/vswitchd/port.c b/vswitchd/port.c index 7b4a9e7b..419e832d 100644 --- a/vswitchd/port.c +++ b/vswitchd/port.c @@ -27,6 +27,7 @@ #include +#include "bridge.h" #include "cfg.h" #include "netdev.h" #include "port.h" @@ -74,6 +75,19 @@ port_init(void) void port_reconfigure(void) { +#if 1 + /* xxx Hack to get around interfaces with a "." in their name, since + * xxx that is the delimiter in vswitchd.conf. Once the delimiter + * xxx is changed, this portion of the code can be removed. */ + struct svec ports; + int i; + + svec_init(&ports); + bridge_get_ifaces(&ports); + for (i=0; i