Skip to content

Commit

Permalink
Merge pull request #57 from hamishcoleman/bugfix3.4.3
Browse files Browse the repository at this point in the history
Bugfix
  • Loading branch information
hamishcoleman authored Dec 7, 2024
2 parents ef8ff92 + 448e4e1 commit 5171a82
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ jobs:
fail-fast: true
matrix:
os:
- macos-12
- macos-13

steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.4.2
3.4.3
6 changes: 6 additions & 0 deletions src/edge_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ void reset_sup_attempts (struct n3n_runtime_data *eee) {


// detect local IP address by probing a connection to the supernode
// TODO: should try to refactor this function to be more accurate and handle
// error cases better
static int detect_local_ip_address (n2n_sock_t* out_sock, const struct n3n_runtime_data* eee) {

struct sockaddr_in local_sock;
Expand Down Expand Up @@ -288,19 +290,23 @@ static int detect_local_ip_address (n2n_sock_t* out_sock, const struct n3n_runti

fill_sockaddr((struct sockaddr*)&sn_sock, sizeof(sn_sock), &eee->curr_sn->sock);
if(connect(probe_sock, (struct sockaddr *)&sn_sock, sizeof(sn_sock)) != 0) {
closesocket(probe_sock);
return -3;
}

sock_len = sizeof(local_sock);
if(getsockname(probe_sock, (struct sockaddr *)&local_sock, &sock_len) != 0) {
closesocket(probe_sock);
return -4;
}

if(local_sock.sin_family != AF_INET) {
closesocket(probe_sock);
return -4;
}

if(sock_len != sizeof(local_sock)) {
closesocket(probe_sock);
return -4;
}

Expand Down

0 comments on commit 5171a82

Please sign in to comment.