-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Conversation
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.
Unable to build docs: net_kernel.xml ^ 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 ^ |
1 similar comment
Unable to build docs: net_kernel.xml ^ 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 fetch branch: fatal: A branch named 'saleyn/proto_dist' already exists. |
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. |
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. |
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 |
Re-fetched. |
Great! Let me know how the review goes. If there are any questions regarding implementation I am open to discussion. |
Abort constraint checking when a strict one fails
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.