Skip to content

Commit

Permalink
Allow ekr_loop* ports to be set via command line argument (#332)
Browse files Browse the repository at this point in the history
* be more verbose (#312)

* Improve and of ICMP messages on Windows.

When an ICMP message is received on Windows 10 for a UDP socket,
WSAECONNRESET is reported as an error. In this case, just read
again.

Thanks to nxrighthere for reporting the issue and helping to
nail it down.

This fixes #309.

* Fix broken links, Make URLs' protocols consistent (#315)

Two Links missed leading `http(s)://` and were broken.
All links to `tools.ietf.org` now consistently use https.

* Backport https://svnweb.freebsd.org/base?view=revision&revision=340783

* Improve input validation for the IPPROTO_SCTP level socket options
SCTP_CONNECT_X and SCTP_CONNECT_X_DELAYED.

* Allow sending on demand SCTP HEARTBEATS only in the ESTABLISHED state.

* Fix cross-build linux->mingw (#320)

* ekr_loop* allowed to specify ports

* Buildbot trigger

* Update ekr_loop.c

* Update ekr_loop.c

* Update ekr_loop.c

* Update ekr_loop.c

* revert changes

* test

* Revert changes
  • Loading branch information
weinrank authored and tuexen committed Jul 31, 2019
1 parent 2718a59 commit 6251106
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 9 deletions.
13 changes: 10 additions & 3 deletions programs/ekr_loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ print_addresses(struct socket *sock)
#endif

int
main(void)
main(int argc, char *argv[])
{
struct sockaddr_in sin_s, sin_c;
struct sockaddr_conn sconn;
Expand All @@ -280,6 +280,13 @@ main(void)
#ifdef _WIN32
WSADATA wsaData;
#endif
uint16_t client_port = 9900;
uint16_t server_port = 9901;

if (argc == 3) {
client_port = atoi(argv[1]);
server_port = atoi(argv[2]);
}

#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != 0) {
Expand Down Expand Up @@ -313,14 +320,14 @@ main(void)
#ifdef HAVE_SIN_LEN
sin_c.sin_len = sizeof(struct sockaddr_in);
#endif
sin_c.sin_port = htons(9900);
sin_c.sin_port = htons(client_port);
sin_c.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
memset(&sin_s, 0, sizeof(struct sockaddr_in));
sin_s.sin_family = AF_INET;
#ifdef HAVE_SIN_LEN
sin_s.sin_len = sizeof(struct sockaddr_in);
#endif
sin_s.sin_port = htons(9901);
sin_s.sin_port = htons(server_port);
sin_s.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
#ifdef _WIN32
if (bind(fd_c, (struct sockaddr *)&sin_c, sizeof(struct sockaddr_in)) == SOCKET_ERROR) {
Expand Down
13 changes: 10 additions & 3 deletions programs/ekr_loop_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ print_addresses(struct socket *sock)
#endif

int
main(void)
main(int argc, char *argv[])
{
struct sockaddr_in sin_s, sin_c;
struct sockaddr_conn sconn;
Expand All @@ -300,6 +300,13 @@ main(void)
#ifdef _WIN32
WSADATA wsaData;
#endif
uint16_t client_port = 9900;
uint16_t server_port = 9901;

if (argc == 3) {
client_port = atoi(argv[1]);
server_port = atoi(argv[2]);
}

#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != 0) {
Expand Down Expand Up @@ -334,14 +341,14 @@ main(void)
#ifdef HAVE_SIN_LEN
sin_c.sin_len = sizeof(struct sockaddr_in);
#endif
sin_c.sin_port = htons(9899);
sin_c.sin_port = htons(client_port);
sin_c.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
memset(&sin_s, 0, sizeof(struct sockaddr_in));
sin_s.sin_family = AF_INET;
#ifdef HAVE_SIN_LEN
sin_s.sin_len = sizeof(struct sockaddr_in);
#endif
sin_s.sin_port = htons(9901);
sin_s.sin_port = htons(server_port);
sin_s.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
#ifdef _WIN32
if (bind(fd_c, (struct sockaddr *)&sin_c, sizeof(struct sockaddr_in)) == SOCKET_ERROR) {
Expand Down
13 changes: 10 additions & 3 deletions programs/ekr_loop_upcall.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ print_addresses(struct socket *sock)
#endif

int
main(void)
main(int argc, char *argv[])
{
struct sockaddr_in sin_s, sin_c;
struct sockaddr_conn sconn;
Expand All @@ -313,6 +313,13 @@ main(void)
#ifdef _WIN32
WSADATA wsaData;
#endif
uint16_t client_port = 9900;
uint16_t server_port = 9901;

if (argc == 3) {
client_port = atoi(argv[1]);
server_port = atoi(argv[2]);
}

#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != 0) {
Expand Down Expand Up @@ -346,14 +353,14 @@ main(void)
#ifdef HAVE_SIN_LEN
sin_c.sin_len = sizeof(struct sockaddr_in);
#endif
sin_c.sin_port = htons(9900);
sin_c.sin_port = htons(client_port);
sin_c.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
memset(&sin_s, 0, sizeof(struct sockaddr_in));
sin_s.sin_family = AF_INET;
#ifdef HAVE_SIN_LEN
sin_s.sin_len = sizeof(struct sockaddr_in);
#endif
sin_s.sin_port = htons(9901);
sin_s.sin_port = htons(server_port);
sin_s.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
#ifdef _WIN32
if (bind(fd_c, (struct sockaddr *)&sin_c, sizeof(struct sockaddr_in)) == SOCKET_ERROR) {
Expand Down

0 comments on commit 6251106

Please sign in to comment.