lkml.org 
[lkml]   [2021]   [Dec]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] mctp: Remove only static neighbour on RTM_DELNEIGH
On Tue, 28 Dec 2021 18:39:56 +0530 Gagan Kumar wrote:
> Add neighbour source flag in mctp_neigh_remove(...) to allow removal of
> only static neighbours.

Which are the only ones that exist today right?

Can you clarify the motivation and practical impact of the change
in the commit message to make it clear? AFAICT this is a no-op / prep
for some later changes, right Jeremy?

> diff --git a/net/mctp/neigh.c b/net/mctp/neigh.c
> index 5cc042121493..a90723ae66d7 100644
> --- a/net/mctp/neigh.c
> +++ b/net/mctp/neigh.c
> @@ -85,8 +85,8 @@ void mctp_neigh_remove_dev(struct mctp_dev *mdev)
> mutex_unlock(&net->mctp.neigh_lock);
> }
>
> -// TODO: add a "source" flag so netlink can only delete static neighbours?
> -static int mctp_neigh_remove(struct mctp_dev *mdev, mctp_eid_t eid)
> +static int mctp_neigh_remove(struct mctp_dev *mdev, mctp_eid_t eid,
> + enum mctp_neigh_source source)
> {
> struct net *net = dev_net(mdev->dev);
> struct mctp_neigh *neigh, *tmp;
> @@ -94,7 +94,7 @@ static int mctp_neigh_remove(struct mctp_dev *mdev, mctp_eid_t eid)
>
> mutex_lock(&net->mctp.neigh_lock);
> list_for_each_entry_safe(neigh, tmp, &net->mctp.neighbours, list) {
> - if (neigh->dev == mdev && neigh->eid == eid) {
> + if (neigh->dev == mdev && neigh->eid == eid && neigh->source == source) {
> list_del_rcu(&neigh->list);
> /* TODO: immediate RTM_DELNEIGH */
> call_rcu(&neigh->rcu, __mctp_neigh_free);
> @@ -202,7 +202,7 @@ static int mctp_rtm_delneigh(struct sk_buff *skb, struct nlmsghdr *nlh,
> if (!mdev)
> return -ENODEV;
>
> - return mctp_neigh_remove(mdev, eid);
> + return mctp_neigh_remove(mdev, eid, MCTP_NEIGH_STATIC);
> }
>
> static int mctp_fill_neigh(struct sk_buff *skb, u32 portid, u32 seq, int event,

\
 
 \ /
  Last update: 2021-12-31 02:51    [W:0.091 / U:0.248 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site