uint32_t config, uint32_t c_mask,
uint32_t state, uint32_t s_mask);
+#ifdef SUPPORT_SNAT
static struct hook snat_hook_create(struct port_watcher *pw);
+#endif
static struct hook stp_hook_create(const struct settings *,
struct port_watcher *,
/* Set up hooks. */
hooks[n_hooks++] = port_watcher_create(local_rconn, remote_rconn, &pw);
discovery = s.discovery ? discovery_init(&s, pw, switch_status) : NULL;
+#ifdef SUPPORT_SNAT
hooks[n_hooks++] = snat_hook_create(pw);
+#endif
if (s.enable_stp) {
hooks[n_hooks++] = stp_hook_create(&s, pw, local_rconn, remote_rconn);
}
port_watcher_wait_cb, pw);
}
\f
+#ifdef SUPPORT_SNAT
struct snat_port_conf {
struct list node;
struct nx_snat_config config;
port_watcher_register_callback(pw, snat_port_changed_cb, snat);
return make_hook(NULL, snat_remote_packet_cb, NULL, NULL, snat);
}
+#endif /* SUPPORT_SNAT */
\f
/* Spanning tree protocol. */
" dump-flows SWITCH FLOW print matching FLOWs\n"
" dump-aggregate SWITCH print aggregate flow statistics\n"
" dump-aggregate SWITCH FLOW print aggregate stats for FLOWs\n"
+#ifdef SUPPORT_SNAT
" add-snat SWITCH IFACE IP add SNAT config to IFACE\n"
" del-snat SWITCH IFACE delete SNAT config on IFACE\n"
+#endif
" add-flow SWITCH FLOW add flow described by FLOW\n"
" add-flows SWITCH FILE add flows from FILE\n"
" mod-flows SWITCH FLOW modify actions of matching FLOWs\n"
ah->type = htons(OFPAT_STRIP_VLAN);
} else if (!strcasecmp(act, "output")) {
port = str_to_int(arg);
+#ifdef SUPPORT_SNAT
} else if (!strcasecmp(act, "nat")) {
struct nx_action_snat *sa = (struct nx_action_snat *)ah;
sa->vendor = htonl(NX_VENDOR_ID);
sa->subtype = htons(NXAST_SNAT);
sa->port = htons(str_to_int(arg));
+#endif
} else if (!strcasecmp(act, "TABLE")) {
port = OFPP_TABLE;
} else if (!strcasecmp(act, "NORMAL")) {
dump_stats_transaction(argv[1], request);
}
+#ifdef SUPPORT_SNAT
static void do_add_snat(const struct settings *s, int argc, char *argv[])
{
struct vconn *vconn;
send_openflow_buffer(vconn, buffer);
vconn_close(vconn);
}
+#endif /* SUPPORT_SNAT */
static void do_add_flow(const struct settings *s, int argc, char *argv[])
{
{ "dump-tables", 1, 1, do_dump_tables },
{ "dump-flows", 1, 2, do_dump_flows },
{ "dump-aggregate", 1, 2, do_dump_aggregate },
+#ifdef SUPPORT_SNAT
{ "add-snat", 3, 3, do_add_snat },
{ "del-snat", 2, 2, do_del_snat },
+#endif
{ "add-flow", 2, 2, do_add_flow },
{ "add-flows", 2, 2, do_add_flows },
{ "mod-flows", 2, 2, do_mod_flows },