summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvenaas <venaas>2007-11-01 08:36:11 +0000
committervenaas <venaas@e88ac4ed-0b26-0410-9574-a7f39faa03bf>2007-11-01 08:36:11 +0000
commit73cc93df2e0935c5791995ec52cf16e462e1b1f3 (patch)
tree273e2c0ebf70533aff39d2c047d9d8857315d218
parent4f87524ad119741cbefeba292c826769e816e88d (diff)
fixing bugs in new addserver binding code
git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@190 e88ac4ed-0b26-0410-9574-a7f39faa03bf
-rw-r--r--radsecproxy.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/radsecproxy.c b/radsecproxy.c
index cb729fe..a16a802 100644
--- a/radsecproxy.c
+++ b/radsecproxy.c
@@ -373,27 +373,31 @@ void addserver(struct clsrvconf *conf) {
if (udp_client4_sock < 0) {
struct sockaddr_in sa;
memset(&sa, 0, sizeof(sa));
- udp_client4_sock = socket(AF_INET, conf->addrinfo->ai_socktype, conf->addrinfo->ai_protocol);
+ sa.sin_family = AF_INET;
+ udp_client4_sock = socket(PF_INET, conf->addrinfo->ai_socktype, conf->addrinfo->ai_protocol);
if (udp_client4_sock < 0)
debugx(1, DBG_ERR, "addserver: failed to create client socket for server %s", conf->host);
- if (!bind(udp_client4_sock, (struct sockaddr *)&sa, sizeof(sa)))
+ if (bind(udp_client4_sock, (struct sockaddr *)&sa, sizeof(sa)))
debugx(1, DBG_ERR, "addserver: failed to bind client socket for server %s", conf->host);
}
conf->servers->sock = udp_client4_sock;
+ break;
case AF_INET6:
if (udp_client6_sock < 0) {
struct sockaddr_in6 sa;
memset(&sa, 0, sizeof(sa));
- udp_client6_sock = socket(AF_INET6, conf->addrinfo->ai_socktype, conf->addrinfo->ai_protocol);
+ sa.sin6_family = AF_INET6;
+ udp_client6_sock = socket(PF_INET6, conf->addrinfo->ai_socktype, conf->addrinfo->ai_protocol);
if (udp_client6_sock < 0)
debugx(1, DBG_ERR, "addserver: failed to create client socket for server %s", conf->host);
#ifdef IPV6_V6ONLY
setsockopt(udp_client6_sock, IPPROTO_IPV6, IPV6_V6ONLY, (char *)&on, sizeof(on));
#endif
- if (!bind(udp_client6_sock, (struct sockaddr *)&sa, sizeof(sa)))
+ if (bind(udp_client6_sock, (struct sockaddr *)&sa, sizeof(sa)))
debugx(1, DBG_ERR, "addserver: failed to bind client socket for server %s", conf->host);
}
conf->servers->sock = udp_client6_sock;
+ break;
default:
debugx(1, DBG_ERR, "addserver: unsupported address family");
}