Bug in epmd_srv.c?
Fri Sep 4 00:24:34 CEST 2009
I've been working on a helper module to enable usage of epmd for
things other than just nodes (i.e. poor man's zeroconf service). In
the process, I've found some discrepancies in the epmd documentation
and server code. I _think_ there is a bug or two there, but would
appreciate validation by the OTP team -- it could just be a lack of
understanding on my part. :)
First off, the docs for the distribution protocol state that the
ALIVE2_REQ has the field "LowestVersion" followed by "HighestVersion".
However, the implementation in erl_epmd.erl has them reversed as does
the documentation for the PORT2_RESP packet. This is, I believe, a
minor documentation bug.
Secondly, in erts/epmd/src/epmd_srv.c:628 (R13B01), there is the following line:
offset += (strlen(node->extra)-1);
Unfortunately, if the length of the extra field is zero, this causes
the last byte of the packet to disappear as it winds up decrementing
Reading through epmd, it looks like the expectation is that the extra
field is null-terminated --- but the docs make no mention of it. This
is somewhat odd to me as that field is prefixed with a 2 byte length
value in the protocol, so I see no reason for the implementation to
require the data to be a C string. Of course, this may be for
backwards compatibility purposes; it's hard to know for sure.
Any guidance/illumination on these issues would be appreciated.
More information about the erlang-questions