summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
bebf175)
Without this change, the secure channel announces that it is
entering or exiting fail-open mode only when an OpenFlow
message actually arrives from the local datapath. Thus,
when no packets arrive on any switch port, the secchan
never enters fail-open mode. Functionally, this makes no
difference, because there are no packets to switch anyhow
in that case, but it makes the log harder to interpret
since it's unclear whether the controller connection is
actually up.
With this change, the secure channel announcing that it is
entering or exiting fail-open mode is not tied to receiving
a packet on a switch port. Thus, the log is easier to
interpret.
static void relay_destroy(struct relay *);
static bool local_hook(struct relay *r);
static void relay_destroy(struct relay *);
static bool local_hook(struct relay *r);
+static bool failing_open(struct relay *r);
static bool fail_open_hook(struct relay *r);
int
static bool fail_open_hook(struct relay *r);
int
{
struct vconn *listen_vconn;
struct netdev *of_device;
{
struct vconn *listen_vconn;
struct netdev *of_device;
+ struct relay *controller_relay;
const char *nl_name;
char of_name[16];
int retval;
const char *nl_name;
char of_name[16];
int retval;
- relay_create(rconn_new(argv[optind], 1, 0),
- rconn_new(argv[optind + 1], 1, probe_interval),
- false);
+ controller_relay = relay_create(rconn_new(argv[optind], 1, 0),
+ rconn_new(argv[optind + 1], 1,
+ probe_interval),
+ false);
for (;;) {
struct relay *r, *n;
for (;;) {
struct relay *r, *n;
new_management_connection(nl_name, new_remote);
}
}
new_management_connection(nl_name, new_remote);
}
}
+ failing_open(controller_relay);
/* Wait for something to happen. */
LIST_FOR_EACH (r, struct relay, node, &relays) {
/* Wait for something to happen. */
LIST_FOR_EACH (r, struct relay, node, &relays) {
+/* Causess 'r' to enter or leave fail-open mode, if appropriate. Returns true
+ * if 'r' is in fail-open fail, false otherwise. */
-fail_open_hook(struct relay *r)
+failing_open(struct relay *r)
- struct buffer *msg = r->halves[HALF_LOCAL].rxbuf;
struct rconn *local = r->halves[HALF_LOCAL].rconn;
struct rconn *remote = r->halves[HALF_REMOTE].rconn;
int disconnected_duration;
struct rconn *local = r->halves[HALF_LOCAL].rconn;
struct rconn *remote = r->halves[HALF_REMOTE].rconn;
int disconnected_duration;
"failing open", disconnected_duration);
r->lswitch = lswitch_create(local, true, max_idle);
}
"failing open", disconnected_duration);
r->lswitch = lswitch_create(local, true, max_idle);
}
-
- /* Do switching. */
- lswitch_process_packet(r->lswitch, local, msg);
- rconn_run(local);
+static bool
+fail_open_hook(struct relay *r)
+{
+ if (!failing_open(r)) {
+ return false;
+ } else {
+ struct buffer *msg = r->halves[HALF_LOCAL].rxbuf;
+ struct rconn *local = r->halves[HALF_LOCAL].rconn;
+ lswitch_process_packet(r->lswitch, local, msg);
+ rconn_run(local);
+ return true;
+ }
+}
+
static void
parse_options(int argc, char *argv[])
{
static void
parse_options(int argc, char *argv[])
{