microsoft / omi

Open Management Infrastructure
Other
361 stars 115 forks source link

omiserver only opens IPv6 socket #663

Closed patjgardner closed 4 years ago

patjgardner commented 4 years ago

Running the latest rpm package omi-1.6.4-1.x86_64 the omiserver only opens an ipv6 socket and no ipv4 socket.

omiserver.log shows:

2020/04/10 21:47:54 [748686,748686] WARNING: null(0): EventId=30222 Priority=WARNING Trying to listen on IPv6 2020/04/10 21:47:54 [748686,748686] WARNING: null(0): EventId=30225 Priority=WARNING Turn off IPV6_V6ONLY pass.

/proc/sys/net/ipv6/bindv6only is set to 0.

I cannot see any options in either omiserver.conf or to pass directly to omiserver to configure ip sockets.

JumpingYang001 commented 4 years ago

it is by design, while it listen on IPV6, it will also handle IPV4 when 'Turn off IPV6_V6ONLY' setting., both IPV6 and IPV4 will work at that setting.

patjgardner commented 4 years ago

But as you can see, IPV6_V6ONLY has value false, as defined by /proc/sys/net/ipv6/bindv6only , yet is still only opening a socket on ipv6.

JumpingYang001 commented 4 years ago

yes, we listen on IPV6, but it will handle both IPV6 and IPV4 addresses, so it should be fine for users; and if IPV6 listen fail, it will try listen only on IPV4.

patjgardner commented 4 years ago

sudo lsof -i :wsmans COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME omiengine 2219 omi 7u IPv6 42465 0t0 TCP *:wsmans (LISTEN)

That is the full output when the omi service is running. As you can see, only IPv6 is listening. As in my first post:

/proc/sys/net/ipv6/bindv6only is set to 0

Clearly the omiserver is not respecting the value in bindv6only as you say that it should be.

JumpingYang001 commented 4 years ago

/proc/sys/net/ipv6/bindv6only is set to 0

this is expected behavior, it will turn off IPV6_V6ONLY, and can handle IPV4, too.

patjgardner commented 4 years ago

This is very frustrating. I'm trying to be patient here when you are not understanding what I am telling you, even when I provide evidence. I even provided the output of 'lsof' for you to show that no ipv4 socket was open for the omi process.

It does no good to keep repeating that this is all expected behaviour. It is NOT working as expected, hence I have reported an issue.

I have no idea how to put this politely, but no amount of wishful thinking is going to open up that port when clearly there is a problem with how the code assesses IPV6_V6ONLY on linux.

I am trying to be helpful. I do not understand why you will not investigate this, when as far as I can see I have demonstrated to the best of my knowledge that this is a bug.

SubZer0MS commented 4 years ago

https://github.com/microsoft/omi/pull/649 => https://github.com/microsoft/omi/pull/649/commits/a13d98b8cb3491d40851546bb3aaa90b2e05f4b9

in6addr_any will listen on both IPv6 and IPv4: http://man7.org/linux/man-pages/man7/ipv6.7.html

/****/ / After the socket descriptor is created, a bind() function gets a / / unique name for the socket. In this example, the user sets the / / address to in6addr_any, which (by default) allows connections to / / be established from any IPv4 or IPv6 client that specifies port / / 3005. (that is, the bind is done to both the IPv4 and IPv6 TCP/IP / / stacks). This behavior can be modified using the IPPROTO_IPV6 / / level socket option IPV6_V6ONLY if required. / /****/

patjgardner commented 4 years ago

@SubZer0MS Thanks for the reference to #649. I had noticed that an assumed this error crept in recently when the 'fix' for ipv6 was added. I was already aware of the contents of the manpage and how the system binds sockets.

Were you adding this for the benefit of @JumpingYang001 ?

JumpingYang001 commented 4 years ago

@patjgardner I understand what you mean now, you mean 'lsof -i' should list both IPV4 and IPV6, right?

patjgardner commented 4 years ago

@JumpingYang001 Yes!

JumpingYang001 commented 4 years ago

@patjgardner yes, we only listen on IPV6 now, and we support IPV4 with "IPv4-on-IPv6 to address an IPv4 host" .

http://man7.org/linux/man-pages/man7/ipv6.7.html

IPv6 supports several address types: unicast to address a single host, multicast to address a group of hosts, anycast to address the nearest member of a group of hosts (not implemented in Linux), IPv4-on-IPv6 to address an IPv4 host, and other reserved address types.