diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-02-24 13:25:54 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-02-24 13:25:54 -0800 |
commit | e84d5e9fa178a027b1c8b9f6e22c9173dcda03b3 (patch) | |
tree | b3d16c3076cb8bce048c54e331e86f56e0c0533b /connect.c | |
parent | 8020803f5057601c1c29ffcdbd309905bd26eef7 (diff) | |
parent | c915f11eb4922e154e29cf62d3b549d65c06a170 (diff) |
Merge branch 'ew/force-ipv4'
"git fetch" and friends that make network connections can now be
told to only use ipv4 (or ipv6).
* ew/force-ipv4:
connect & http: support -4 and -6 switches for remote operations
Diffstat (limited to 'connect.c')
-rw-r--r-- | connect.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -357,6 +357,10 @@ static int git_tcp_connect_sock(char *host, int flags) port = "<none>"; memset(&hints, 0, sizeof(hints)); + if (flags & CONNECT_IPV4) + hints.ai_family = AF_INET; + else if (flags & CONNECT_IPV6) + hints.ai_family = AF_INET6; hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = IPPROTO_TCP; @@ -783,6 +787,10 @@ struct child_process *git_connect(int fd[2], const char *url, } argv_array_push(&conn->args, ssh); + if (flags & CONNECT_IPV4) + argv_array_push(&conn->args, "-4"); + else if (flags & CONNECT_IPV6) + argv_array_push(&conn->args, "-6"); if (tortoiseplink) argv_array_push(&conn->args, "-batch"); if (port) { |