summaryrefslogtreecommitdiffstats
path: root/zebra/zebra_l2.c
diff options
context:
space:
mode:
authorDinesh Dutt <didutt@gmail.com>2018-11-10 21:54:43 +0100
committerDonald Sharp <sharpd@cumulusnetworks.com>2018-11-12 17:40:33 +0100
commitb9368db98c961678f030e1a27202e89b5e1ef6bf (patch)
tree9c8d4203207e8f9648b9a28b656394d0b4b0d4c1 /zebra/zebra_l2.c
parentMerge pull request #3289 from donaldsharp/onlink_schmonlink (diff)
downloadfrr-b9368db98c961678f030e1a27202e89b5e1ef6bf.tar.xz
frr-b9368db98c961678f030e1a27202e89b5e1ef6bf.zip
zebra: Let zebra know about bond and blond slave intf types
The interface type can be a bond or a bond slave, add some code to note this and to display it as part of a show interface command. Signed-off-by: Dinesh Dutt <didutt@gmail.com> Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'zebra/zebra_l2.c')
-rw-r--r--zebra/zebra_l2.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/zebra/zebra_l2.c b/zebra/zebra_l2.c
index 529fc48ed..f4b2fe479 100644
--- a/zebra/zebra_l2.c
+++ b/zebra/zebra_l2.c
@@ -99,6 +99,23 @@ void zebra_l2_unmap_slave_from_bridge(struct zebra_l2info_brslave *br_slave)
br_slave->br_if = NULL;
}
+void zebra_l2_map_slave_to_bond(struct zebra_l2info_bondslave *bond_slave)
+{
+ struct interface *bond_if;
+
+ /* TODO: Handle change of master */
+ bond_if = if_lookup_by_index_per_ns(zebra_ns_lookup(NS_DEFAULT),
+ bond_slave->bond_ifindex);
+ if (bond_if)
+ bond_slave->bond_if = bond_if;
+}
+
+void zebra_l2_unmap_slave_from_bond(struct zebra_l2info_bondslave *bond_slave)
+{
+ if (bond_slave != NULL)
+ bond_slave->bond_if = NULL;
+}
+
/*
* Handle Bridge interface add or update. Update relevant info,
* map slaves (if any) to the bridge.
@@ -238,3 +255,24 @@ void zebra_l2if_update_bridge_slave(struct interface *ifp,
zebra_l2_unmap_slave_from_bridge(&zif->brslave_info);
}
}
+
+void zebra_l2if_update_bond_slave(struct interface *ifp, ifindex_t bond_ifindex)
+{
+ struct zebra_if *zif;
+ ifindex_t old_bond_ifindex;
+
+ zif = ifp->info;
+ assert(zif);
+
+ old_bond_ifindex = zif->bondslave_info.bond_ifindex;
+ if (old_bond_ifindex == bond_ifindex)
+ return;
+
+ zif->bondslave_info.bond_ifindex = bond_ifindex;
+
+ /* Set up or remove link with master */
+ if (bond_ifindex != IFINDEX_INTERNAL)
+ zebra_l2_map_slave_to_bond(&zif->bondslave_info);
+ else if (old_bond_ifindex != IFINDEX_INTERNAL)
+ zebra_l2_unmap_slave_from_bond(&zif->bondslave_info);
+}