diff options
author | Igor Ryzhov <iryzhov@nfware.com> | 2021-10-22 00:17:40 +0200 |
---|---|---|
committer | Igor Ryzhov <iryzhov@nfware.com> | 2021-11-22 18:47:23 +0100 |
commit | 096f7609f9168ad1a2503acad31d3afc8f00f9e5 (patch) | |
tree | 7acf9cbf0f944b032da6a796fcf8d7f6a06fe90a /lib/if.c | |
parent | Merge pull request #10057 from ton31337/fix/we_shouldn_send_LLA_for_RS (diff) | |
download | frr-096f7609f9168ad1a2503acad31d3afc8f00f9e5.tar.xz frr-096f7609f9168ad1a2503acad31d3afc8f00f9e5.zip |
*: cleanup ifp->vrf_id
Since f60a1188 we store a pointer to the VRF in the interface structure.
There's no need anymore to store a separate vrf_id field.
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'lib/if.c')
-rw-r--r-- | lib/if.c | 16 |
1 files changed, 7 insertions, 9 deletions
@@ -167,7 +167,6 @@ static struct interface *if_new(struct vrf *vrf) ifp->name[0] = '\0'; ifp->vrf = vrf; - ifp->vrf_id = vrf->vrf_id; ifp->connected = list_new(); ifp->connected->del = ifp_connected_free; @@ -238,8 +237,7 @@ void if_update_to_new_vrf(struct interface *ifp, vrf_id_t vrf_id) if (ifp->ifindex != IFINDEX_INTERNAL) IFINDEX_RB_REMOVE(old_vrf, ifp); - ifp->vrf_id = vrf_id; - vrf = vrf_get(ifp->vrf_id, NULL); + vrf = vrf_get(vrf_id, NULL); ifp->vrf = vrf; if (ifp->name[0] != '\0') @@ -604,7 +602,7 @@ struct interface *if_get_by_name(const char *name, vrf_id_t vrf_id, /* If it came from the kernel or by way of zclient, * believe it and update the ifp accordingly. */ - if (ifp->vrf_id != vrf_id && vrf_id != VRF_UNKNOWN) + if (ifp->vrf->vrf_id != vrf_id && vrf_id != VRF_UNKNOWN) if_update_to_new_vrf(ifp, vrf_id); return ifp; @@ -617,7 +615,7 @@ struct interface *if_get_by_name(const char *name, vrf_id_t vrf_id, /* If it came from the kernel or by way of zclient, * believe it and update the ifp accordingly. */ - if (ifp->vrf_id != vrf_id && vrf_id != VRF_UNKNOWN) + if (ifp->vrf->vrf_id != vrf_id && vrf_id != VRF_UNKNOWN) if_update_to_new_vrf(ifp, vrf_id); return ifp; @@ -643,7 +641,7 @@ int if_set_index(struct interface *ifp, ifindex_t ifindex) * If there is already an interface with this ifindex, we will collide * on insertion, so don't even try. */ - if (if_lookup_by_ifindex(ifindex, ifp->vrf_id)) + if (if_lookup_by_ifindex(ifindex, ifp->vrf->vrf_id)) return -1; if (ifp->ifindex != IFINDEX_INTERNAL) @@ -807,8 +805,8 @@ static void if_dump(const struct interface *ifp) for (ALL_LIST_ELEMENTS_RO(ifp->connected, node, c)) zlog_info( "Interface %s vrf %s(%u) index %d metric %d mtu %d mtu6 %d %s", - ifp->name, ifp->vrf->name, ifp->vrf_id, ifp->ifindex, - ifp->metric, ifp->mtu, ifp->mtu6, + ifp->name, ifp->vrf->name, ifp->vrf->vrf_id, + ifp->ifindex, ifp->metric, ifp->mtu, ifp->mtu6, if_flag_dump(ifp->flags)); } @@ -885,7 +883,7 @@ connected_log(struct connected *connected, char *str) p = connected->address; snprintf(logbuf, sizeof(logbuf), "%s interface %s vrf %s(%u) %s %pFX ", - str, ifp->name, ifp->vrf->name, ifp->vrf_id, + str, ifp->name, ifp->vrf->name, ifp->vrf->vrf_id, prefix_family_str(p), p); p = connected->destination; |