[ovs-dev] [patch_ports (rebased) 3/4] ofproto-dpif: Implement patch ports in userspace.

Ethan Jackson ethan at nicira.com
Thu Jan 24 02:05:29 UTC 2013


> set_patch_config() checks that the peer name is less than IFNAMSIZ
> bytes but I don't know why we care.

Good point, this is leftover from when patch ports were linux specific.  Which
has me thinking, at some point we'll need to start building patch ports (and
possibly tunnels) on other platforms.  Soon, they will have no linux specific
code.

An incremental follows.

---
 lib/netdev-vport.c     |    5 -----
 ofproto/ofproto-dpif.c |    4 ++--
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c
index 4054ee0..cd6ae54 100644
--- a/lib/netdev-vport.c
+++ b/lib/netdev-vport.c
@@ -820,11 +820,6 @@ set_patch_config(struct netdev_dev *dev_, const struct smap *args)
         return EINVAL;
     }
 
-    if (strlen(peer) >= IFNAMSIZ) {
-        VLOG_ERR("%s: patch 'peer' arg too long", name);
-        return EINVAL;
-    }
-
     if (!strcmp(name, peer)) {
         VLOG_ERR("%s: patch peer must not be self", name);
         return EINVAL;
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index 2de2964..d5bd0b4 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -5521,7 +5521,7 @@ compose_output_action__(struct action_xlate_ctx *ctx, uint16_t ofp_port,
 
     if (netdev_vport_is_patch(ofport->up.netdev)) {
         struct ofport_dpif *peer = ofport_get_peer(ofport);
-        uint16_t old_in_port = ctx->flow.in_port;
+        struct flow old_flow = ctx->flow;
         const struct ofproto_dpif *peer_ofproto;
 
         if (!peer) {
@@ -5538,7 +5538,7 @@ compose_output_action__(struct action_xlate_ctx *ctx, uint16_t ofp_port,
         ctx->ofproto = ofproto_dpif_cast(peer->up.ofproto);
         ctx->flow.in_port = peer->up.ofp_port;
         xlate_table_action(ctx, ctx->flow.in_port, 0, true);
-        ctx->flow.in_port = old_in_port;
+        ctx->flow = old_flow;
         ctx->ofproto = ofproto_dpif_cast(ofport->up.ofproto);
 
         if (ctx->resubmit_stats) {
-- 
1.7.9.5




More information about the dev mailing list