mirror of
https://github.com/openvswitch/ovs
synced 2025-09-01 14:55:18 +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:
@@ -595,8 +595,8 @@ netdev_linux_notify_sock(void)
|
|||||||
{
|
{
|
||||||
static struct ovsthread_once once = OVSTHREAD_ONCE_INITIALIZER;
|
static struct ovsthread_once once = OVSTHREAD_ONCE_INITIALIZER;
|
||||||
static struct nl_sock *sock;
|
static struct nl_sock *sock;
|
||||||
unsigned int mcgroups[3] = {RTNLGRP_LINK, RTNLGRP_IPV4_IFADDR,
|
unsigned int mcgroups[] = {RTNLGRP_LINK, RTNLGRP_IPV4_IFADDR,
|
||||||
RTNLGRP_IPV6_IFADDR};
|
RTNLGRP_IPV6_IFADDR, RTNLGRP_IPV6_IFINFO};
|
||||||
|
|
||||||
if (ovsthread_once_start(&once)) {
|
if (ovsthread_once_start(&once)) {
|
||||||
int error;
|
int error;
|
||||||
@@ -652,7 +652,16 @@ netdev_linux_run(void)
|
|||||||
struct rtnetlink_change change;
|
struct rtnetlink_change change;
|
||||||
|
|
||||||
if (rtnetlink_parse(&buf, &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)) {
|
if (netdev_ && is_netdev_linux_class(netdev_->netdev_class)) {
|
||||||
struct netdev_linux *netdev = netdev_linux_cast(netdev_);
|
struct netdev_linux *netdev = netdev_linux_cast(netdev_);
|
||||||
|
|
||||||
|
@@ -100,7 +100,7 @@ rtnetlink_parse(struct ofpbuf *buf, struct rtnetlink_change *change)
|
|||||||
* There are *many* more fields in these messages, but currently we
|
* There are *many* more fields in these messages, but currently we
|
||||||
* only care about these fields. */
|
* only care about these fields. */
|
||||||
static const struct nl_policy policy[] = {
|
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)];
|
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->nlmsg_type = nlmsg->nlmsg_type;
|
||||||
change->if_index = ifaddr->ifa_index;
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user