X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Flacp.c;h=49ae5e5a2d41933ef161e49e16eaae48a5c20590;hb=HEAD;hp=711d7ec12d640c121d595c91b5029eea81ae1e18;hpb=79f108b14e7944ddc4669e9c03fc34b40a3a2288;p=sliver-openvswitch.git diff --git a/lib/lacp.c b/lib/lacp.c index 711d7ec12..49ae5e5a2 100644 --- a/lib/lacp.c +++ b/lib/lacp.c @@ -181,7 +181,7 @@ parse_lacp_packet(const struct ofpbuf *b) { const struct lacp_pdu *pdu; - pdu = ofpbuf_at(b, (uint8_t *)ofpbuf_get_l3(b) - (uint8_t *)b->data, + pdu = ofpbuf_at(b, (uint8_t *)ofpbuf_l3(b) - (uint8_t *)ofpbuf_data(b), LACP_PDU_LEN); if (pdu && pdu->subtype == 1 @@ -345,18 +345,18 @@ out: enum lacp_status lacp_status(const struct lacp *lacp) OVS_EXCLUDED(mutex) { - enum lacp_status ret; + if (lacp) { + enum lacp_status ret; - ovs_mutex_lock(&mutex); - if (!lacp) { - ret = LACP_DISABLED; - } else if (lacp->negotiated) { - ret = LACP_NEGOTIATED; + ovs_mutex_lock(&mutex); + ret = lacp->negotiated ? LACP_NEGOTIATED : LACP_CONFIGURED; + ovs_mutex_unlock(&mutex); + return ret; } else { - ret = LACP_CONFIGURED; + /* Don't take 'mutex'. It might not even be initialized, since we + * don't know that any lacp object has been created. */ + return LACP_DISABLED; } - ovs_mutex_unlock(&mutex); - return ret; } /* Registers 'slave_' as subordinate to 'lacp'. This should be called at least