mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-12 07:37:01 +00:00
Merge pull request #6426 from pguibert6WIND/update_ifname_before_hook
Update ifname before hook
This commit is contained in:
commit
3dab0aea06
13
lib/if.c
13
lib/if.c
@ -217,14 +217,16 @@ struct interface *if_create_name(const char *name, vrf_id_t vrf_id)
|
|||||||
return ifp;
|
return ifp;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct interface *if_create_ifindex(ifindex_t ifindex, vrf_id_t vrf_id)
|
struct interface *if_create_ifindex(ifindex_t ifindex, vrf_id_t vrf_id,
|
||||||
|
char *optional_name)
|
||||||
{
|
{
|
||||||
struct interface *ifp;
|
struct interface *ifp;
|
||||||
|
|
||||||
ifp = if_new(vrf_id);
|
ifp = if_new(vrf_id);
|
||||||
|
|
||||||
if_set_index(ifp, ifindex);
|
if_set_index(ifp, ifindex);
|
||||||
|
if (optional_name)
|
||||||
|
if_set_name(ifp, optional_name);
|
||||||
hook_call(if_add, ifp);
|
hook_call(if_add, ifp);
|
||||||
return ifp;
|
return ifp;
|
||||||
}
|
}
|
||||||
@ -554,7 +556,8 @@ struct interface *if_get_by_name(const char *name, vrf_id_t vrf_id)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct interface *if_get_by_ifindex(ifindex_t ifindex, vrf_id_t vrf_id)
|
struct interface *if_get_by_ifindex(ifindex_t ifindex, vrf_id_t vrf_id,
|
||||||
|
char *optional_name)
|
||||||
{
|
{
|
||||||
struct interface *ifp;
|
struct interface *ifp;
|
||||||
|
|
||||||
@ -564,7 +567,7 @@ struct interface *if_get_by_ifindex(ifindex_t ifindex, vrf_id_t vrf_id)
|
|||||||
ifp = if_lookup_by_ifindex(ifindex, vrf_id);
|
ifp = if_lookup_by_ifindex(ifindex, vrf_id);
|
||||||
if (ifp)
|
if (ifp)
|
||||||
return ifp;
|
return ifp;
|
||||||
return if_create_ifindex(ifindex, vrf_id);
|
return if_create_ifindex(ifindex, vrf_id, optional_name);
|
||||||
case VRF_BACKEND_VRF_LITE:
|
case VRF_BACKEND_VRF_LITE:
|
||||||
ifp = if_lookup_by_index_all_vrf(ifindex);
|
ifp = if_lookup_by_index_all_vrf(ifindex);
|
||||||
if (ifp) {
|
if (ifp) {
|
||||||
@ -576,7 +579,7 @@ struct interface *if_get_by_ifindex(ifindex_t ifindex, vrf_id_t vrf_id)
|
|||||||
if_update_to_new_vrf(ifp, vrf_id);
|
if_update_to_new_vrf(ifp, vrf_id);
|
||||||
return ifp;
|
return ifp;
|
||||||
}
|
}
|
||||||
return if_create_ifindex(ifindex, vrf_id);
|
return if_create_ifindex(ifindex, vrf_id, optional_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
7
lib/if.h
7
lib/if.h
@ -509,7 +509,8 @@ extern void if_update_to_new_vrf(struct interface *, vrf_id_t vrf_id);
|
|||||||
extern struct interface *if_create_name(const char *name, vrf_id_t vrf_id);
|
extern struct interface *if_create_name(const char *name, vrf_id_t vrf_id);
|
||||||
|
|
||||||
/* Create new interface, adds to index list only */
|
/* Create new interface, adds to index list only */
|
||||||
extern struct interface *if_create_ifindex(ifindex_t ifindex, vrf_id_t vrf_id);
|
extern struct interface *if_create_ifindex(ifindex_t ifindex, vrf_id_t vrf_id,
|
||||||
|
char *name);
|
||||||
extern struct interface *if_lookup_by_index(ifindex_t, vrf_id_t vrf_id);
|
extern struct interface *if_lookup_by_index(ifindex_t, vrf_id_t vrf_id);
|
||||||
extern struct interface *if_lookup_by_index_all_vrf(ifindex_t);
|
extern struct interface *if_lookup_by_index_all_vrf(ifindex_t);
|
||||||
extern struct interface *if_lookup_exact_address(const void *matchaddr,
|
extern struct interface *if_lookup_exact_address(const void *matchaddr,
|
||||||
@ -524,8 +525,8 @@ size_t if_lookup_by_hwaddr(const uint8_t *hw_addr, size_t addrsz,
|
|||||||
extern struct interface *if_lookup_by_name_all_vrf(const char *ifname);
|
extern struct interface *if_lookup_by_name_all_vrf(const char *ifname);
|
||||||
extern struct interface *if_lookup_by_name(const char *ifname, vrf_id_t vrf_id);
|
extern struct interface *if_lookup_by_name(const char *ifname, vrf_id_t vrf_id);
|
||||||
extern struct interface *if_get_by_name(const char *ifname, vrf_id_t vrf_id);
|
extern struct interface *if_get_by_name(const char *ifname, vrf_id_t vrf_id);
|
||||||
extern struct interface *if_get_by_ifindex(ifindex_t ifindex, vrf_id_t vrf_id);
|
extern struct interface *if_get_by_ifindex(ifindex_t ifindex, vrf_id_t vrf_id,
|
||||||
|
char *optional_name);
|
||||||
/* Sets the index and adds to index list */
|
/* Sets the index and adds to index list */
|
||||||
extern int if_set_index(struct interface *ifp, ifindex_t ifindex);
|
extern int if_set_index(struct interface *ifp, ifindex_t ifindex);
|
||||||
/* Sets the name and adds to name list */
|
/* Sets the name and adds to name list */
|
||||||
|
@ -733,11 +733,9 @@ static int netlink_interface(struct nlmsghdr *h, ns_id_t ns_id, int startup)
|
|||||||
* back references on the slave interfaces is painful if not done
|
* back references on the slave interfaces is painful if not done
|
||||||
* this way, i.e. by creating by ifindex.
|
* this way, i.e. by creating by ifindex.
|
||||||
*/
|
*/
|
||||||
ifp = if_get_by_ifindex(ifi->ifi_index, vrf_id);
|
ifp = if_get_by_ifindex(ifi->ifi_index, vrf_id, name);
|
||||||
set_ifindex(ifp, ifi->ifi_index, zns); /* add it to ns struct */
|
set_ifindex(ifp, ifi->ifi_index, zns); /* add it to ns struct */
|
||||||
|
|
||||||
if_set_name(ifp, name);
|
|
||||||
|
|
||||||
ifp->flags = ifi->ifi_flags & 0x0000fffff;
|
ifp->flags = ifi->ifi_flags & 0x0000fffff;
|
||||||
ifp->mtu6 = ifp->mtu = *(uint32_t *)RTA_DATA(tb[IFLA_MTU]);
|
ifp->mtu6 = ifp->mtu = *(uint32_t *)RTA_DATA(tb[IFLA_MTU]);
|
||||||
ifp->metric = 0;
|
ifp->metric = 0;
|
||||||
|
@ -119,7 +119,7 @@ void zebra_l2_map_slave_to_bond(struct zebra_l2info_bondslave *bond_slave,
|
|||||||
bond_slave->bond_if = bond_if;
|
bond_slave->bond_if = bond_if;
|
||||||
else
|
else
|
||||||
bond_slave->bond_if = if_create_ifindex(bond_slave->bond_ifindex,
|
bond_slave->bond_if = if_create_ifindex(bond_slave->bond_ifindex,
|
||||||
vrf_id);
|
vrf_id, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void zebra_l2_unmap_slave_from_bond(struct zebra_l2info_bondslave *bond_slave)
|
void zebra_l2_unmap_slave_from_bond(struct zebra_l2info_bondslave *bond_slave)
|
||||||
|
Loading…
Reference in New Issue
Block a user