Skip to content
This repository has been archived by the owner on Oct 26, 2022. It is now read-only.

rtnetlink: add replace option to Add*Request #202

Merged
merged 1 commit into from
Nov 28, 2021

Conversation

Tuetuopay
Copy link
Contributor

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.

Copy link
Owner

@little-dude little-dude left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is great 👍

Just like #203 I'm going to wait for a day before merging in case someone else wants to review this.

This option sets the NLM_F_REPLACE instead of the NLM_F_EXCL flag,
allowing "create or update" patterns.
@little-dude little-dude merged commit 5d4f116 into little-dude:master Nov 28, 2021
little-dude added a commit that referenced this pull request Nov 28, 2021
although #203 and
#202 had no direct
conflict, merging both broke rtnetlink:

```
 error[E0063]: missing field `replace` in initializer of `neighbour::add::NeighbourAddRequest`
  --> rtnetlink/src/neighbour/add.rs:58:9
   |
58 |         NeighbourAddRequest { handle, message }
   |         ^^^^^^^^^^^^^^^^^^^ missing `replace`
```
@little-dude little-dude mentioned this pull request Dec 29, 2021
mcginty pushed a commit to mcginty/netlink that referenced this pull request Jan 18, 2022
although little-dude#203 and
little-dude#202 had no direct
conflict, merging both broke rtnetlink:

```
 error[E0063]: missing field `replace` in initializer of `neighbour::add::NeighbourAddRequest`
  --> rtnetlink/src/neighbour/add.rs:58:9
   |
58 |         NeighbourAddRequest { handle, message }
   |         ^^^^^^^^^^^^^^^^^^^ missing `replace`
```
cathay4t pushed a commit to rust-netlink/rtnetlink that referenced this pull request Oct 7, 2022
although little-dude/netlink#203 and
little-dude/netlink#202 had no direct
conflict, merging both broke rtnetlink:

```
 error[E0063]: missing field `replace` in initializer of `neighbour::add::NeighbourAddRequest`
  --> rtnetlink/src/neighbour/add.rs:58:9
   |
58 |         NeighbourAddRequest { handle, message }
   |         ^^^^^^^^^^^^^^^^^^^ missing `replace`
```
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants