Commit ae81de73 authored by Gagan Kumar's avatar Gagan Kumar Committed by David S. Miller

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: default avatarGagan Kumar <gagan1kumar.cs@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d6d86830
...@@ -85,8 +85,8 @@ void mctp_neigh_remove_dev(struct mctp_dev *mdev) ...@@ -85,8 +85,8 @@ void mctp_neigh_remove_dev(struct mctp_dev *mdev)
mutex_unlock(&net->mctp.neigh_lock); 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 net *net = dev_net(mdev->dev);
struct mctp_neigh *neigh, *tmp; struct mctp_neigh *neigh, *tmp;
...@@ -94,7 +94,8 @@ static int mctp_neigh_remove(struct mctp_dev *mdev, mctp_eid_t eid) ...@@ -94,7 +94,8 @@ static int mctp_neigh_remove(struct mctp_dev *mdev, mctp_eid_t eid)
mutex_lock(&net->mctp.neigh_lock); mutex_lock(&net->mctp.neigh_lock);
list_for_each_entry_safe(neigh, tmp, &net->mctp.neighbours, list) { 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); list_del_rcu(&neigh->list);
/* TODO: immediate RTM_DELNEIGH */ /* TODO: immediate RTM_DELNEIGH */
call_rcu(&neigh->rcu, __mctp_neigh_free); call_rcu(&neigh->rcu, __mctp_neigh_free);
...@@ -202,7 +203,7 @@ static int mctp_rtm_delneigh(struct sk_buff *skb, struct nlmsghdr *nlh, ...@@ -202,7 +203,7 @@ static int mctp_rtm_delneigh(struct sk_buff *skb, struct nlmsghdr *nlh,
if (!mdev) if (!mdev)
return -ENODEV; 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, static int mctp_fill_neigh(struct sk_buff *skb, u32 portid, u32 seq, int event,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment