int new_fd = -1;
enum proto_type proto_type = 0; // to shut gcc warning
int ctrl_type = 0; // to shut gcc warning
+ /*
+ * Indicates that we want to use an alternate protocol instead of the
+ * default one.
+ * Currently, only MPTCP is defined as an alternate protocol for TCP
+ */
int alt_proto = 0;
portl = porth = porta = 0;
((opts & (PA_O_STREAM|PA_O_DGRAM)) == (PA_O_DGRAM|PA_O_STREAM) && (opts & PA_O_DEFAULT_DGRAM))) {
proto_type = PROTO_TYPE_DGRAM;
ctrl_type = SOCK_DGRAM;
- alt_proto = 1;
} else {
proto_type = PROTO_TYPE_STREAM;
ctrl_type = SOCK_STREAM;
str2 += 6;
proto_type = PROTO_TYPE_DGRAM;
ctrl_type = SOCK_DGRAM;
- alt_proto = 1;
}
else if (strncmp(str2, "quic+", 5) == 0) {
str2 += 5;
ss.ss_family = AF_UNIX;
proto_type = PROTO_TYPE_DGRAM;
ctrl_type = SOCK_DGRAM;
- alt_proto = 1;
}
else if (strncmp(str2, "uxst@", 5) == 0) {
str2 += 5;
ss.ss_family = AF_INET;
proto_type = PROTO_TYPE_DGRAM;
ctrl_type = SOCK_DGRAM;
- alt_proto = 1;
}
else if (strncmp(str2, "tcp6@", 5) == 0) {
str2 += 5;
ss.ss_family = AF_INET6;
proto_type = PROTO_TYPE_DGRAM;
ctrl_type = SOCK_DGRAM;
- alt_proto = 1;
}
else if (strncmp(str2, "tcp@", 4) == 0) {
str2 += 4;
ss.ss_family = AF_UNSPEC;
proto_type = PROTO_TYPE_DGRAM;
ctrl_type = SOCK_DGRAM;
- alt_proto = 1;
}
else if (strncmp(str2, "quic4@", 6) == 0) {
str2 += 6;
}
if (proto || (opts & PA_O_CONNECT)) {
+ // if the socket type is SOCK_DGRAM, use by default an alternate protocol
+ alt_proto = alt_proto || (ctrl_type == SOCK_DGRAM);
/* Note: if the caller asks for a proto, we must find one,
* except if we inherit from a raw FD (family == AF_CUST_EXISTING_FD)
* orif we return with an fqdn that will resolve later,