diff options
author | Timo Sirainen <cras@irssi.org> | 2003-07-09 23:34:41 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2003-07-09 23:34:41 +0000 |
commit | a619fe9a2ce6069edf15a3a53414fe0b17b4ac7a (patch) | |
tree | 94d68b583e3fa9bde08df08a993efac390e634bf /src/core | |
parent | ae5b5f38bdd045df0a1dae78138b6b805dc934b1 (diff) | |
download | irssi-a619fe9a2ce6069edf15a3a53414fe0b17b4ac7a.zip |
Network fixes. DCC fixes for IPv6 + BSDs.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3124 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/network.c | 9 | ||||
-rw-r--r-- | src/core/network.h | 2 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/core/network.c b/src/core/network.c index ab19aab0..71a5dcb1 100644 --- a/src/core/network.c +++ b/src/core/network.c @@ -51,6 +51,11 @@ union sockaddr_union { /* Cygwin need this, don't know others.. */ /*#define BLOCKING_SOCKETS 1*/ +IPADDR ip4_any = { + AF_INET, + { INADDR_ANY } +}; + int net_ip_compare(IPADDR *ip1, IPADDR *ip2) { if (ip1->family != ip2->family) @@ -114,7 +119,7 @@ void sin_set_port(union sockaddr_union *so, int port) { #ifdef HAVE_IPV6 if (so->sin.sin_family == AF_INET6) - so->sin6.sin6_port = htons(port); + so->sin6.sin6_port = htons((unsigned short)port); else #endif so->sin.sin_port = htons((unsigned short)port); @@ -283,8 +288,8 @@ GIOChannel *net_listen(IPADDR *my_ip, int *port) g_return_val_if_fail(port != NULL, NULL); memset(&so, 0, sizeof(so)); - sin_set_port(&so, *port); sin_set_ip(&so, my_ip); + sin_set_port(&so, *port); /* create the socket */ handle = socket(so.sin.sin_family, SOCK_STREAM, 0); diff --git a/src/core/network.h b/src/core/network.h index c6b08f9f..68f869ea 100644 --- a/src/core/network.h +++ b/src/core/network.h @@ -39,6 +39,8 @@ struct _IPADDR { #define IPADDR_IS_V6(ip) ((ip)->family != AF_INET) +extern IPADDR ip4_any; + /* returns 1 if IPADDRs are the same */ int net_ip_compare(IPADDR *ip1, IPADDR *ip2); |