Inets socket_type, what's ip_comm and how order IPvX sockets?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Inets socket_type, what's ip_comm and how order IPvX sockets?

Ameretat Reith
I'm using tsung and it open a HTTP server to give me good things by inets API
[1]  But it open just IPv6 sockets and TCP connections over IPv4 connections
will fail.  I looked into inets to find how it finds to open IPv4 or IPv6
sockets and saw socket_type which defaults to ip_comm. [2]  What is this?  Is this
mean IPv4 or IPv6 if system support?  Can I provide inets more information to
listen to both IPv4 and IPv6?

I think for listenning on both IPv4 and IPv6 using same port number, one should
open two sockets and set REUSE_PORT option.  Can inets understand this by
looking to socket_type or something?  Can I (in inets:start call) tell I wan't
IPv4 sockets?  Or tell inets lib totally forget about IPv6 and open IPv4 sockets
always?

1: https://github.com/processone/tsung/blob/18a318884282a17f419850169aefec9bdd5fc2ac/src/tsung_controller/ts_controller_sup.erl#L118

2: https://github.com/erlang/otp/blob/3b7a6ffddc819bf305353a593904cea9e932e7dc/lib/inets/include/httpd.hrl#L31

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Inets socket_type, what's ip_comm and how order IPvX sockets?

Kenneth Lakin
On 09/19/2016 10:14 AM, Ameretat Reith wrote:
> Can I (in inets:start call) tell I wan't IPv4 sockets?

I'm pretty sure that adding the tuple

{bind_address, {0,0,0,0}}

to the property list in the inets:start call [0] will create an HTTP
server that listens for only IPv4 requests. (Feel free to replace the
IPv4 ANY address with a real address if you only want to listen on a
particular interface.)

I have no idea how to fix your problem with tseung, though.

[0] The prop list is the second argument to the inets:start function.



_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Inets socket_type, what's ip_comm and how order IPvX sockets?

Ingela Andin
In reply to this post by Ameretat Reith
Hi!

2016-09-19 19:14 GMT+02:00 Ameretat Reith <[hidden email]>:
I'm using tsung and it open a HTTP server to give me good things by inets API
[1]  But it open just IPv6 sockets and TCP connections over IPv4 connections
will fail.  I looked into inets to find how it finds to open IPv4 or IPv6
sockets and saw socket_type which defaults to ip_comm. [2]  What is this?

This is a legacy name. It does not imply ipv4 or ipv6 it implies not SSL/TLS or
HTTP as opposed to  HTTPS.

There is an ipfamily option that you can set to get inet or inet6.


Regards Ingela Erlang/OTP team - Ericsson AB


Is this
mean IPv4 or IPv6 if system support?  Can I provide inets more information to
listen to both IPv4 and IPv6?

I think for listenning on both IPv4 and IPv6 using same port number, one should
open two sockets and set REUSE_PORT option.  Can inets understand this by
looking to socket_type or something?  Can I (in inets:start call) tell I wan't
IPv4 sockets?  Or tell inets lib totally forget about IPv6 and open IPv4 sockets
always?

1: https://github.com/processone/tsung/blob/18a318884282a17f419850169aefec9bdd5fc2ac/src/tsung_controller/ts_controller_sup.erl#L118

2: https://github.com/erlang/otp/blob/3b7a6ffddc819bf305353a593904cea9e932e7dc/lib/inets/include/httpd.hrl#L31

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions



_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Inets socket_type, what's ip_comm and how order IPvX sockets?

Ameretat Reith
In reply to this post by Kenneth Lakin
On Tuesday, September 20, 2016 2:10:26 AM IRDT, Kenneth Lakin wrote:

> On 09/19/2016 10:14 AM, Ameretat Reith wrote:
>> Can I (in inets:start call) tell I wan't IPv4 sockets?
>
> I'm pretty sure that adding the tuple
>
> {bind_address, {0,0,0,0}}
>
> to the property list in the inets:start call [0] will create an HTTP
> server that listens for only IPv4 requests. (Feel free to replace the
> IPv4 ANY address with a real address if you only want to listen on a
> particular interface.)

Thanks.  Strangely I can see now tsung opens IPv4 sockets:

tcp        0      0 10.0.3.148:8091         0.0.0.0:*               LISTEN

But packets won't responded, tcpdump:

06:59:04.480107 IP gw.60546 > 10.0.3.148.8091: Flags [S], seq 2442667145,
win 27200, options [mss 1360,sackOK,TS val 4075095 ecr 0,nop,wscale 7],
length 0
06:59:04.728993 IP gw.60548 > 10.0.3.148.8091: Flags [S], seq 2593659205,
win 27200, options [mss 1360,sackOK,TS val 4075345 ecr 0,nop,wscale 7],
length 0

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Inets socket_type, what's ip_comm and how order IPvX sockets?

Ameretat Reith
In reply to this post by Ingela Andin
Sorry for multiple mails list, I and mail client became crazy at the same
time.

> This is a legacy name. It does not imply ipv4 or ipv6 it implies not
> SSL/TLS or
> HTTP as opposed to  HTTPS.
>
> There is an
> *ipfamily option that you can set to get inet or inet6. *

Thanks.

So, going back to first mail questions, the only thing that is not
currently
possibe is getting one inets listenning on both IPv4 and IPv6, correct?

So It looks like a task of inets user (tsung) to conclude whether machine
has
IPv6 or IPv4 capabilites and open correct listenning socket.  It was nice
if inets did this and user could use services in an IP agnostinc way, imho.

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions