Thank you for fixing this. One question: If add successful but query fails, are there any cleanup need to be done here or it will be done in later loop?
Especially if query is temporary failure will the current code lead to irrecoverable state for the port? Guolin On Sat, Nov 2, 2013 at 10:06 PM, Ben Pfaff <b...@nicira.com> wrote: > Otherwise, if the port add succeeds but the query that looks up the port > number fails, then ofproto_port_add() would return zero as the OpenFlow > port number and ignore the error. > > Reported-by: Guolin Yang <gy...@vmware.com> > Signed-off-by: Ben Pfaff <b...@nicira.com> > --- > v1 was posted on March 19. This version is merely a rebase of v1. > > AUTHORS | 1 + > ofproto/ofproto.c | 18 ++++++++++++------ > 2 files changed, 13 insertions(+), 6 deletions(-) > > diff --git a/AUTHORS b/AUTHORS > index ac7886b..8154e40 100644 > --- a/AUTHORS > +++ b/AUTHORS > @@ -154,6 +154,7 @@ Giuseppe de Candia giuseppe.decan...@gmail.com > Gordon Good gg...@nicira.com > Greg Dahlman gdahl...@hotmail.com > Gregor Schaffrath gr...@net.t-labs.tu-berlin.de > +Guolin Yang gy...@vmware.com > Hassan Khan hassan.k...@seecs.edu.pk > Hector Oron hector.o...@gmail.com > Henrik Amren hen...@nicira.com > diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c > index b88cd81..b4ddb4d 100644 > --- a/ofproto/ofproto.c > +++ b/ofproto/ofproto.c > @@ -1758,12 +1758,18 @@ ofproto_port_add(struct ofproto *ofproto, struct > netdev *netdev, > update_port(ofproto, netdev_name); > } > if (ofp_portp) { > - struct ofproto_port ofproto_port; > - > - ofproto_port_query_by_name(ofproto, netdev_get_name(netdev), > - &ofproto_port); > - *ofp_portp = error ? OFPP_NONE : ofproto_port.ofp_port; > - ofproto_port_destroy(&ofproto_port); > + *ofp_portp = OFPP_NONE; > + if (!error) { > + struct ofproto_port ofproto_port; > + > + error = ofproto_port_query_by_name(ofproto, > + netdev_get_name(netdev), > + &ofproto_port); > + if (!error) { > + *ofp_portp = ofproto_port.ofp_port; > + ofproto_port_destroy(&ofproto_port); > + } > + } > } > return error; > } > -- > 1.7.10.4 > > _______________________________________________ > dev mailing list > dev@openvswitch.org > http://openvswitch.org/mailman/listinfo/dev >
_______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev