netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Ruddy <pruddy@Brocade.com>
To: "jiri@resnulli.us" <jiri@resnulli.us>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	David Stapleton <dstaplet@Brocade.com>,
	Olufemi Komolafe <okomolaf@Brocade.com>,
	"Stephen Hemminger" <shemming@Brocade.com>
Subject: Re: [PATCH] Netlink messages for multicast HW addr programming
Date: Fri, 22 Jan 2016 14:51:55 +0000	[thread overview]
Message-ID: <1453474315.20378.7.camel@brocade.com> (raw)
In-Reply-To: <20160121200419.GB2251@nanopsycho.orion>

On Thu, 2016-01-21 at 21:04 +0100, Jiri Pirko wrote:
> Thu, Jan 21, 2016 at 12:47:54PM CET, pruddy@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 <pruddy@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	other threads:[~2016-01-22 14:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-21 11:47 [PATCH] Netlink messages for multicast HW addr programming Patrick Ruddy
2016-01-21 20:04 ` Jiri Pirko
2016-01-22 14:51   ` Patrick Ruddy [this message]
2016-01-22 15:05     ` Jiri Pirko
2016-01-22 15:49       ` Patrick Ruddy
2016-01-23  7:53         ` Jiri Pirko
2016-02-03 14:14           ` Patrick Ruddy
2016-02-03 14:22             ` Jiri Pirko
2016-02-03 23:41             ` Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1453474315.20378.7.camel@brocade.com \
    --to=pruddy@brocade.com \
    --cc=dstaplet@Brocade.com \
    --cc=jiri@resnulli.us \
    --cc=netdev@vger.kernel.org \
    --cc=okomolaf@Brocade.com \
    --cc=shemming@Brocade.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).