Skip to content

Commit

Permalink
rtnetlink: fix fdb notification flags
Browse files Browse the repository at this point in the history
Commit 3ff661c ("net: rtnetlink notify events for FDB NTF_SELF adds and
deletes") reuses the function nlmsg_populate_fdb_fill() to notify fdb events.
But this function was used only for dump and thus was always setting the
flag NLM_F_MULTI, which is wrong in case of a single notification.

Libraries like libnl will wait forever for NLMSG_DONE.

CC: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Nicolas Dichtel authored and David S. Miller committed Mar 20, 2014
1 parent 6326231 commit 1c104a6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions net/core/rtnetlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -2121,12 +2121,13 @@ EXPORT_SYMBOL(rtmsg_ifinfo);
static int nlmsg_populate_fdb_fill(struct sk_buff *skb,
struct net_device *dev,
u8 *addr, u32 pid, u32 seq,
int type, unsigned int flags)
int type, unsigned int flags,
int nlflags)
{
struct nlmsghdr *nlh;
struct ndmsg *ndm;

nlh = nlmsg_put(skb, pid, seq, type, sizeof(*ndm), NLM_F_MULTI);
nlh = nlmsg_put(skb, pid, seq, type, sizeof(*ndm), nlflags);
if (!nlh)
return -EMSGSIZE;

Expand Down Expand Up @@ -2164,7 +2165,7 @@ static void rtnl_fdb_notify(struct net_device *dev, u8 *addr, int type)
if (!skb)
goto errout;

err = nlmsg_populate_fdb_fill(skb, dev, addr, 0, 0, type, NTF_SELF);
err = nlmsg_populate_fdb_fill(skb, dev, addr, 0, 0, type, NTF_SELF, 0);
if (err < 0) {
kfree_skb(skb);
goto errout;
Expand Down Expand Up @@ -2389,7 +2390,8 @@ static int nlmsg_populate_fdb(struct sk_buff *skb,

err = nlmsg_populate_fdb_fill(skb, dev, ha->addr,
portid, seq,
RTM_NEWNEIGH, NTF_SELF);
RTM_NEWNEIGH, NTF_SELF,
NLM_F_MULTI);
if (err < 0)
return err;
skip:
Expand Down

0 comments on commit 1c104a6

Please sign in to comment.