br->secchan = NULL;
}
- /* Create socketpair for communicating with secchan subprocess. */
- if (socketpair(AF_LOCAL, SOCK_STREAM, 0, sockets)) {
- VLOG_ERR("%s: failed to create socket pair: %s",
- br->name, strerror(errno));
- goto error;
+ if (!br->controller) {
+ /* Create socketpair for communicating with secchan subprocess. */
+ if (socketpair(AF_LOCAL, SOCK_STREAM, 0, sockets)) {
+ VLOG_ERR("%s: failed to create socket pair: %s",
+ br->name, strerror(errno));
+ goto error;
+ }
+ set_nonblocking(sockets[0]);
+ set_nonblocking(sockets[1]);
+
+ /* Connect to our end of the socketpair. */
+ dp_name = xasprintf("fd:%d", sockets[0]);
+ rconn_connect(br->rconn, dp_name);
+ free(dp_name);
+ } else {
+ /* secchan will connect to the external controller, not to us, so there
+ * is nothing for us to do. */
}
- set_nonblocking(sockets[0]);
- set_nonblocking(sockets[1]);
-
- /* Connect to our end of the socketpair. */
- dp_name = xasprintf("fd:%d", sockets[0]);
- rconn_connect(br->rconn, dp_name);
- free(dp_name);
/* Assemble command-line arguments. */
svec_init(&argv);
svec_terminate(&argv);
/* Start secchan. */
- retval = process_start(argv.names, &sockets[1], 1, &br->secchan);
+ if (!br->controller) {
+ retval = process_start(argv.names, &sockets[1], 1, &br->secchan);
+ close(sockets[1]);
+ } else {
+ retval = process_start(argv.names, NULL, 0, &br->secchan);
+ }
svec_destroy(&argv);
- close(sockets[1]);
if (retval) {
VLOG_ERR("%s: failed to start secchan for datapath nl:%d: %s",
br->name, br->dp_idx, strerror(retval));