#include "compiler.h"
#include "daemon.h"
#include "dirs.h"
-#include "dpif.h"
#include "dummy.h"
#include "leak-checker.h"
#include "list.h"
struct ofproto *ofproto;
struct ofsettings s;
int error;
- struct dpif *dpif;
struct netflow_options nf_options;
const char *port;
bool exiting;
parse_options(argc, argv, &s);
signal(SIGPIPE, SIG_IGN);
- die_if_already_running();
daemonize_start();
/* Start listening for ovs-appctl requests. */
VLOG_INFO("Open vSwitch version %s", VERSION BUILDNR);
VLOG_INFO("OpenFlow protocol version 0x%02x", OFP_VERSION);
- error = dpif_create_and_open(s.dp_name, s.dp_type, &dpif);
+ error = ofproto_create(s.dp_name, s.dp_type, &ofproto);
if (error) {
- VLOG_FATAL("could not create datapath (%s)", strerror(error));
+ VLOG_FATAL("could not initialize OpenFlow switch (%s)",
+ strerror(error));
}
/* Add ports to the datapath if requested by the user. */
port, strerror(error));
}
- error = dpif_port_add(dpif, netdev, NULL);
+ error = ofproto_port_add(ofproto, netdev, NULL);
if (error) {
VLOG_FATAL("failed to add %s as a port (%s)",
port, strerror(error));
netdev_close(netdev);
}
- /* Start OpenFlow processing. */
- error = ofproto_create(s.dp_name, s.dp_type, NULL, NULL, &ofproto);
- if (error) {
- VLOG_FATAL("could not initialize openflow switch (%s)",
- strerror(error));
- }
+ /* Configure OpenFlow switch. */
if (s.datapath_id) {
ofproto_set_datapath_id(ofproto, s.datapath_id);
}
VLOG_FATAL("unrecoverable datapath error (%s)", strerror(error));
}
unixctl_server_run(unixctl);
- dp_run();
netdev_run();
ofproto_wait(ofproto);
unixctl_server_wait(unixctl);
- dp_wait();
netdev_wait();
if (exiting) {
poll_immediate_wake();
poll_block();
}
- dpif_close(dpif);
+ ofproto_destroy(ofproto);
return 0;
}
DAEMON_LONG_OPTIONS,
VLOG_LONG_OPTIONS,
LEAK_CHECKER_LONG_OPTIONS,
-#ifdef HAVE_OPENSSL
- STREAM_SSL_LONG_OPTIONS
+ STREAM_SSL_LONG_OPTIONS,
{"bootstrap-ca-cert", required_argument, 0, OPT_BOOTSTRAP_CA_CERT},
-#endif
{0, 0, 0, 0},
};
char *short_options = long_options_to_short_options(long_options);
LEAK_CHECKER_OPTION_HANDLERS
-#ifdef HAVE_OPENSSL
STREAM_SSL_OPTION_HANDLERS
case OPT_BOOTSTRAP_CA_CERT:
stream_ssl_set_ca_cert_file(optarg, true);
break;
-#endif
case '?':
exit(EXIT_FAILURE);
}
/* Local vconns. */
- dp_parse_name(argv[0], &s->dp_name, &s->dp_type);
+ ofproto_parse_name(argv[0], &s->dp_name, &s->dp_type);
/* Figure out controller names. */
s->run_forever = false;