Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/matanbroner/tc
Browse files Browse the repository at this point in the history
  • Loading branch information
matanbroner committed Mar 27, 2023
2 parents fc75cd0 + 8185028 commit 4b21407
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions lib_convert/convert_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,20 @@ _redirect(socket_state_t *state, struct sockaddr *dest)
if (len < 0)
return len;

// use TCP fast open to send the convert header in the SYN packet
return sendto(state->fd, buf, len, MSG_FASTOPEN, _converter_addr->ai_addr,
_converter_addr->ai_addrlen);
// // use TCP fast open to send the convert header in the SYN packet
// return sendto(state->fd, buf, len, MSG_FASTOPEN, _converter_addr->ai_addr,
// _converter_addr->ai_addrlen);

// Fast Open interferes with creating subflows
int (*lconnect)(int, const struct sockaddr *, socklen_t) = dlsym(RTLD_NEXT, "connect");
if (lconnect(state->fd, _converter_addr->ai_addr, _converter_addr->ai_addrlen) < 0)
{
printf("connect to converter failed: %s\n", strerror(errno));
return -1;
}
// send the convert header
int (*lsend)(int, const void *, size_t, int) = dlsym(RTLD_NEXT, "send");
return lsend(state->fd, buf, len, 0);
}

int socket(int domain, int type, int protocol)
Expand Down Expand Up @@ -356,7 +367,7 @@ _read_convert(socket_state_t *state, bool peek, int fail_errno)
_free_state(state);

skip:
printf("return skip\n");
printf("skip the syscall\n");
return SYSCALL_SKIP;
}

Expand Down Expand Up @@ -395,7 +406,7 @@ int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen)
* check
* the answer from the converter. */
if (result > 0)
_read_convert(state, false, ECONNREFUSED);
return _read_convert(state, false, ECONNREFUSED);

return -ECONNREFUSED;
}
Expand Down

0 comments on commit 4b21407

Please sign in to comment.