Mercurial > pidgin
diff libpurple/nat-pmp.c @ 23210:1e87376e77f2
merge of '50ee8ea93d28a742019b72de39c81427af3ca785'
and 'e7d6a0a271d8fe8435f200e0f1ec123053e57493'
author | Evan Schoenberg <evan.s@dreskin.net> |
---|---|
date | Tue, 27 May 2008 01:38:35 +0000 |
parents | 313b87adb730 |
children | b175f6441bba |
line wrap: on
line diff
--- a/libpurple/nat-pmp.c Mon May 26 20:51:10 2008 +0000 +++ b/libpurple/nat-pmp.c Tue May 27 01:38:35 2008 +0000 @@ -125,7 +125,16 @@ if (bitmask & (1 << i)) { addrs[i] = sa; +#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN sa = (struct sockaddr *)(ROUNDUP(sa->sa_len) + (char *)sa); +#else + if (sa->sa_family == AF_INET) + sa = (struct sockaddr*)(sizeof(struct sockaddr_in) + (char *)sa); +#ifdef AF_INET6 + else if (sa->sa_family == AF_INET6) + sa = (struct sockaddr*)(sizeof(struct sockaddr_in6) + (char *)sa); +#endif +#endif } else { @@ -146,7 +155,12 @@ if ((sin->sin_addr.s_addr == INADDR_ANY) && mask && (ntohl(((struct sockaddr_in *)mask)->sin_addr.s_addr) == 0L || - mask->sa_len == 0)) +#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN + mask->sa_len == 0 +#else + 0 +#endif + )) return 1; else return 0;