frr icon indicating copy to clipboard operation
frr copied to clipboard

Fix/zebra netns del

Open leonshaw opened this issue 1 year ago • 2 comments

Fix two issues during netns deletion:

  1. Free global netlink message buffer only when zebra is shutting down (not when netns is deleted).
  2. Clean up queued dataplane update contexts which have references to the netns.

leonshaw avatar Sep 09 '24 02:09 leonshaw

Can you say a bit about what the "issues" are: is there ... memory that's not freed? or ... something that's freed too soon, while it might still be used during shutdown?

mjstapp avatar Sep 10 '24 17:09 mjstapp

@mjstapp If netns VRF backend is enabled, kernel_terminate() is called when a netns (VRF) is deleted: https://github.com/FRRouting/frr/blob/741d1d009042222c59b71db27ead08387cbe8cb0/zebra/zebra_ns.c#L144-L160 So don't free the global nl_batch_tx_buf here, and move that into kernel_router_terminate() instead.

For the second issue, if don't remove queued dataplane contexts, which has reference to netlink socket of the netns being deleted, there's a race between main (removal of netlink sock) and dataplane (handling of pending contexts) thread.

leonshaw avatar Sep 11 '24 02:09 leonshaw

This PR is stale because it has been open 180 days with no activity. Comment or remove the autoclose label in order to avoid having this PR closed.

github-actions[bot] avatar Apr 10 '25 02:04 github-actions[bot]

This pull request has conflicts, please resolve those before we can evaluate the pull request.

github-actions[bot] avatar Apr 29 '25 09:04 github-actions[bot]

Remove the first commit. An identical change is merged in #18309.

leonshaw avatar May 06 '25 02:05 leonshaw