When devices are created, they are announced using RTM_IFANNOUNCE messages using PF_ROUTE.
Signed-off-by: Thadeu Lima de Souza Cascardo <casca...@redhat.com> --- lib/rtbsd.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/lib/rtbsd.c b/lib/rtbsd.c index 8fc88e4..33fb9fd 100644 --- a/lib/rtbsd.c +++ b/lib/rtbsd.c @@ -124,8 +124,15 @@ rtbsd_notifier_run(void) if (retval >= 0) { /* received packet from PF_ROUTE socket * XXX check for bad packets */ - if (msg.ifm_type == RTM_IFINFO) { + switch (msg.ifm_type) { + case RTM_IFINFO: + /* Since RTM_IFANNOUNCE messages are smaller than RTM_IFINFO + * messages, the same buffer may be used. */ + case RTM_IFANNOUNCE: rtbsd_report_change(&msg); + break; + default: + break; } } else if (errno == EAGAIN) { ovs_mutex_unlock(&rtbsd_mutex); @@ -161,14 +168,25 @@ rtbsd_report_change(const struct if_msghdr *msg) { struct rtbsd_notifier *notifier; struct rtbsd_change change; + const struct if_announcemsghdr *ahdr; COVERAGE_INC(rtbsd_changed); change.msg_type = msg->ifm_type; //XXX - change.if_index = msg->ifm_index; - if_indextoname(msg->ifm_index, change.if_name); change.master_ifindex = 0; //XXX + switch (msg->ifm_type) { + case RTM_IFINFO: + change.if_index = msg->ifm_index; + if_indextoname(msg->ifm_index, change.if_name); + break; + case RTM_IFANNOUNCE: + ahdr = (const struct if_announcemsghdr *) msg; + change.if_index = ahdr->ifan_index; + strncpy(change.if_name, ahdr->ifan_name, IF_NAMESIZE); + break; + } + LIST_FOR_EACH (notifier, node, &all_notifiers) { notifier->cb(&change, notifier->aux); } -- 2.4.2 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev