fluentd icon indicating copy to clipboard operation
fluentd copied to clipboard

in_forward plugin bind on both ipv4 and ipv6

Open inistor opened this issue 4 years ago • 13 comments

Describe the bug While using the in_forward plugin, I’m trying to have it bind on both IPv4 and IPv6 addresses (for dual-stack systems); typically, when using. “::” for bind config parameter, the socket api will bind to both (as long as AF_INET6 is used). However, if I use “::” for bind config parameter, an IPv6 only socket will be created. With the default value of bind (“0.0.0.0”), an IPv4 only socket is created.

To Reproduce Using the configuration below:

<source>
        @type forward
        bind "::"
</source>

ipv6 works

[root@centos8-ion ~]# telnet -6 localhost 24224
Trying ::1...
Connected to localhost.
Escape character is '^]'.

ipv4 does not:

[root@centos8-ion ~]# telnet -4 localhost 24224
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused

A workaround is to use two sections:

<source>
        @type forward
        bind "::"
</source>
<source>
        @type forward
        bind "0.0.0.0"
</source>

Expected behavior When binding on "::" (IPv6 name for any address), IPv4 should also be bound on any address. Your Environment

  • Fluentd or td-agent version: fluentd --version or td-agent --version
[root@centos8-ion ~]# fluentd --version
fluentd 1.10.4
  • Operating system: cat /etc/os-release
[root@centos8-ion ~]# cat /etc/os-release 
NAME="CentOS Linux"
VERSION="8 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="8"
PLATFORM_ID="platform:el8"
PRETTY_NAME="CentOS Linux 8 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:8"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-8"
CENTOS_MANTISBT_PROJECT_VERSION="8"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="8"
  • Kernel version: uname -r
[root@centos8-ion ~]# uname -r
4.18.0-147.8.1.el8_1.x86_64

Your Configuration

<source>
        @type forward
        bind "::"
</source>

Issue discussed on fluentd Google Group here.

inistor avatar May 21 '20 15:05 inistor

Hi there,

Has anyone taken a look over the issue described above?

Thanks, Ion

inistor avatar Aug 27 '20 05:08 inistor

This issue has been automatically marked as stale because it has been open 90 days with no activity. Remove stale label or comment or this issue will be closed in 30 days

github-actions[bot] avatar Dec 18 '20 10:12 github-actions[bot]

@repeatedly hi there; any updates here?

inistor avatar Apr 06 '21 13:04 inistor

Just found this, as hitting the same issue. No updates I assume ?

minusbat avatar May 27 '21 19:05 minusbat

FYI: From #2902

Describe the solution you'd like

  • When specifying a hostname like localhost, all relevant addresses are listend/bound. For example:
irb(main):016:0> Addrinfo.getaddrinfo('localhost', 5140).select { |x| x.socktype == Socket::SOCK_DGRAM }           
=> [#<Addrinfo: [::1]:5140 UDP (localhost)>, #<Addrinfo: 127.0.0.1:5140 UDP (localhost)>]

ashie avatar May 28 '21 06:05 ashie

We need to modify ServerEngine to realize it:

https://github.com/treasure-data/serverengine/blob/08193f12e8a36518a35244b94f2865d974538450/lib/serverengine/socket_manager_unix.rb#L52-L70

ashie avatar May 28 '21 06:05 ashie

So #2902 got de-duped here, which is cool, but I wanna clarify there's 2 different use-cases being discussed:

  1. :: should be all-families, all-addresses
  2. should be all families that a name resolves to (ala comment https://github.com/fluent/fluentd/issues/3001#issuecomment-850160870 where @ashie is quoting my other ticket)

The first is table-stakes, but the latter should also work.

jaymzh avatar May 28 '21 20:05 jaymzh

Correct - the first item refers to how a numeric address is handled, while the second involves DNS resolution.

inistor avatar May 29 '21 16:05 inistor

I just ran into this on a v6 only k8s cluster. It's been a while, is this going to make the roadmap any time soon?

soostdijck avatar Nov 20 '23 16:11 soostdijck