Skip to content

Commit 43d6d21

Browse files
committed
Limit SO_BINDTODEVICE to just Linux
1 parent 8b405d0 commit 43d6d21

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

libsofia-sip-ua/tport/tport.c

+6-3
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,13 @@ typedef struct tport_nat_s tport_nat_t;
7171
#include <sofia-sip/rbtree.h>
7272

7373
#include "tport_internal.h"
74+
#if defined (__linux__)
7475
#include <ifaddrs.h>
7576
#if HAVE_NET_IF_H
7677
#include <net/if.h>
7778
#endif
7879
#include <sys/ioctl.h>
80+
#endif
7981

8082
#if HAVE_FUNC
8183
#elif HAVE_FUNCTION
@@ -801,14 +803,15 @@ int tport_bind_socket(int socket,
801803
}
802804
}
803805
#endif
804-
806+
#if defined(__linux__)
805807
if (tport_bind_socket_iface(socket, su, ai) < 0) {
806808
return -1;
807809
}
808-
810+
#endif
809811
return 0;
810812
}
811813

814+
#if defined(__linux__)
812815
int tport_bind_socket_iface(int s,
813816
su_sockaddr_t *su,
814817
su_addrinfo_t *ai)
@@ -849,7 +852,7 @@ int tport_bind_socket_iface(int s,
849852
/* Technically it's not a "failure" */
850853
return 0;
851854
}
852-
855+
#endif
853856

854857
/** Indicate stack that a transport has been updated */
855858
void tport_has_been_updated(tport_t *self)

libsofia-sip-ua/tport/tport_internal.h

+2
Original file line numberDiff line numberDiff line change
@@ -440,9 +440,11 @@ void tport_base_timer(tport_t *self, su_time_t now);
440440
int tport_bind_socket(int socket,
441441
su_addrinfo_t *ai,
442442
char const **return_culprit);
443+
#if defined(__linux__)
443444
int tport_bind_socket_iface(int s,
444445
su_sockaddr_t *su,
445446
su_addrinfo_t *ai);
447+
#endif
446448
void tport_close(tport_t *self);
447449
int tport_shutdown0(tport_t *self, int how);
448450

0 commit comments

Comments
 (0)