Deletion of a logical router port, which may be an other
router peer, result in a WARN, because the "ports" variable
still contains the logical port deleted. This port exists
but should not have been initialized fully.

nbsp == NULL, nbrp == NULL

It is necessary to check 'nbsp'.

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 <g...@ovn.org>
Reported-at: http://openvswitch.org/pipermail/dev/2016-July/075524.html
Signed-off-by: Ben Pfaff <b...@ovn.org>
Acked-by: Gurucharan Shetty <g...@ovn.org>
Signed-off-by: nickcooper-zhangtonghao <nickcooper-zhangtong...@opencloud.tech>
---
 ovn/northd/ovn-northd.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c
index a3d1672..efc915c 100644
--- a/ovn/northd/ovn-northd.c
+++ b/ovn/northd/ovn-northd.c
@@ -746,9 +746,15 @@ join_logical_ports(struct northd_context *ctx,
         } else if (op->nbrp && op->nbrp->peer) {
             struct ovn_port *peer = ovn_port_find(ports, op->nbrp->peer);
             if (peer) {
+                /* Deletion of a logical router port, which may be an other
+                 * router peer, result in a WARN, because the "ports" variable
+                 * still contains the logical port deleted. This port exists 
+                 * but should not have been initialized fully.
+                 *
+                 * nbsp == NULL, nbrp == NULL */
                 if (peer->nbrp) {
                     op->peer = peer;
-                } else {
+                } else if (peer->nbsp) {
                     /* 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
-- 
1.8.3.1



_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to