Skip to content

Commit

Permalink
Support IPv6 UDP sockets
Browse files Browse the repository at this point in the history
  • Loading branch information
Arend Lapere committed Nov 19, 2020
1 parent 8d4ac25 commit 7865e3f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/logstash/inputs/syslog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,11 @@ def udp_listener(output_queue)
@logger.info("Starting syslog udp listener", :address => "#{@host}:#{@port}")

@udp.close if @udp
@udp = UDPSocket.new(Socket::AF_INET)
if IPAddr.new(@host).ipv6?
@udp = UDPSocket.new(Socket::AF_INET6)
elsif IPAddr.new(@host).ipv4?
@udp = UDPSocket.new(Socket::AF_INET)
end
@udp.do_not_reverse_lookup = true
@udp.bind(@host, @port)

Expand Down

0 comments on commit 7865e3f

Please sign in to comment.