Skip to content

IPv4 ping is broken on Flatcar Container Linux #122

Closed

Description

@artherd42

Describe the bug
When migrating our Kubernetes nodes from CoreOS to Flatcar Linux, the cloudprober ping probes stopped working with error message

W0329 14:01:01.380354       1 ping.go:375] [cloudprober] Not a valid ICMP echo reply packet from: xxx

ICMP reply looks like:

00000000  45 00 00 54 fc e2 00 00  40 01 95 ab 0a 2e 65 d5  |[email protected].|
00000010  64 5a 13 be 00 00 ca e1  06 cc 06 01 16 e0 de 89  |dZ..............|
00000020  fe 35 a4 6b 16 e0 de 89  fe 35 a4 6b 16 e0 de 89  |.5.k.....5.k....|
00000030  fe 35 a4 6b 16 e0 de 89  fe 35 a4 6b 16 e0 de 89  |.5.k.....5.k....|
00000040  fe 35 a4 6b 16 e0 de 89  fe 35 a4 6b 16 e0 de 89  |.5.k.....5.k....|
00000050  fe 35 a4 6b 00 00 00 00  00 00 00 00 00 00 00 00  |.5.k............|

Apparently the same issue as reported in #80.

Cloudprober Version
v0.11.6

Additional context
I have temporarily fixed the issue by removing runtime.GOOS == "darwin" && in code line
https://github.com/cloudprober/cloudprober/blob/master/probes/ping/ping.go#L379 and building my own custom docker image.

Activity

  1. added
    bug
    on Mar 29, 2022
  2. manugarg commented on Mar 29, 2022

    @manugarg
    Contributor

    Thanks for reporting this @artherd42, and the follow up investigation.

    I think it's a bug in Flatcar Linux if it's not stripping IP header for recvmsg() system call. I wonder what they do differently, and if GNU ping does things differently on Flatcar Linux. I'll try to find out more.

  3. artherd42 commented on Mar 29, 2022

    @artherd42
    Author

    I have found this code for the ping_recvmsg call in the Flatcar Linux repo.

  4. manugarg commented on Mar 29, 2022

    @manugarg
    Contributor

    It seems "privileged" (RAW socket) IPv4 ping (use_datagram_socket: false option) has been broken on Linux for quite some time (same as MacOS maybe, but on MacOS even DGRAM socket was broken). It's possible I didn't find it earlier as all of my personal setup, and the setup at my current and previous employers, use the "unprivileged" (DGRAM socket) ping. I'll set up some integration tests for raw sockets as well.

    Did you switch the use_datagram_socket option when you moved from CoreOS to Flatcar Linux?

    I'll send a fix pretty soon, but it will look similar to what you did.

    Thanks once again for reporting this.

  5. manugarg commented on Mar 29, 2022

    @manugarg
    Contributor
  6. added this to the v0.11.7 milestone on Mar 29, 2022
  7. manugarg commented on Mar 29, 2022

    @manugarg
    Contributor

    Leaving it open to get confirmation regarding this:

    Did you switch the use_datagram_socket option when you moved from CoreOS to Flatcar Linux?

  8. artherd42 commented on Mar 30, 2022

    @artherd42
    Author

    No, I am still running the ping_probe with use_datagram_socket: false.

  9. manugarg commented on Mar 30, 2022

    @manugarg
    Contributor

    No, I am still running the ping_probe with use_datagram_socket: false.

    use_datagram_socket: false enables RAW sockets, that's case that was broken for IPv4 Linux. So, failure on Flatcar Linux is explainable.

    However, I am surprised this option was working on CoreOS. Were you using the same Cloudprober version on CoreOS as well.

    (FYI: I'll cut a new release with #123 (v0.11.7) by the end of next week.)

  10. artherd42 commented on Mar 30, 2022

    @artherd42
    Author

    I did some more testing ping probes with the different Cloudprober versions. On CoreOS, v0.11.0 was working. Cloudprober v0.11.1 is the last good version on Flatcar Linux 5.15.30. From v0.11.2 onwards, IPv4 ping probes are failing on Flatcar Linux.

  11. manugarg commented on Mar 30, 2022

    @manugarg
    Contributor

    I see. That makes sense. Before v0.11.2 we were using recvfrom system call (through ReadFrom Go function), which strips IP header regardless of the socket type. We switched to recvmsg so that we can read control messages to find the socket receive timestamp (for better latency measurement).

    Thank you so much verifying @artherd42. Much appreciated.

    Next release will contain the fix, in the meantime, you can continue using the workaround that you're using, or build unreleased binaries from the head.

  12. manugarg commented on Mar 31, 2022

    @manugarg
    Contributor

    I've added a few tests (#125, #126, #127, #128) to detect the issue reported here. Hopefully that will help us avoid regression in future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions