dhcpcd icon indicating copy to clipboard operation
dhcpcd copied to clipboard

Add debug logging for system state changes

Open agowa opened this issue 2 years ago • 5 comments

Add logging for reading and writing to system files including /proc

agowa avatar Jan 24 '23 05:01 agowa

@agowa338 This is adding an awful lot of debug to dhcpcd and it has plenty already. What specifically are we trying to debug here? You must have had a reason to do this.

I'm happy to take the code in that adjusts comments in the headers and any other non debug related improvements in a separate PR.

rsmarples avatar May 02 '23 15:05 rsmarples

this looks like a level of detail where you might as well use DTrace for

(or eBPF on Linux these days?)

igalic avatar May 03 '23 06:05 igalic

The reason was that dhcpcd was changing system configuration that I had explicitely defined otherwise (and it doing so caused service disruptions). So I wasted excessive time trying to understand why sysctl is not applying it. I ran everything with debug output, but dhcpcd didn't log anything, so I was assuming that it didn't change anything and wasted a lot of time trying to debug and find what application actually touched it...

agowa avatar May 08 '23 11:05 agowa

What sysctls are we talking about here that would cause a service distruption? dhcpcd will change the following IPv6 related tunables:

  • disables the kernel from making it's own IPv6 LL addresses because it will make it's own stable private address.
  • disables the kernel from doing autoconf or accept_ra because dhcpcd will do it instead
  • adjust interface tunables for hop limit, retrans and reachable based on RA received

You can stop dhcpcd from doing this by disabling IPv6 or IPv6RS support in dhcpcd.

Otherwise I'm not sure what else dhcpcd would stamp on and cause a problem?

rsmarples avatar May 08 '23 11:05 rsmarples

It has been a while, but if I recall correctly, it was an interaction between multiple settings (at least accept_ra and forwarding) that caused the disruption.

The system was used to run containers (I.E. forwarding was enabled). But dhcpcd set accept_ra to 1 (or 0, don't know anymore), whereas I had set it to 2 within a startup task explicitly. Other systems on the same lan were advertising their internal container/vm/vpn/... networks, so that traffic to them was routed directly instead of to the gateway (which filtered it).

And disabling dhcpcd was not an option, because I needed it to get me a prefix using DHCP-PD...

agowa avatar May 08 '23 12:05 agowa