ofproto-dpif: Drop special packets more judiciously.
authorEthan Jackson <ethan@nicira.com>
Wed, 31 Aug 2011 01:19:48 +0000 (18:19 -0700)
committerEthan Jackson <ethan@nicira.com>
Fri, 9 Sep 2011 00:23:26 +0000 (17:23 -0700)
Before this patch, ofproto-dpif would not forward any LACP or CFM
packets regardless of whether or not the relevant modules were
configured on the in_port.

Feature #6316.

ofproto/ofproto-dpif.c

index 478768f007fd02eb31e1195f64b16618e1155f5e..c84456bc17c8e91e2e567c7d3713045d0c4d0a7b 100644 (file)
@@ -1614,16 +1614,21 @@ static bool
 process_special(struct ofproto_dpif *ofproto, const struct flow *flow,
                 const struct ofpbuf *packet)
 {
-    if (cfm_should_process_flow(flow)) {
-        struct ofport_dpif *ofport = get_ofp_port(ofproto, flow->in_port);
-        if (packet && ofport && ofport->cfm) {
+    struct ofport_dpif *ofport = get_ofp_port(ofproto, flow->in_port);
+
+    if (!ofport) {
+        return false;
+    }
+
+    if (ofport->cfm && cfm_should_process_flow(flow)) {
+        if (packet) {
             cfm_process_heartbeat(ofport->cfm, packet);
         }
         return true;
-    } else if (flow->dl_type == htons(ETH_TYPE_LACP)) {
-        struct ofport_dpif *port = get_ofp_port(ofproto, flow->in_port);
-        if (packet && port && port->bundle && port->bundle->lacp) {
-            lacp_process_packet(port->bundle->lacp, port, packet);
+    } else if (ofport->bundle && ofport->bundle->lacp
+               && flow->dl_type == htons(ETH_TYPE_LACP)) {
+        if (packet) {
+            lacp_process_packet(ofport->bundle->lacp, ofport, packet);
         }
         return true;
     }