test_refuse_connection(int argc OVS_UNUSED, char *argv[])
{
const char *type = argv[1];
- int expected_error;
struct fake_pvconn fpv;
struct vconn *vconn;
-
- expected_error = (!strcmp(type, "unix") ? EPIPE
- : !strcmp(type, "tcp") ? ECONNRESET
- : EPROTO);
+ int error;
fpv_create(type, &fpv);
CHECK_ERRNO(vconn_open(fpv.vconn_name, OFP10_VERSION, &vconn,
DSCP_DEFAULT), 0);
fpv_close(&fpv);
vconn_run(vconn);
- CHECK_ERRNO(vconn_connect_block(vconn), expected_error);
+
+ error = vconn_connect_block(vconn);
+ if (!strcmp(type, "tcp")) {
+ if (error != ECONNRESET && error != EPIPE) {
+ ovs_fatal(0, "unexpected vconn_connect() return value %d (%s)",
+ error, strerror(error));
+ }
+ } else {
+ CHECK_ERRNO(error, !strcmp(type, "unix") ? EPIPE : EPROTO);
+ }
+
vconn_close(vconn);
fpv_destroy(&fpv);
}
struct fake_pvconn fpv;
struct vconn *vconn;
struct stream *stream;
+ int error;
fpv_create(type, &fpv);
CHECK_ERRNO(vconn_open(fpv.vconn_name, OFP10_VERSION, &vconn,
poll_block();
}
stream_close(stream);
- CHECK_ERRNO(vconn_connect_block(vconn), ECONNRESET);
+ error = vconn_connect_block(vconn);
+ if (error != ECONNRESET && error != EPIPE) {
+ ovs_fatal(0, "unexpected vconn_connect() return value %d (%s)",
+ error, strerror(error));
+ }
vconn_close(vconn);
}