2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-30 22:05:19 +00:00

netdev-linux: Fix netdev ipv6 notification

Listen to RTNLGRP_IPV6_IFINFO to get IPv6 address change
notification.

Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
Pravin B Shelar
2016-03-09 16:40:41 -08:00
parent b4f6e93052
commit 989d713599
2 changed files with 16 additions and 5 deletions

View File

@@ -595,8 +595,8 @@ netdev_linux_notify_sock(void)
{
static struct ovsthread_once once = OVSTHREAD_ONCE_INITIALIZER;
static struct nl_sock *sock;
unsigned int mcgroups[3] = {RTNLGRP_LINK, RTNLGRP_IPV4_IFADDR,
RTNLGRP_IPV6_IFADDR};
unsigned int mcgroups[] = {RTNLGRP_LINK, RTNLGRP_IPV4_IFADDR,
RTNLGRP_IPV6_IFADDR, RTNLGRP_IPV6_IFINFO};
if (ovsthread_once_start(&once)) {
int error;
@@ -652,7 +652,16 @@ netdev_linux_run(void)
struct rtnetlink_change change;
if (rtnetlink_parse(&buf, &change)) {
struct netdev *netdev_ = netdev_from_name(change.ifname);
struct netdev *netdev_ = NULL;
char dev_name[IFNAMSIZ];
if (!change.ifname) {
change.ifname = if_indextoname(change.if_index, dev_name);
}
if (change.ifname) {
netdev_ = netdev_from_name(change.ifname);
}
if (netdev_ && is_netdev_linux_class(netdev_->netdev_class)) {
struct netdev_linux *netdev = netdev_linux_cast(netdev_);

View File

@@ -100,7 +100,7 @@ rtnetlink_parse(struct ofpbuf *buf, struct rtnetlink_change *change)
* There are *many* more fields in these messages, but currently we
* only care about these fields. */
static const struct nl_policy policy[] = {
[IFA_LABEL] = { .type = NL_A_STRING, .optional = false },
[IFA_LABEL] = { .type = NL_A_STRING, .optional = true },
};
struct nlattr *attrs[ARRAY_SIZE(policy)];
@@ -115,7 +115,9 @@ rtnetlink_parse(struct ofpbuf *buf, struct rtnetlink_change *change)
change->nlmsg_type = nlmsg->nlmsg_type;
change->if_index = ifaddr->ifa_index;
change->ifname = nl_attr_get_string(attrs[IFA_LABEL]);
change->ifname = (attrs[IFA_LABEL]
? nl_attr_get_string(attrs[IFA_LABEL])
: NULL);
}
}