25498304 mercurial 4.1
22749480 mercurial should deliver 64-bit modules
24415944 bundle2 prechangegroup & incoming hooks set HG_URL=push when pushing
This patch fixes a bug in the test controller.
This patch was developed upstream in OVS 2.5.
diff --git a/lib/learning-switch.c b/lib/learning-switch.c
index f6182ba..e27f811 100644
--- a/lib/learning-switch.c
+++ b/lib/learning-switch.c
@@ -180,10 +180,49 @@ static void
lswitch_handshake(struct lswitch *sw)
{
enum ofputil_protocol protocol;
-
+ enum ofp_version version;
send_features_request(sw);
+ version = rconn_get_version(sw->rconn);
+ protocol = ofputil_protocol_from_ofp_version(version);
+ if (version >= OFP13_VERSION) {
+ /* OpenFlow 1.3 and later by default drop packets that miss in the flow
+ * table. Set up a flow to send packets to the controller by
+ * default. */
+ struct ofputil_flow_mod fm;
+ struct ofpact_output output;
+ struct ofpbuf *msg;
+ int error;
- protocol = ofputil_protocol_from_ofp_version(rconn_get_version(sw->rconn));
+ ofpact_init_OUTPUT(&output);
+ output.port = OFPP_CONTROLLER;
+ output.max_len = OFP_DEFAULT_MISS_SEND_LEN;
+
+ match_init_catchall(&fm.match);
+ fm.priority = 0;
+ fm.cookie = 0;
+ fm.cookie_mask = 0;
+ fm.new_cookie = 0;
+ fm.modify_cookie = false;
+ fm.table_id = 0;
+ fm.command = OFPFC_ADD;
+ fm.idle_timeout = 0;
+ fm.hard_timeout = 0;
+ fm.importance = 0;
+ fm.buffer_id = UINT32_MAX;
+ fm.out_port = OFPP_NONE;
+ fm.out_group = OFPG_ANY;
+ fm.flags = 0;
+ fm.ofpacts = &output.ofpact;
+ fm.ofpacts_len = sizeof output;
+ fm.delete_reason = 0;
+
+ msg = ofputil_encode_flow_mod(&fm, protocol);
+ error = rconn_send(sw->rconn, msg, NULL);
+ if (error) {
+ VLOG_INFO_RL(&rl, "%s: failed to add default flow (%s)",
+ rconn_get_name(sw->rconn), ovs_strerror(error));
+ }
+ }
if (sw->default_flows) {
struct ofpbuf *msg = NULL;
int error = 0;
diff --git a/lib/ofp-util.h b/lib/ofp-util.h
index ce6045b..622b928 100644
--- a/lib/ofp-util.h
+++ b/lib/ofp-util.h
@@ -305,8 +305,10 @@ struct ofputil_flow_mod {
ofp_port_t out_port;
uint32_t out_group;
enum ofputil_flow_mod_flags flags;
+ uint16_t importance; /* Eviction precedence. */
struct ofpact *ofpacts; /* Series of "struct ofpact"s. */
size_t ofpacts_len; /* Length of ofpacts, in bytes. */
+ enum ofp_flow_removed_reason delete_reason;
};
enum ofperr ofputil_decode_flow_mod(struct ofputil_flow_mod *,