# git send-email doesn't work with IPv6 and STARTTLS

5 messages from 2014-04-30 to 2014-05-01. Participants: Matthias-Christian Ott, Jonathan Nieder, Steffen Ullrich.
Thread: https://gitlist.dev/t/36555

## Matthias-Christian Ott, 2014-04-30 19:43

Subject: git send-email doesn't work with IPv6 and STARTTLS
Message-ID: <53615259.90200@mirix.org>
URL: https://gitlist.dev/e/53615259.90200%40mirix.org

```
$ git --version
git version 1.8.5.5

git send-email uses Net::SMTP connections that use STARTTLS. Net::SMTP
does not support IPv6. I patched Net:SMTP to use IO::Socket::INET6 and
it worked.

- Matthias-Christian Ott

```

## Jonathan Nieder, 2014-05-01 18:05

Subject: Re: git send-email doesn't work with IPv6 and STARTTLS
Message-ID: <20140501180546.GA9218@google.com>
URL: https://gitlist.dev/e/20140501180546.GA9218%40google.com
In-Reply-To: <53615259.90200@mirix.org>

```
Hi,

Matthias-Christian Ott wrote[1]:

> git send-email uses Net::SMTP connections that use STARTTLS. Net::SMTP
> does not support IPv6. I patched Net:SMTP to use IO::Socket::INET6 and
> it worked.

Thanks for reporting.

 1. What version of Net::SMTP do you use?

 2. Would you be willing to contribute your patch to Net::SMTP upstream,
    for example by mailing it to bug-libnet@rt.cpan.org with
    the string "[rt.cpan.org #93823]" somewhere in the subject line[2]?

Hope that helps,
Jonathan

[1] http://thread.gmane.org/gmane.comp.version-control.git/247769
[2] https://rt.cpan.org/Public/Bug/Display.html?id=93823
https://rt.cpan.org/NoAuth/RT/CPAN/Usage.html

```

## Matthias-Christian Ott, 2014-05-01 20:44

Subject: Re: git send-email doesn't work with IPv6 and STARTTLS
Message-ID: <5362B226.4080500@mirix.org>
URL: https://gitlist.dev/e/5362B226.4080500%40mirix.org
In-Reply-To: <20140501180546.GA9218@google.com>

```
On 05/01/14 20:05, Jonathan Nieder wrote:
> Hi,

Hi,

> Matthias-Christian Ott wrote[1]:
> 
>> git send-email uses Net::SMTP connections that use STARTTLS. Net::SMTP
>> does not support IPv6. I patched Net:SMTP to use IO::Socket::INET6 and
>> it worked.
> 
> Thanks for reporting.
> 
>  1. What version of Net::SMTP do you use?

Included in Perl:

Summary of my perl5 (revision 5 version 16 subversion 3) configuration:

  Platform:
    [...]
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=undef, use64bitall=undef, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    [...]
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    [...]
    libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
    [...]
  Dynamic Linking:
    [...]


Characteristics of this binary (from libperl):
  Compile-time options: HAS_TIMES PERLIO_LAYERS PERL_DONT_CREATE_GVSV
                        PERL_MALLOC_WRAP PERL_PRESERVE_IVUV USE_LARGE_FILES
                        USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE
                        USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF
  Locally applied patches:
	gentoo/EUMM-RUNPATH - https://bugs.gentoo.org/105054
cpan/ExtUtils-MakeMaker: drop $PORTAGE_TMPDIR from LD_RUN_PATH
	gentoo/EUMM_delete_packlist - Don't install .packlist or perllocal.pod
for perl or vendor
	gentoo/config_over - Remove -rpath and append LDFLAGS to lddlflags
	gentoo/cpan_definstalldirs - Provide a sensible INSTALLDIRS default for
modules installed from CPAN.
	gentoo/cpanplus_definstalldirs - Configure CPANPLUS to use the site
directories by default.
	gentoo/create_libperl_soname - https://bugs.gentoo.org/286840 Set
libperl soname
	gentoo/drop_fstack_protector - https://bugs.gentoo.org/348557 Don't
force -fstack-protector on everyone.
	gentoo/enc2xs - https://bugs.gentoo.org/338802 Tweak enc2xs to ignore
missing @INC directories
	gentoo/mod_paths - Add /etc/perl to @INC
	gentoo/patchlevel - List packaged patches for perl-5.16.3(#1) in
patchlevel.h
	gentoo/aix_soname - aix gcc detection and shared library soname support
	gentoo/solaris-relocation - Fix lddlflags for solaris
	gentoo/opensolars_headers - Add headers for opensolaris
	gentoo/cleanup-paths - Cleanup PATH and shrpenv
	gentoo/usr_local - Remove /usr/local paths
	gentoo/hints_hpux - Fix hpux hints
	gentoo/darwin-cc-ld - https://bugs.gentoo.org/297751 darwin: Use $CC to
link
	gentoo/mint - [perl #89502] Mint fixes
	gentoo/interix - Fix interix hints
	fixes/maketext-code-execution - [1735f6f] http://bugs.gentoo.org/448632
Fix misparsing of maketext strings.
	fixes/cgi-cr-escaping - https://bugs.gentoo.org/443446 CR escaping for
P3P and Set-Cookie headers
	debian/cpan-missing-site-dirs - https://bugs.gentoo.org/422981 Fix
CPAN::FirstTime defaults with nonexisting site dirs if a parent is writable

[...]

>  2. Would you be willing to contribute your patch to Net::SMTP upstream,
>     for example by mailing it to bug-libnet@rt.cpan.org with
>     the string "[rt.cpan.org #93823]" somewhere in the subject line[2]?

I just did s/INET/INET6/g. I don't know Perl, so I guess Seffen Ullrich
could help here more than I can.

Regards
Matthias-Christian

```

## Steffen Ullrich, 2014-05-01 20:48

Subject: Re: git send-email doesn't work with IPv6 and STARTTLS
Message-ID: <20140501204814.GA31294@genua.de>
URL: https://gitlist.dev/e/20140501204814.GA31294%40genua.de
In-Reply-To: <20140501180546.GA9218@google.com>

```

Hi,

Net::SMTP does neither supports SSL nor IPv6.

git-send-mail does not use Net::SMTP directly for SSL support, but:
- for direct connections (port 465) it uses Net::SMTP::SSL which just
  replaces the superclass if Net::SMTP with IO::Socket::SSL and thus
  implicitly supports IPv6 (because IO::Socket::SSL does)
- for plain connections with SSL upgrade git-send-mail uses Net::SMTP for
  the initial connect and then does Net::SMTP::SSL->start_SSL (e.g.
  inherited from IO::Socket::SSL) to upgrade the socket to SSL.

The problem here is that Net::SMTP does not support IPv6, but this
should be solvable by using Net::INETGlue::INET_is_INET6 before loading
Net::SMTP.

But all these tricks are just workarounds for missing IPv6 and SSL support
directly in the Net::SMTP, Net::FTP and Net::POP3.
I therefore repeat my proposal from RT#93823 (no response yet) to add
transparent support for IPv6 and SSL into these modules. By transparent I
mean that the features are available if the necessary modules are installed
(e.g. IO::Socket::SSL for SSL and IO::Socket::INET6 or IO::Socket::IP for
IPv6), but that it works like before if they are not installed.

I don't have these patches yet, but most of the necessary code is already
there in Net::SSLGlue and Net::INET6Glue.
Would you accept and incorporate such patches?

Regards,
Steffen

On Thu, May 01, 2014 at 11:05:46AM -0700, Jonathan Nieder <jrnieder@gmail.com> wrote:
> Hi,
> 
> Matthias-Christian Ott wrote[1]:
> 
> > git send-email uses Net::SMTP connections that use STARTTLS. Net::SMTP
> > does not support IPv6. I patched Net:SMTP to use IO::Socket::INET6 and
> > it worked.
> 
> Thanks for reporting.
> 
>  1. What version of Net::SMTP do you use?
> 
>  2. Would you be willing to contribute your patch to Net::SMTP upstream,
>     for example by mailing it to bug-libnet@rt.cpan.org with
>     the string "[rt.cpan.org #93823]" somewhere in the subject line[2]?
> 
> Hope that helps,
> Jonathan
> 
> [1] http://thread.gmane.org/gmane.comp.version-control.git/247769
> [2] https://rt.cpan.org/Public/Bug/Display.html?id=93823
> https://rt.cpan.org/NoAuth/RT/CPAN/Usage.html

-- 
genua
Gesellschaft fuer Netzwerk- und Unix-Administration mbH
Domagkstrasse 7, 85551 Kirchheim bei Muenchen
tel +49 89 991950-0, fax -999, www.genua.de
Geschaeftsfuehrer: Dr. Magnus Harlander, Dr. Michaela Harlander,
Bernhard Schneck. Amtsgericht Muenchen HRB 98238

```

## Jonathan Nieder, 2014-05-01 20:55

Subject: Re: git send-email doesn't work with IPv6 and STARTTLS
Message-ID: <20140501205509.GC9218@google.com>
URL: https://gitlist.dev/e/20140501205509.GC9218%40google.com
In-Reply-To: <20140501204814.GA31294@genua.de>

```
Hi,

Steffen Ullrich wrote:

> git-send-mail does not use Net::SMTP directly for SSL support, but:
> - for direct connections (port 465) it uses Net::SMTP::SSL which just
>   replaces the superclass if Net::SMTP with IO::Socket::SSL and thus
>   implicitly supports IPv6 (because IO::Socket::SSL does)
> - for plain connections with SSL upgrade git-send-mail uses Net::SMTP for
>   the initial connect and then does Net::SMTP::SSL->start_SSL (e.g.
>   inherited from IO::Socket::SSL) to upgrade the socket to SSL.
>
> The problem here is that Net::SMTP does not support IPv6, but this
> should be solvable by using Net::INETGlue::INET_is_INET6 before loading
> Net::SMTP.

Sounds like a good change, fwiw.  Even after Net::SMTP is fixed, it
would be useful as a way to make sure git works well with old versions
of Net::SMTP too.

> But all these tricks are just workarounds for missing IPv6 and SSL support
> directly in the Net::SMTP, Net::FTP and Net::POP3.
> I therefore repeat my proposal from RT#93823 (no response yet) to add
> transparent support for IPv6 and SSL into these modules. By transparent I
> mean that the features are available if the necessary modules are installed
> (e.g. IO::Socket::SSL for SSL and IO::Socket::INET6 or IO::Socket::IP for
> IPv6), but that it works like before if they are not installed.
>
> I don't have these patches yet, but most of the necessary code is already
> there in Net::SSLGlue and Net::INET6Glue.
> Would you accept and incorporate such patches?

Thanks for a kind offer.  I am not Net::SMTP upstream, but I'd be
happy to work with upstream to get such patches applied.

Thanks for your work,
Jonathan

```
