On Thu, 2016-01-21 at 21:04 +0100, Jiri Pirko wrote:
> Thu, Jan 21, 2016 at 12:47:54PM CET, pru...@brocade.com wrote:
> >Add RTM_NEWADDR and RTM_DELADDR netlink messages to indicate
> >interest in specific multicast hardware addresses. These messages
> >are sent when addressed are added or deleted from the appropriate
> >interface driver.
> >
> >Signed-off-by: Patrick Ruddy <pru...@brocade.com>
> >
> >diff --git a/net/core/dev_addr_lists.c b/net/core/dev_addr_lists.c
> >index c0548d2..a0ebadd 100644
> >--- a/net/core/dev_addr_lists.c
> >+++ b/net/core/dev_addr_lists.c
> >@@ -12,6 +12,7 @@
> >  */
> > 
> > #include <linux/netdevice.h>
> >+#include <net/netlink.h>
> > #include <linux/rtnetlink.h>
> > #include <linux/export.h>
> > #include <linux/list.h>
> >@@ -661,6 +662,62 @@ out:
> > }
> > EXPORT_SYMBOL(dev_mc_add_excl);
> > 
> >+static int fill_addr(struct sk_buff *skb, struct net_device *dev,
> >+                 const unsigned char *addr, int type)
> >+{
> >+    struct nlmsghdr *nlh;
> >+    struct ifaddrmsg *ifm;
> >+
> >+    nlh = nlmsg_put(skb, 0, 0, type, sizeof(*ifm), 0);
> >+    if (nlh == NULL)
> >+            return -EMSGSIZE;
> >+
> >+    ifm = nlmsg_data(nlh);
> >+    ifm->ifa_family = AF_UNSPEC;
> >+    ifm->ifa_prefixlen = 0;
> >+    ifm->ifa_flags = IFA_F_PERMANENT;
> >+    ifm->ifa_scope = RT_SCOPE_LINK;
> >+    ifm->ifa_index = dev->ifindex;
> >+    if (nla_put(skb, IFA_ADDRESS, dev->addr_len, addr))
> >+            goto nla_put_failure;
> >+    nlmsg_end(skb, nlh);
> 
> How can userspace tell if this is a multicast addr? Also, why not add
> notifications for unicast addrs so we handle both the same?

I am only using this RTM_NEW/DELADDR AF_UNSPEC message for multicast
addresses. I understand that the unicast addresses are notified in the
RTM_NEW/DELLINK.

-pr

Reply via email to