Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

socket: only issue IPPROTO_IPV6 setsockopt calls on AF_INET6 sockets #4131

Open
wants to merge 1 commit into
base: devel
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions rpc/rpc-transport/socket/src/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
#if !defined(DEFAULT_VERIFY_DEPTH)
#define DEFAULT_VERIFY_DEPTH 1
#endif
#define DEFAULT_CIPHER_LIST "AES128:EECDH:EDH:HIGH:!3DES:!RC4:!DES:!MD5:!aNULL:!eNULL"
#define DEFAULT_CIPHER_LIST
"AES128:EECDH:EDH:HIGH:!3DES:!RC4:!DES:!MD5:!aNULL:!eNULL"
#define DEFAULT_DH_PARAM SSL_CERT_PATH "/dhparam.pem"
#define DEFAULT_EC_CURVE "prime256v1"

Expand Down Expand Up @@ -3281,15 +3282,18 @@ socket_connect(rpc_transport_t *this, int port)
* net.ipv6.bindv6only to 1 so that gluster services are
* available over IPv4 & IPv6.
*/
#ifdef IPV6_DEFAULT
int disable_v6only = 0;
if (setsockopt(priv->sock, IPPROTO_IPV6, IPV6_V6ONLY,
int fdsock_family = 0;
socklen_t fdsock_size = sizeof(fdsock_family);
if (getsockopt(priv->sock, SOL_SOCKET, SO_DOMAIN, &fdsock_family,
&fdsock_size) == 0 &&
fdsock_family == AF_INET6 &&
setsockopt(priv->sock, IPPROTO_IPV6, IPV6_V6ONLY,
(void *)&disable_v6only, sizeof(disable_v6only)) < 0) {
gf_log(this->name, GF_LOG_WARNING,
"Error disabling sockopt IPV6_V6ONLY: \"%s\"",
strerror(errno));
}
#endif

if (sa_family != AF_UNIX) {
if (priv->nodelay) {
Expand Down