little-dude / netlink

netlink libraries for rust
Other
329 stars 89 forks source link

rtnetlink: add replace option to Add*Request #202

Closed Tuetuopay closed 2 years ago

Tuetuopay commented 3 years ago

This option sets the NLM_F_REPLACE instead of the NLM_F_EXCL flag, allowing "create or update" patterns.

My current usecase is for managing neighbors, for which I have a control plane, but it can happen that the neighbor is learnt from the dataplane first, and controlplane second. In this case, I want to set the neighbor as NOARP to prevent it from expiring. The easiest is to allow the kernel to just replace the neighbor with the one provided rather than create-fail-delete-create.