static struct xbridge *xbridge_lookup(const struct ofproto_dpif *);
static struct xbundle *xbundle_lookup(const struct ofbundle *);
-static struct xport *xport_lookup(struct ofport_dpif *);
+static struct xport *xport_lookup(const struct ofport_dpif *);
static struct xport *get_ofp_port(const struct xbridge *, ofp_port_t ofp_port);
static struct skb_priority_to_dscp *get_skb_priority(const struct xport *,
uint32_t skb_priority);
if (xport->peer) {
xport->peer->peer = NULL;
}
- xport->peer = peer ? xport_lookup(peer) : NULL;
+ xport->peer = xport_lookup(peer);
if (xport->peer) {
xport->peer->peer = xport;
}
if (xport->xbundle) {
list_remove(&xport->bundle_node);
}
- xport->xbundle = ofbundle ? xbundle_lookup(ofbundle) : NULL;
+ xport->xbundle = xbundle_lookup(ofbundle);
if (xport->xbundle) {
list_insert(&xport->xbundle->xports, &xport->bundle_node);
}
{
struct xbridge *xbridge;
+ if (!ofproto) {
+ return NULL;
+ }
+
HMAP_FOR_EACH_IN_BUCKET (xbridge, hmap_node, hash_pointer(ofproto, 0),
&xbridges) {
if (xbridge->ofproto == ofproto) {
{
struct xbundle *xbundle;
+ if (!ofbundle) {
+ return NULL;
+ }
+
HMAP_FOR_EACH_IN_BUCKET (xbundle, hmap_node, hash_pointer(ofbundle, 0),
&xbundles) {
if (xbundle->ofbundle == ofbundle) {
}
static struct xport *
-xport_lookup(struct ofport_dpif *ofport)
+xport_lookup(const struct ofport_dpif *ofport)
{
struct xport *xport;
+ if (!ofport) {
+ return NULL;
+ }
+
HMAP_FOR_EACH_IN_BUCKET (xport, hmap_node, hash_pointer(ofport, 0),
&xports) {
if (xport->ofport == ofport) {
ofport = bond_choose_output_slave(out_xbundle->bond, &ctx->xin->flow,
&ctx->xout->wc, vid);
- xport = ofport ? xport_lookup(ofport) : NULL;
+ xport = xport_lookup(ofport);
if (!xport) {
/* No slaves enabled, so drop packet. */