break;
case IFLA_LINK:
/* Index of "lower" interface */
- iff->lower_idx = *(int*)RTA_DATA(attribute);
- log_debug("netlink", "attribute IFLA_LINK for %s: %d",
- iff->name ? iff->name : "(unknown)", iff->lower_idx);
+ if (iff->lower_idx == -1) {
+ iff->lower_idx = *(int*)RTA_DATA(attribute);
+ log_debug("netlink", "attribute IFLA_LINK for %s: %d",
+ iff->name ? iff->name : "(unknown)", iff->lower_idx);
+ } else {
+ log_debug("netlink", "attribute IFLA_LINK for %s: %d (ignored)",
+ iff->name ? iff->name : "(unknown)", iff->lower_idx);
+ }
break;
case IFLA_LINK_NETNSID:
/* Is the lower interface into another namesapce? */
- iff->lower_idx = -1;
+ iff->lower_idx = -2;
log_debug("netlink", "attribute IFLA_LINK_NETNSID received for %s",
iff->name ? iff->name : "(unknown)");
break;
* and we don't want to miss it. */
iff->flags &= ~IFF_SLAVE;
}
+ if (iff->lower_idx == -2)
+ iff->lower_idx = -1;
if (ifi->ifi_family == AF_BRIDGE && msg->nlmsg_type == RTM_DELLINK && iff->upper_idx != -1) {
log_debug("netlink", "removal of %s from bridge %d",
if (iface2->lower_idx == iface1->index) {
iface1->lower = NULL;
log_debug("netlink",
- "link loop detected between %s and %s",
- iface1->name, iface2->name);
+ "link loop detected between %s(%d) and %s(%d)",
+ iface1->name,
+ iface1->index,
+ iface2->name,
+ iface2->index);
} else {
log_debug("netlink",
"lower interface for %s is %s",