[ovs-dev] [branch-1.1 31/34] ofproto: Adjust netdev_monitor when switching netdevs.

Ben Pfaff blp at nicira.com
Fri Apr 29 21:57:02 UTC 2011

This fixes a segfault in the "ofproto - mod-port" test.  The segfault
should not occur--there must be a bug in the netdev_monitor or possibly
the netdev_dummy implementation--but the netdev_monitor_remove() and
netdev_monitor_add() calls are definitely wanted here in any case to ensure
that the new netdev, not the old one, is what gets monitored.
 ofproto/ofproto.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index f44b736..737b86b 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -1202,6 +1202,9 @@ ofport_modified(struct ofproto *ofproto, struct ofport *port,
     port->opp.supported = opp->supported;
     port->opp.peer = opp->peer;
+    netdev_monitor_remove(ofproto->netdev_monitor, port->netdev);
+    netdev_monitor_add(ofproto->netdev_monitor, netdev);
     port->netdev = netdev;

More information about the dev mailing list