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

Connect per IPv6 #143

Closed
genofire opened this issue Jul 26, 2020 · 7 comments
Closed

Connect per IPv6 #143

genofire opened this issue Jul 26, 2020 · 7 comments

Comments

@genofire
Copy link

genofire commented Jul 26, 2020

Hello,
i try to connect to a smtp server per ipv6 - which was not possible, even with:

family: :inet6

as parameter (and hacky by change it in code here):

I always got:

{:network_failure, 'mx01.example.org', {:error, :enetunreach}}
@MatheusBueno782
Copy link
Contributor

Hello @genofire and sorry for taking too long to answer.

Do you still have the issue? if yes, could you give us more information about it? I little bit more of code and context will help me to give you a more precise answer.

thanks!

@Fnux
Copy link
Contributor

Fnux commented Jan 18, 2021

That issue happens when you try to connect to a SMTP when in an IPv6-only environment. Erlang makes a difference between the :inet and :inet6 families, which usually needs to be specified by hand.

I just hit this - my production environment is IPv6-only - and will patch it.

@Fnux
Copy link
Contributor

Fnux commented Jan 18, 2021

https://github.com/fewlinesco/bamboo_smtp/blob/develop/lib/bamboo/adapters/smtp_adapter.ex#L524 <- the :family option is not handled in to_gen_smtp_server_config.

@Fnux
Copy link
Contributor

Fnux commented Jan 18, 2021

Ah, it's not the gen_smtp server but client config, my bad. We need to specify the sockopts option of gen_smtp_client.

@Fnux
Copy link
Contributor

Fnux commented Jan 18, 2021

Erk. sockopts is not simply passed to gen_tcp but processed by smtp_socket (https://github.com/gen-smtp/gen_smtp/blob/master/src/smtp_socket.erl). The later doesn't seem to care much about IPv6...

@Fnux
Copy link
Contributor

Fnux commented Jan 18, 2021

After some erlang-reading: inet6 is indeed passed to gen_tcp, but along side the default {:ip, {0,0,0,0}} which should be {:ip, {0,0,0,0,0,0,0,0}}.

@MatheusBueno782
Copy link
Contributor

Hey @Fnux.

Thanks a lot for your contribution! We already merged your patch and it is available in our latest release. I'm closing this issue since it's now solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants