Use the best network interface to route an ip instead of the first interface in getLocalInterfaces on Windows.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6469 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2013-07-01 15:12:06 +00:00
parent 81874da2cc
commit af5c31a4f5
4 changed files with 57 additions and 16 deletions

View file

@ -101,8 +101,8 @@ int sockaddr_cmp(struct sockaddr_in &addr1, struct sockaddr_in &addr2 );
int inaddr_cmp(struct sockaddr_in addr1, struct sockaddr_in addr2 );
int inaddr_cmp(struct sockaddr_in addr1, unsigned long);
bool getPreferredInterface(struct in_addr &prefAddr); // returns best addr.
bool getLocalInterfaces(std::list<struct in_addr> &addrs); // returns all possible addrs.
bool getPreferredInterface(struct in_addr &routeAddr, struct in_addr &prefAddr); // returns best addr.
bool getLocalInterfaces(in_addr &routeAddr, std::list<struct in_addr> &addrs); // returns all possible addrs.
// checks (addr1 & 255.255.255.0) == (addr2 & 255.255.255.0)
bool isSameSubnet(struct in_addr *addr1, struct in_addr *addr2);