+ s->n_packets = 0;
+ s->vconn.remote_ip = stream_get_remote_ip(stream);
+ s->vconn.remote_port = stream_get_remote_port(stream);
+ s->vconn.local_ip = stream_get_local_ip(stream);
+ s->vconn.local_port = stream_get_local_port(stream);
+ return &s->vconn;
+}
+
+/* Creates a new vconn that will send and receive data on a stream named 'name'
+ * and stores a pointer to the vconn in '*vconnp'.
+ *
+ * Returns 0 if successful, otherwise a positive errno value. */
+static int
+vconn_stream_open(const char *name, uint32_t allowed_versions,
+ char *suffix OVS_UNUSED, struct vconn **vconnp, uint8_t dscp)
+{
+ struct stream *stream;
+ int error;
+
+ error = stream_open_with_default_ports(name, OFP_TCP_PORT, OFP_SSL_PORT,
+ &stream, dscp);
+ if (!error) {
+ error = stream_connect(stream);
+ if (!error || error == EAGAIN) {
+ *vconnp = vconn_stream_new(stream, error, allowed_versions);
+ return 0;
+ }
+ }
+
+ stream_close(stream);
+ return error;