Skip to content

Commit

Permalink
more windows fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sorbo committed Jul 22, 2014
1 parent cdfa41f commit a0c5c69
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
5 changes: 4 additions & 1 deletion user/src/mingw.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ int do_divert_open(void)
_h = DivertOpen(
"ip and "
"((outbound and tcp.DstPort == 80) or "
" (inbound and tcp.SrcPort == 80)) and "
" (inbound and tcp.SrcPort == 80) or "
" (outbound and tcp.DstPort == 7777) or "
" (inbound and tcp.SrcPort == 7777)"
") and "
"ip.DstAddr != 127.0.0.1 and "
"ip.SrcAddr != 127.0.0.1",
WINDIVERT_LAYER_NETWORK, 0, 0);
Expand Down
13 changes: 7 additions & 6 deletions user/src/tcpcryptd.c
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,6 @@ static void test_connect(struct network_test *t)
{
int s;
struct sockaddr_in s_in;
socklen_t sl = sizeof(s_in);

if ((s = socket(AF_INET, SOCK_STREAM, 0)) == -1)
err(1, "socket()");
Expand Down Expand Up @@ -506,11 +505,6 @@ static void test_connect(struct network_test *t)
t->nt_ctl.tcc_dst = s_in.sin_addr;
t->nt_ctl.tcc_dport = s_in.sin_port;

if (getsockname(s, (struct sockaddr*) &s_in, &sl) == -1)
err(1, "getsockname()");

t->nt_ctl.tcc_src = s_in.sin_addr;

t->nt_state = TEST_STATE_CONNECTING;
t->nt_start = time(NULL);
}
Expand Down Expand Up @@ -549,6 +543,8 @@ static void test_connecting(struct network_test *t)
char *buf = NULL;
unsigned char sid[1024];
unsigned int sidlen = sizeof(sid);
struct sockaddr_in s_in;
socklen_t sl = sizeof(s_in);

tv.tv_sec = 0;
tv.tv_usec = 0;
Expand All @@ -570,6 +566,11 @@ static void test_connecting(struct network_test *t)
return;
}

if (getsockname(s, (struct sockaddr*) &s_in, &sl) == -1)
err(1, "getsockname()");

t->nt_ctl.tcc_src = s_in.sin_addr;

rc = tcpcryptd_getsockopt(&t->nt_ctl, TCP_CRYPT_SESSID, sid, &sidlen);

if (rc == EBUSY)
Expand Down

0 comments on commit a0c5c69

Please sign in to comment.