[erlang-questions] Possible hostname handling bug in node handshake procedure?

3 views
Skip to first unread message

Maas-Maarten Zeeman

unread,
Nov 24, 2009, 3:47:05 AM11/24/09
to erlang-q...@erlang.org
Today I stumbled upon some strange behavior when using net_adm:ping.
I was trying to connect two machines, buka and Edo on the same lan,
but it just would get them to talk to each other. Net_adm:ping worked
in one way only. Normal ping worked both ways, double checked if there
where firewall rules. I even looked at the network packets, which I
could see arriving at both ends. Then it slowly dawned on me. One of
the hosts has a hostname with a capital in it. so I tried to the exact
name. It worked...

Here is what happens.

(a@buka)1> net_adm:ping(b@edo).
**long wait**
pang
(a@buka)2> net_adm:ping(b@Edo).
pong

In both situations the network packets arrive at b@edo. To me it looks
like there is a case sensitivity problem with the hostname handling in
the handshake procedure.

(a@buka)51> net_adm:ping(a@buka).
pong
(a@buka)52> net_adm:ping(a@BUKA).
pang

Shouldn't both calls return pong as hostnames should normally be
treated as case insensitive strings?

Kind regards,

Maas-Maarten Zeeman


________________________________________________________________
erlang-questions mailing list. See http://www.erlang.org/faq.html
erlang-questions (at) erlang.org

Bengt Kleberg

unread,
Nov 24, 2009, 4:26:46 AM11/24/09
to erlang-q...@erlang.org
Greetings,

What are your ideas about both parts of the node name? Should they be
case insensitive or just the host name part?

Consider the node aA@Bb

It might be confusing to have
net_adm:ping(aA@bb) => pong
but then get
net_adm:ping(aa@Bb) => pang

So we probably should have case insensitivity here. But then we have to
explain why aA =:= aa is false in all the rest of the code.


Perhaps this is a problem only for me.


bengt

Bernard Duggan

unread,
Nov 24, 2009, 6:20:43 PM11/24/09
to Maas-Maarten Zeeman, erlang-q...@erlang.org
Maas-Maarten Zeeman wrote:
> (a@buka)1> net_adm:ping(b@edo).
> **long wait**
> pang
> (a@buka)2> net_adm:ping(b@Edo).
> pong
>
> In both situations the network packets arrive at b@edo. To me it looks
> like there is a case sensitivity problem with the hostname handling in
> the handshake procedure.
Remember, though: What you're passing to ping() is not a host name, it's
a /node/ name. A node name is an erlang atom and is therefore case
sensitive. It's certainly derived from a hostname, and might seem at
first like it should be case insensitive as a result, but as Bengt noted
that would mean implying atom equality where they're not actually equal.

Cheers,

Bernard

Reply all
Reply to author
Forward
0 new messages