fluent / fluentd

Fluentd: Unified Logging Layer (project under CNCF)
https://www.fluentd.org
Apache License 2.0
12.81k stars 1.34k forks source link

in_forward plugin bind on both ipv4 and ipv6 #3001

Open inistor opened 4 years ago

inistor commented 4 years ago

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

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**
    @type forward
    bind "::"



Issue discussed on fluentd Google Group [here](https://groups.google.com/forum/#!topic/fluentd/3lyJkd2wHPY).
inistor commented 4 years ago

Hi there,

Has anyone taken a look over the issue described above?

Thanks, Ion

github-actions[bot] commented 3 years ago

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

inistor commented 3 years ago

@repeatedly hi there; any updates here?

minusbat commented 3 years ago

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

ashie commented 3 years ago

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 commented 3 years ago

We need to modify ServerEngine to realize it:

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

jaymzh commented 3 years ago

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.

inistor commented 3 years ago

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

soostdijck commented 9 months ago

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?