From 9b13a5792f83884c42d4000c10a17d30d1ee4133 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Thu, 4 Sep 2008 13:51:54 -0700 Subject: [PATCH] Revert "Do not send in-band control traffic to the controller." This reverts commit 123301f8b57df7e539478c607d52d21b55e023c0, because it broke second-hop OpenFlow switches' attempts to connect to the controller. Probably re-spin it later, with more testing this time. --- secchan/secchan.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/secchan/secchan.c b/secchan/secchan.c index c8b74bf3..d45c5ea3 100644 --- a/secchan/secchan.c +++ b/secchan/secchan.c @@ -571,16 +571,6 @@ is_controller_mac(const uint8_t dl_addr[ETH_ADDR_LEN], return mac && eth_addr_equals(mac, dl_addr); } -static void -in_band_learn_mac(struct in_band_data *in_band, const struct flow *flow) -{ - uint16_t in_port = ntohs(flow->in_port); - if (mac_learning_learn(in_band->ml, flow->dl_src, in_port)) { - VLOG_DBG_RL(&vrl, "learned that "ETH_ADDR_FMT" is on port %"PRIu16, - ETH_ADDR_ARGS(flow->dl_src), in_port); - } -} - static bool in_band_packet_cb(struct relay *r, int half, void *in_band_) { @@ -626,17 +616,30 @@ in_band_packet_cb(struct relay *r, int half, void *in_band_) } else if (eth_addr_equals(flow.dl_dst, in_band->mac)) { /* Sent to secure channel. */ out_port = OFPP_LOCAL; - in_band_learn_mac(in_band, &flow); + if (mac_learning_learn(in_band->ml, flow.dl_src, in_port)) { + VLOG_DBG_RL(&vrl, "learned that "ETH_ADDR_FMT" is on port %"PRIu16, + ETH_ADDR_ARGS(flow.dl_src), in_port); + } } else if (flow.dl_type == htons(ETH_TYPE_ARP) && eth_addr_is_broadcast(flow.dl_dst) && is_controller_mac(flow.dl_src, in_band)) { /* ARP sent by controller. */ out_port = OFPP_FLOOD; - } else if (is_controller_mac(flow.dl_dst, in_band) - || is_controller_mac(flow.dl_src, in_band)) { - /* Traffic to or from controller. Switch it by hand. */ - in_band_learn_mac(in_band, &flow); + } else if (is_controller_mac(flow.dl_dst, in_band)) { + if (mac_learning_learn(in_band->ml, flow.dl_src, in_port)) { + VLOG_DBG_RL(&vrl, "learned that "ETH_ADDR_FMT" is on port %"PRIu16, + ETH_ADDR_ARGS(flow.dl_src), in_port); + } + out_port = mac_learning_lookup(in_band->ml, controller_mac); + if (in_port != out_port) { + return false; + } + + /* This is controller traffic that arrived on the controller port. + * It will get dropped below. */ + } else if (is_controller_mac(flow.dl_src, in_band)) { + out_port = mac_learning_lookup(in_band->ml, flow.dl_dst); } else { return false; } -- 2.30.2