Skip to content

Commit 4c23479

Browse files
authored
Merge pull request libmapper#113 from EggAllocationService/issue-112
Skip tunnels when picking network interfaces
2 parents ecc3427 + a58dd21 commit 4c23479

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/network.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,17 @@ static int get_iface_addr(const char* pref, struct in_addr* addr, char **iface)
260260
&& memcmp(&sa->sin_addr, &zero, sizeof(struct in_addr)) != 0) {
261261
trace("checking network interface '%s' (pref: '%s')\n",
262262
ifap->ifa_name, pref ? pref : "NULL");
263+
264+
if (strncmp("utun", ifap->ifa_name, strlen("utun")) == 0) {
265+
// interface name starts with "utun", indicating it is likely a p2p connection
266+
// should not attempt to bind to these automatically
267+
if (!pref || 0 != strcmp(ifap->ifa_name, pref)) {
268+
// was not the preferred iface, so skip it
269+
ifap = ifap->ifa_next;
270+
continue;
271+
}
272+
}
273+
263274
ifchosen = ifap;
264275
if (pref && 0 == strcmp(ifap->ifa_name, pref)) {
265276
trace(" preferred interface found!\n");

0 commit comments

Comments
 (0)