/* type == OFCONN_PRIMARY only. */
enum nx_role role; /* Role. */
+ bool invalid_ttl_to_controller; /* Send packets with invalid TTL
+ to the controller. */
struct hmap_node hmap_node; /* In struct connmgr's "controllers" map. */
enum ofproto_band band; /* In-band or out-of-band? */
};
ofconn->role = role;
}
+void
+ofconn_set_invalid_ttl_to_controller(struct ofconn *ofconn, bool val)
+{
+ ofconn->invalid_ttl_to_controller = val;
+}
+
+bool
+ofconn_get_invalid_ttl_to_controller(struct ofconn *ofconn)
+{
+ return ofconn->invalid_ttl_to_controller;
+}
+
/* Returns the currently configured flow format for 'ofconn', one of NXFF_*.
*
* The default, if no other format has been set, is NXFF_OPENFLOW10. */
ofconn->pktbuf = NULL;
ofconn->miss_send_len = 0;
ofconn->reply_counter = rconn_packet_counter_create ();
+ ofconn->invalid_ttl_to_controller = false;
return ofconn;
}
/* Returns true if 'ofconn' should receive asynchronous messages. */
static bool
-ofconn_receives_async_msgs(const struct ofconn *ofconn)
+ofconn_receives_async_msgs__(const struct ofconn *ofconn)
{
- if (!rconn_is_connected(ofconn->rconn)) {
- return false;
- } else if (ofconn->type == OFCONN_PRIMARY) {
+ if (ofconn->type == OFCONN_PRIMARY) {
/* Primary controllers always get asynchronous messages unless they
* have configured themselves as "slaves". */
return ofconn->role != NX_ROLE_SLAVE;
}
}
+static bool
+ofconn_receives_async_msgs(const struct ofconn *ofconn)
+{
+ if (!rconn_is_connected(ofconn->rconn)) {
+ return false;
+ } else {
+ return ofconn_receives_async_msgs__(ofconn);
+ }
+}
+
+static bool
+ofconn_interested_in_packet(const struct ofconn *ofconn,
+ const struct ofputil_packet_in *pin)
+{
+ if (!rconn_is_connected(ofconn->rconn)) {
+ return false;
+ } else if (pin->reason == OFPR_INVALID_TTL) {
+ return ofconn->invalid_ttl_to_controller;
+ } else {
+ return ofconn_receives_async_msgs__(ofconn);
+ }
+}
+
/* Returns a human-readable name for an OpenFlow connection between 'mgr' and
* 'target', suitable for use in log messages for identifying the connection.
*
struct ofconn *ofconn;
LIST_FOR_EACH (ofconn, node, &mgr->all_conns) {
- if (ofconn_receives_async_msgs(ofconn)) {
+ if (ofconn_interested_in_packet(ofconn, pin)) {
schedule_packet_in(ofconn, *pin, flow);
}
}