[erlang-questions] inet_res:getbyname/2 and udp:connect/3

Per Hedeland per@REDACTED
Wed Jun 16 08:07:03 CEST 2010


Tony Rogvall <tony@REDACTED> wrote:
>
>> What version of OTP did you try on? What OS?
>
>Erlang R13B04 (erts-5.7.5) [source] [smp:2:2] [rq:2] [async-threads:0] =
>[hipe] [kernel-poll:false]
>
>on
>
>Darwin p13 10.3.0 Darwin Kernel Version 10.3.0: Fri Feb 26 11:58:09 PST =
>2010; root:xnu-1504.3.12~1/RELEASE_I386 i386

OK - I get the same behaviour as before with R13B04 on FreeBSD (using
the FreeBSD "port" in both cases) though, so it seems it is a "OS-
specific" problem. But since it works in passive mode and the difference
between active and passive is all in Erlang/inet_drv (right?), I guess
it's a problem with the Erlang/OTP build for FreeBSD rather than with
FreeBSD "itself".

>Something with the loopback interface ?

Very unlikely given the above.

>Is it possible to trace the loopback interface and see that it generates
>the ICMP?

Indeed it is:

07:51:01.439571 IP 127.0.0.1.61776 > 127.0.0.1.12345: UDP, length 3
07:51:01.439613 IP 127.0.0.1 > 127.0.0.1: ICMP 127.0.0.1 udp port 12345 unreachable, length 36

Happens in both active and passive mode.

>Try an other interface where there is a host ...

Haven't done that, maybe I will (right now I happen to be on a network
where other hosts don't have the courtesy to send ICMP unreachables:-).
I noticed something else interesting though - in passive mode:

9> gen_udp:send(U, <<1,2,3>>).        
ok
10> gen_udp:send(U, <<1,2,3>>).        
{error,econnrefused}
11> gen_udp:send(U, <<1,2,3>>).        
ok
12> gen_udp:send(U, <<1,2,3>>).
{error,econnrefused}
13> gen_udp:send(U, <<1,2,3>>).
ok
14> gen_udp:send(U, <<1,2,3>>).        
{error,econnrefused}

I.e. the error is detected, but only on a subsequent send() (which
doesn't actually send anything).

--Per


More information about the erlang-questions mailing list