Message ID | 1468944433-3515-2-git-send-email-blp@ovn.org |
---|---|
State | Accepted |
Headers | show |
On 19 July 2016 at 09:07, Ben Pfaff <blp@ovn.org> wrote: > A router port's "peer", if set, must point to another router port, but the > code as written also accepted switch ports. This caused problems when > switch ports were actually specified. > > Reported-by: Gurucharan Shetty <guru@ovn.org> > Reported-at: http://openvswitch.org/pipermail/dev/2016-July/075524.html > Signed-off-by: Ben Pfaff <blp@ovn.org> > Acked-by: Gurucharan Shetty <guru@ovn.org> > --- > ovn/northd/ovn-northd.c | 23 ++++++++++++++++++++++- > 1 file changed, 22 insertions(+), 1 deletion(-) > > diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c > index 7ce509d..9047635 100644 > --- a/ovn/northd/ovn-northd.c > +++ b/ovn/northd/ovn-northd.c > @@ -496,6 +496,12 @@ struct ovn_port { > > struct lport_addresses lrp_networks; > > + /* The port's peer: > + * > + * - A switch port S of type "router" has a router port R as a > peer, > + * and R in turn has S has its peer. > + * > + * - Two connected logical router ports have each other as peer. > */ > struct ovn_port *peer; > > struct ovn_datapath *od; > @@ -715,7 +721,22 @@ join_logical_ports(struct northd_context *ctx, > sizeof *op->od->router_ports * (op->od->n_router_ports + > 1)); > op->od->router_ports[op->od->n_router_ports++] = op; > } else if (op->nbr && op->nbr->peer) { > - op->peer = ovn_port_find(ports, op->nbr->peer); > + struct ovn_port *peer = ovn_port_find(ports, op->nbr->peer); > + if (peer) { > + if (peer->nbr) { > + op->peer = peer; > + } else { > + /* An ovn_port for a switch port of type "router" > does have > + * a router port as its peer (see the case above for > + * "router" ports), but this is set via > options:router-port > + * in Logical_Switch_Port and does not involve the > + * Logical_Router_Port's 'peer' column. */ > + static struct vlog_rate_limit rl = > + VLOG_RATE_LIMIT_INIT(5, 1); > + VLOG_WARN_RL(&rl, "Bad configuration: The peer of > router " > + "port %s is a switch port", op->key); > + } > + } > } > } > } > -- > 2.1.3 > >
diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c index 7ce509d..9047635 100644 --- a/ovn/northd/ovn-northd.c +++ b/ovn/northd/ovn-northd.c @@ -496,6 +496,12 @@ struct ovn_port { struct lport_addresses lrp_networks; + /* The port's peer: + * + * - A switch port S of type "router" has a router port R as a peer, + * and R in turn has S has its peer. + * + * - Two connected logical router ports have each other as peer. */ struct ovn_port *peer; struct ovn_datapath *od; @@ -715,7 +721,22 @@ join_logical_ports(struct northd_context *ctx, sizeof *op->od->router_ports * (op->od->n_router_ports + 1)); op->od->router_ports[op->od->n_router_ports++] = op; } else if (op->nbr && op->nbr->peer) { - op->peer = ovn_port_find(ports, op->nbr->peer); + struct ovn_port *peer = ovn_port_find(ports, op->nbr->peer); + if (peer) { + if (peer->nbr) { + op->peer = peer; + } else { + /* An ovn_port for a switch port of type "router" does have + * a router port as its peer (see the case above for + * "router" ports), but this is set via options:router-port + * in Logical_Switch_Port and does not involve the + * Logical_Router_Port's 'peer' column. */ + static struct vlog_rate_limit rl = + VLOG_RATE_LIMIT_INIT(5, 1); + VLOG_WARN_RL(&rl, "Bad configuration: The peer of router " + "port %s is a switch port", op->key); + } + } } } }
A router port's "peer", if set, must point to another router port, but the code as written also accepted switch ports. This caused problems when switch ports were actually specified. Reported-by: Gurucharan Shetty <guru@ovn.org> Reported-at: http://openvswitch.org/pipermail/dev/2016-July/075524.html Signed-off-by: Ben Pfaff <blp@ovn.org> --- ovn/northd/ovn-northd.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-)