summaryrefslogtreecommitdiff
path: root/zebra/if_netlink.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/if_netlink.c')
-rw-r--r--zebra/if_netlink.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c
index ba518ea576..ce0834f190 100644
--- a/zebra/if_netlink.c
+++ b/zebra/if_netlink.c
@@ -690,9 +690,6 @@ static int netlink_interface(struct nlmsghdr *h, ns_id_t ns_id, int startup)
ifp->speed = get_iflink_speed(ifp);
ifp->ptm_status = ZEBRA_PTM_STATUS_UNKNOWN;
- if (desc)
- ifp->desc = XSTRDUP(MTYPE_TMP, desc);
-
/* Set zebra interface type */
zebra_if_set_ziftype(ifp, zif_type, zif_slave_type);
if (IS_ZEBRA_IF_VRF(ifp))
@@ -707,6 +704,11 @@ static int netlink_interface(struct nlmsghdr *h, ns_id_t ns_id, int startup)
zif = (struct zebra_if *)ifp->info;
zif->link_ifindex = link_ifindex;
+ if (desc) {
+ XFREE(MTYPE_TMP, zif->desc);
+ zif->desc = XSTRDUP(MTYPE_TMP, desc);
+ }
+
/* Hardware type and address. */
ifp->ll_type = netlink_to_zebra_link_type(ifi->ifi_type);
netlink_interface_update_hw_addr(tb, ifp);
@@ -1106,7 +1108,7 @@ int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup)
ifindex_t bond_ifindex = IFINDEX_INTERNAL;
ifindex_t link_ifindex = IFINDEX_INTERNAL;
uint8_t old_hw_addr[INTERFACE_HWADDR_MAX];
-
+ struct zebra_if *zif;
zns = zebra_ns_lookup(ns_id);
ifi = NLMSG_DATA(h);
@@ -1186,12 +1188,6 @@ int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup)
/* See if interface is present. */
ifp = if_lookup_by_name_per_ns(zns, name);
- if (ifp) {
- XFREE(MTYPE_TMP, ifp->desc);
- if (desc)
- ifp->desc = XSTRDUP(MTYPE_TMP, desc);
- }
-
if (h->nlmsg_type == RTM_NEWLINK) {
if (tb[IFLA_MASTER]) {
if (slave_kind && (strcmp(slave_kind, "vrf") == 0)
@@ -1390,6 +1386,13 @@ int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup)
if_delete_update(ifp);
}
+ zif = ifp->info;
+ if (zif) {
+ XFREE(MTYPE_TMP, zif->desc);
+ if (desc)
+ zif->desc = XSTRDUP(MTYPE_TMP, desc);
+ }
+
return 0;
}