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

Multicast support in UDP input #4286

Open
monai opened this issue Aug 31, 2023 · 0 comments
Open

Multicast support in UDP input #4286

monai opened this issue Aug 31, 2023 · 0 comments

Comments

@monai
Copy link

monai commented Aug 31, 2023

Is your feature request related to a problem? Please describe.

UDP input supports only unicast connections.

Describe the solution you'd like

Add a group parameter to the UDP input plugin configuration, e.g.:

desc 'The multicast group address to join to.'
config_param :group, :string, default: nil

If the user provides the value and it is a valid multicast IP address, join the socket to the multicast group of that address.

Describe alternatives you've considered

I cloned builtin in_udp.rb and added the necessary code:

def multi_workers_ready?
  false
end

def start
  super

  log.info "listening udp socket", bind: @bind, port: @port
  server = server_create(:in_udp_server, @port, proto: :udp, bind: @bind, resolve_name: !!@source_hostname_key, max_bytes: @message_length_limit, receive_buffer_size: @receive_buffer_size) do |data, sock|
    # ...
  end

  @membership = IPAddr.new(@group).hton + IPAddr.new(@bind).hton
  sock = server.instance_variable_get(:@sock)
  sock.setsockopt(:IPPROTO_IP, :IP_ADD_MEMBERSHIP, @membership)
end

Additional context

The difference between unicast and multicast is in the lower protocol, IP, and is taken care of by the network infrastructure. The rest from the user perspective is the same; therefore, I think multicast support should be an option in the built-in UDP input plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants