projects
/
tinc
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
76f0145
)
Use AF_UNSPEC for listening sockets if AddressFamily = any.
author
Guus Sliepen
<guus@tinc-vpn.org>
Wed, 20 Feb 2002 16:04:39 +0000
(16:04 +0000)
committer
Guus Sliepen
<guus@tinc-vpn.org>
Wed, 20 Feb 2002 16:04:39 +0000
(16:04 +0000)
src/net_setup.c
patch
|
blob
|
history
diff --git
a/src/net_setup.c
b/src/net_setup.c
index
1c5ff15
..
757121a
100644
(file)
--- a/
src/net_setup.c
+++ b/
src/net_setup.c
@@
-17,7
+17,7
@@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: net_setup.c,v 1.1.2.
1 2002/02/18 16:25:16
guus Exp $
+ $Id: net_setup.c,v 1.1.2.
2 2002/02/20 16:04:39
guus Exp $
*/
#include "config.h"
*/
#include "config.h"
@@
-454,7
+454,7
@@
cp
cp
/* Open sockets */
cp
/* Open sockets */
- hint.ai_family =
(addressfamily == AF_UNSPEC)?AF_INET6:
addressfamily;
+ hint.ai_family = addressfamily;
hint.ai_socktype = SOCK_STREAM;
hint.ai_protocol = IPPROTO_TCP;
hint.ai_flags = AI_PASSIVE;
hint.ai_socktype = SOCK_STREAM;
hint.ai_protocol = IPPROTO_TCP;
hint.ai_flags = AI_PASSIVE;
@@
-471,6
+471,19
@@
cp
return -1;
}
return -1;
}
+ freeaddrinfo(ai);
+
+ hint.ai_family = addressfamily;
+ hint.ai_socktype = SOCK_DGRAM;
+ hint.ai_protocol = IPPROTO_UDP;
+ hint.ai_flags = AI_PASSIVE;
+
+ if(getaddrinfo(NULL, myport, &hint, &ai) || !ai)
+ {
+ syslog(LOG_ERR, _("System call `%s' failed: %s"), "getaddrinfo", strerror(errno));
+ return -1;
+ }
+
if((udp_socket = setup_vpn_in_socket((sockaddr_t *)ai->ai_addr)) < 0)
{
syslog(LOG_ERR, _("Unable to set up a listening UDP socket!"));
if((udp_socket = setup_vpn_in_socket((sockaddr_t *)ai->ai_addr)) < 0)
{
syslog(LOG_ERR, _("Unable to set up a listening UDP socket!"));