Skip to content

Commit ae81de7

Browse files
scopeInfinitydavem330
authored andcommitted
mctp: Remove only static neighbour on RTM_DELNEIGH
Add neighbour source flag in mctp_neigh_remove(...) to allow removal of only static neighbours. This should be a no-op change and might be useful later when mctp can have MCTP_NEIGH_DISCOVER neighbours. Signed-off-by: Gagan Kumar <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent d6d8683 commit ae81de7

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

net/mctp/neigh.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,17 @@ void mctp_neigh_remove_dev(struct mctp_dev *mdev)
8585
mutex_unlock(&net->mctp.neigh_lock);
8686
}
8787

88-
// TODO: add a "source" flag so netlink can only delete static neighbours?
89-
static int mctp_neigh_remove(struct mctp_dev *mdev, mctp_eid_t eid)
88+
static int mctp_neigh_remove(struct mctp_dev *mdev, mctp_eid_t eid,
89+
enum mctp_neigh_source source)
9090
{
9191
struct net *net = dev_net(mdev->dev);
9292
struct mctp_neigh *neigh, *tmp;
9393
bool dropped = false;
9494

9595
mutex_lock(&net->mctp.neigh_lock);
9696
list_for_each_entry_safe(neigh, tmp, &net->mctp.neighbours, list) {
97-
if (neigh->dev == mdev && neigh->eid == eid) {
97+
if (neigh->dev == mdev && neigh->eid == eid &&
98+
neigh->source == source) {
9899
list_del_rcu(&neigh->list);
99100
/* TODO: immediate RTM_DELNEIGH */
100101
call_rcu(&neigh->rcu, __mctp_neigh_free);
@@ -202,7 +203,7 @@ static int mctp_rtm_delneigh(struct sk_buff *skb, struct nlmsghdr *nlh,
202203
if (!mdev)
203204
return -ENODEV;
204205

205-
return mctp_neigh_remove(mdev, eid);
206+
return mctp_neigh_remove(mdev, eid, MCTP_NEIGH_STATIC);
206207
}
207208

208209
static int mctp_fill_neigh(struct sk_buff *skb, u32 portid, u32 seq, int event,

0 commit comments

Comments
 (0)