cfm: No longer keep track of bad remote MPs and MAIDS.
[openvswitch] / ofproto / ofproto.c
index fea9119699dcd7a7d6f28f6acf66bfc8bf6dd84e..e0715b9b3aa1c2c764fb889c408d1970d287147e 100644 (file)
@@ -991,7 +991,6 @@ ofproto_iface_set_cfm(struct ofproto *ofproto, uint32_t port_no,
 
     ofport->cfm->mpid = cfm->mpid;
     ofport->cfm->interval = cfm->interval;
-    memcpy(ofport->cfm->eth_src, cfm->eth_src, ETH_ADDR_LEN);
     memcpy(ofport->cfm->maid, cfm->maid, CCM_MAID_LEN);
 
     cfm_update_remote_mps(ofport->cfm, remote_mps, n_remote_mps);
@@ -1729,10 +1728,18 @@ static void
 ofport_run(struct ofproto *ofproto, struct ofport *ofport)
 {
     if (ofport->cfm) {
-        struct ofpbuf *packet = cfm_run(ofport->cfm);
-        if (packet) {
-            ofproto_send_packet(ofproto, ofport->odp_port, 0, packet);
-            ofpbuf_delete(packet);
+        cfm_run(ofport->cfm);
+
+        if (cfm_should_send_ccm(ofport->cfm)) {
+            struct ofpbuf packet;
+            struct ccm *ccm;
+
+            ofpbuf_init(&packet, 0);
+            ccm = compose_packet(&packet, eth_addr_ccm, ofport->opp.hw_addr,
+                                 ETH_TYPE_CFM,  sizeof *ccm);
+            cfm_compose_ccm(ofport->cfm, ccm);
+            ofproto_send_packet(ofproto, ofport->odp_port, 0, &packet);
+            ofpbuf_uninit(&packet);
         }
     }
 }
@@ -5191,7 +5198,7 @@ ofproto_unixctl_trace(struct unixctl_conn *conn, const char *args_,
         goto exit;
     }
 
-    tun_id = htonll(strtoull(tun_id_s, NULL, 10));
+    tun_id = htonll(strtoull(tun_id_s, NULL, 0));
     in_port = ofp_port_to_odp_port(atoi(in_port_s));
 
     packet_s = ofpbuf_put_hex(&packet, packet_s, NULL);
@@ -5275,7 +5282,7 @@ default_normal_ofhook_cb(const struct flow *flow, const struct ofpbuf *packet,
         struct mac_entry *src_mac;
 
         src_mac = mac_learning_insert(ofproto->ml, flow->dl_src, 0);
-        if (mac_entry_is_new(src_mac) || src_mac->port != flow->in_port) {
+        if (mac_entry_is_new(src_mac) || src_mac->port.i != flow->in_port) {
             /* The log messages here could actually be useful in debugging,
              * so keep the rate limit relatively high. */
             static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(30, 300);
@@ -5284,7 +5291,7 @@ default_normal_ofhook_cb(const struct flow *flow, const struct ofpbuf *packet,
 
             ofproto_revalidate(ofproto,
                                mac_learning_changed(ofproto->ml, src_mac));
-            src_mac->port = flow->in_port;
+            src_mac->port.i = flow->in_port;
         }
     }
 
@@ -5294,7 +5301,7 @@ default_normal_ofhook_cb(const struct flow *flow, const struct ofpbuf *packet,
         flood_packets(ofproto, flow->in_port, OFPPC_NO_FLOOD,
                       nf_output_iface, odp_actions);
     } else {
-        int out_port = dst_mac->port;
+        int out_port = dst_mac->port.i;
         if (out_port != flow->in_port) {
             nl_msg_put_u32(odp_actions, ODP_ACTION_ATTR_OUTPUT, out_port);
             *nf_output_iface = out_port;