Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rtnl: improve event reception in order to avoid ENOBUFS #185

Merged
merged 3 commits into from
Jan 11, 2024

Commits on Jan 10, 2024

  1. rtnl: store callback in listener registry only on success

    Only store the callback reference in the registry once the listener
    context was successfully initialized, to avoid keeping a lingering
    entry when invalid parameters are passed.
    
    Signed-off-by: Jo-Philipp Wich <jo@mein.io>
    jow- committed Jan 10, 2024
    Configuration menu
    Copy the full SHA
    30a3f7a View commit details
    Browse the repository at this point in the history
  2. rtnl: optimize reception of rtnl events

    Once we're notified about pending data on the netlink event socket,
    try to receive as much messages as possible in order to empty the socket
    buffer. In contrast to the previous implementation which received one
    message per epoll read notification, this avoids some premature ENOBUFS
    situations when a huge burst of messages arrives, e.g. due to kernel
    side GC runs on the neighbor table.
    
    Since libnl's nl_recvmsgs*() functions do not expose the underlying
    -1 error returned by the recvmsg() calls, we need to indirectly check
    for errors through errno variable, so clear it out both before the
    recvmsgs() call and after successfully completing a message reception
    callback invocation.
    
    Signed-off-by: Jo-Philipp Wich <jo@mein.io>
    jow- committed Jan 10, 2024
    Configuration menu
    Copy the full SHA
    9cbe829 View commit details
    Browse the repository at this point in the history
  3. rtnl: increase event socket rx buffer size limit to 1 MiB

    Use the same RX buffer size which iproute2 uses as default, in order to
    avoid (or rather, delay as much as possible) ENOBUFS conditions when
    receiving a large burst of netlink notifications.
    
    Signed-off-by: Jo-Philipp Wich <jo@mein.io>
    jow- committed Jan 10, 2024
    Configuration menu
    Copy the full SHA
    5344171 View commit details
    Browse the repository at this point in the history