Skip to content

Multicast support in UDP input #4286

Open
@monai

Description

@monai

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementFeature request or improve operations

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions