I dont understand why the same fix, as on RHEL7 and Fedora, does not work on RHEL8. It seems its kernel ignores :
setsockopt(daemon->netlinkfd, SOL_NETLINK, NETLINK_NO_ENOBUFS, &opt, sizeof(opt)) == -1)
Where it works as expected on RHEL7 and Fedora. I rebuilt latest dnsmasq-2.84-1.el8.x86_64 on RHEL8, it still fails the test. But the same fix just does not work on RHEL8, at least on 1minutetip machines.
Fedora passes the test just fine sice 2.81 inclusive. I narrowed by testing to upstream commit , which is the one fixing this issue.
RHEL8 keeps spawning ENOBUFS error, even when it is requested to omit it. I think I found a reason for it, it would need change even in the latest upstream release.
Current netlink change observation algorithm ignores netlink broadcast information delivered. Instead, it just writes new address event into queue. I think when changes are fast enough, queue writing blocks netlink loop and is responsible for ENOBUFS error therefore.
Proposed fix is reducing queue writes. Because it does not use broadcasted information, but forces netlink re-reading repeated the same time as number of incoming events. Because it writes queue every time. Instead, it should just re-read once AFTER reading all asynchronous messages. Multiple events are not necessary and take not required CPU cycles. Instead of serving user requests it spends time reading netlink again and again.
Pushed multiple commits to github repo: https://github.com/InfrastructureServices/dnsmasq/tree/netlink-tests
Pushed used test to public repository, to help discussion in upstream.
Posted patches to upstream mailing list: https://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2021q1/014709.html
Created attachment 1757792 [details]
Main patch reducing netlink congestion
Created attachment 1757794 [details]
Remove whole process delay on ENOBUFS
After repeated testing of my changes, it seems it does not improve rhel8 results significantly.
Current state seems strange, like it stayed in enumerate_interfaces function, after netlink request was finished. According to strace, it continues reading after NLMSG_DONE is received.
Because iface_enumerate uses blocking reads, times start getting longer. I have no good theory how that happened and why.
My current attempts behave similar way on RHEL8 and worse way than vanilla upstream. I am missing some required fix still.
Patches merged upstream:
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory (Moderate: dnsmasq security and bug fix update), and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.