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

Add net_kernel and epmd support for multiple simultaneous distributed transport protocols #121

Closed
wants to merge 1 commit into from

Conversation

saleyn
Copy link
Contributor

@saleyn saleyn commented Nov 1, 2013

This patch addresses the limitation of registering only one Erlang
distributed transport with Erlang Port Mapping Daemon, and therefore
enabling a node to listen for distributed node connections on multiple
port using different protocols, and selectively choose the protocol
to use when connecting to a node from different secure and unsecure
networks.

The legacy implementation of Erlang distributed transport allows to
start a node with more than one transport via the
"-proto_dist mod1 mod2 ..." command-line option. But epmd didn't support
registration of multiple protocols. And net_kernel doesn't implement a
way of figuring out which transports are supported on a remote node and
doesn't allow to select a desired transport protocol of choice to use it
for connecting to the node.

The current patch extends epmd by having it store the name of the protocol
handling module passed to the -proto_dist startup option during node
registration. Multiple registrations are allowed, and they can be
registered to different ports. This way a node can start distributed
transport listeners (e.g. TCP, SSL, UDS), and register them with epmd.

When another node does epmd lookup in order to connect to node X, it
now gives to epmd a list of transport names it supports (i.e. the ones
that were passed to it via -proto_dist option at startup) together with
the node name it queries. The epmd filters out only the transports
supported by the calling client node, and gives back only those along
with the corresponding port numbers.

net_kernel now supports a new command-line option
"-proto_dist_mf Mod Fun" which is a user-define callback function that
can be used to resolve which transport protocol to use to connect to
a node. This function is called after the epmd query returned a list
of protocols supported by the target node. By default the first
transport in the list is used. An example implementation of this
function is included in
lib/kernel/examples/uds_dist/src/dist_selector.erl.

In order to support backward compatibility the EPMD protocol was
extended with new commands documented in erl_dist_rotocol.xml. Old
nodes can query the new EPMD version, but new nodes (using this patch)
require new version of EPMD.

This patch addresses the limitation of registering only one Erlang
distributed transport with Erlang Port Mapping Daemon, and therefore
enabling a node to listen for distributed node connections on multiple
port using different protocols, and selectively choose the protocol
to use when connecting to a node from different secure and unsecure
networks.

The legacy implementation of Erlang distributed transport allows to
start a node with more than one transport via the
`-proto_dist mod1 mod2 ...` command-line option. But epmd didn't support
registration of multiple protocols. And net_kernel doesn't implement a
way of figuring out which transports are supported on a remote node and
doesn't allow to select a desired transport protocol of choice to use it
for connecting to the node.

The current patch extends epmd by having it store the name of the protocol
handling module passed to the -proto_dist startup option during node
registration.  Multiple registrations are allowed, and they can be
registered to different ports.  This way a node can start distributed
transport listeners (e.g. TCP, SSL, UDS), and register them with epmd.

When another node does epmd lookup in order to connect to node X, it
now gives to epmd a list of transport names it supports (i.e. the ones
that were passed to it via -proto_dist option at startup) together with
the node name it queries.  The epmd filters out only the transports
supported by the calling client node, and gives back only those along
with the corresponding port numbers.

net_kernel now supports a new command-line option
`-proto_dist_mf Mod Fun` which is a user-define callback function with
four arguments that can be used to resolve which transport protocol
to use to connect to a node. This function is called after the epmd
query returned a list of protocols supported by the target node.
By default the first transport in the list is used. An example
implementation of this function is included in
`lib/kernel/examples/uds_dist/src/dist_selector.erl`.

In order to support backward compatibility the EPMD protocol was
extended with new commands documented in erl_dist_rotocol.xml. Old
nodes can query the new EPMD version, but new nodes (using this patch)
require new version of EPMD.
@OTP-Maintainer
Copy link

Unable to build docs: net_kernel.xml
net_kernel.xml:95: parser error : Opening and ending tag mismatch: c line 94 and p


^
net_kernel.xml:96: parser error : Opening and ending tag mismatch: p line 61 and description

^
net_kernel.xml:343: parser error : Opening and ending tag mismatch: description line 32 and erlref

^
net_kernel.xml:345: parser error : Premature end of data in tag erlref line 4

^
unable to parse net_kernel.xml
make[4]: *** [../man3/net_kernel.3] Error 6
make[4]: Leaving directory /ldisk/jenkins/workspace/pullrequests/otp/lib/kernel/doc/src' make[3]: *** [release_docs] Error 2 make[3]: Leaving directory/ldisk/jenkins/workspace/pullrequests/otp/lib/kernel/doc/src'
make[2]: *** [release_docs] Error 2
make[2]: Leaving directory /ldisk/jenkins/workspace/pullrequests/otp/lib/kernel' make[1]: *** [release_docs] Error 2 make[1]: Leaving directory/ldisk/jenkins/workspace/pullrequests/otp/lib'
make: *** [release_docs] Error 2

1 similar comment
@OTP-Maintainer
Copy link

Unable to build docs: net_kernel.xml
net_kernel.xml:95: parser error : Opening and ending tag mismatch: c line 94 and p


^
net_kernel.xml:96: parser error : Opening and ending tag mismatch: p line 61 and description

^
net_kernel.xml:343: parser error : Opening and ending tag mismatch: description line 32 and erlref

^
net_kernel.xml:345: parser error : Premature end of data in tag erlref line 4

^
unable to parse net_kernel.xml
make[4]: *** [../man3/net_kernel.3] Error 6
make[4]: Leaving directory /ldisk/jenkins/workspace/pullrequests/otp/lib/kernel/doc/src' make[3]: *** [release_docs] Error 2 make[3]: Leaving directory/ldisk/jenkins/workspace/pullrequests/otp/lib/kernel/doc/src'
make[2]: *** [release_docs] Error 2
make[2]: Leaving directory /ldisk/jenkins/workspace/pullrequests/otp/lib/kernel' make[1]: *** [release_docs] Error 2 make[1]: Leaving directory/ldisk/jenkins/workspace/pullrequests/otp/lib'
make: *** [release_docs] Error 2

@OTP-Maintainer
Copy link

Unable to fetch branch: fatal: A branch named 'saleyn/proto_dist' already exists.

@rimmius
Copy link
Contributor

rimmius commented Nov 4, 2013

I'll look into the doc problem and assign it to be reviewed by responsible developers. I will also close the pullrequest and will let you know the outcome of the review.
Thanks,

@rimmius rimmius closed this Nov 4, 2013
@saleyn
Copy link
Contributor Author

saleyn commented Nov 5, 2013

I'm updating the net_kernel integration tests. It appears that one of them was failing. Will do another commit in a couple of hours. Will also check the documentation formatting issue.

@saleyn
Copy link
Contributor Author

saleyn commented Nov 5, 2013

I committed the changes that fixed the documentation, along with a fix for one failing test case, and added more tests, please refetch:

git fetch git://github.com/saleyn/otp.git proto_dist

https://github.com/saleyn/otp/compare/erlang:master...proto_dist
https://github.com/saleyn/otp/compare/erlang:master...proto_dist.patch

@rimmius
Copy link
Contributor

rimmius commented Nov 5, 2013

Re-fetched.
Thanks,

@saleyn
Copy link
Contributor Author

saleyn commented Nov 5, 2013

Great! Let me know how the review goes. If there are any questions regarding implementation I am open to discussion.

uabboli pushed a commit to uabboli/otp that referenced this pull request Dec 1, 2020
Abort constraint checking when a strict one fails
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

Successfully merging this pull request may close these issues.

None yet

3 participants