From cb16b02fc4372c3cb8ae377a5e9e2e7caa5e6dfc Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Thu, 26 Feb 2004 03:43:00 +0000 Subject: [PATCH] * network.c (setup_a_tcp_listener): Call setreuseaddr before calling bind. (setup_tcp_listener_ports): Don't call setreuseaddr. Log info about socket option IPV6_V6ONLY in unsupported and success cases. ticket: 2285 status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16124 dc483132-0cff-0310-8789-dd5450dbe970 --- src/kdc/ChangeLog | 7 +++++++ src/kdc/network.c | 19 +++++++++++-------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/kdc/ChangeLog b/src/kdc/ChangeLog index b95a6ac7e..6c6378f4d 100644 --- a/src/kdc/ChangeLog +++ b/src/kdc/ChangeLog @@ -1,3 +1,10 @@ +2004-02-25 Ken Raeburn + + * network.c (setup_a_tcp_listener): Call setreuseaddr before + calling bind. + (setup_tcp_listener_ports): Don't call setreuseaddr. Log info + about socket option IPV6_V6ONLY in unsupported and success cases. + 2004-02-24 Sam Hartman * kerberos_v4.c (compat_decrypt_key): As below. diff --git a/src/kdc/network.c b/src/kdc/network.c index 4c49102a9..cc79b8093 100644 --- a/src/kdc/network.c +++ b/src/kdc/network.c @@ -358,6 +358,9 @@ setup_a_tcp_listener(struct socksetup *data, struct sockaddr *addr) paddr(addr)); return -1; } + if (setreuseaddr(sock, 1) < 0) + com_err(data->prog, errno, + "Cannot enable SO_REUSEADDR on fd %d", sock); if (bind(sock, addr, socklen(addr)) == -1) { com_err(data->prog, errno, "Cannot bind TCP server socket on %s", paddr(addr)); @@ -434,16 +437,12 @@ setup_tcp_listener_ports(struct socksetup *data) #ifdef IPV6_V6ONLY if (setv6only(s6, 0)) com_err(data->prog, errno, "setsockopt(IPV6_V6ONLY,0) failed"); + else + com_err(data->prog, 0, "setsockopt(IPV6_V6ONLY,0) worked"); +#else + krb5_klog_syslog(LOG_INFO, "no IPV6_V6ONLY socket option support"); #endif - if (setreuseaddr(s6, 0) < 0) { - com_err(data->prog, errno, - "disabling SO_REUSEADDR on IPv6 TCP socket for port %d", - port); - close(s6); - return -1; - } - s4 = setup_a_tcp_listener(data, (struct sockaddr *)&sin4); #endif /* KRB5_USE_INET6 */ } @@ -803,6 +802,10 @@ static void accept_tcp_connection(struct connection *conn, const char *prog, strcpy(p, tmpbuf); } } +#if 0 + krb5_klog_syslog(LOG_INFO, "accepted TCP connection on socket %d from %s", + s, newconn->u.tcp.addrbuf); +#endif newconn->u.tcp.addr_s = addr_s; newconn->u.tcp.addrlen = addrlen; -- 2.26.2