-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from nrybowski/bier_ospfv3
BIER extension for OSPFv3
- Loading branch information
Showing
79 changed files
with
1,269 additions
and
336 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// | ||
// Copyright (c) The Holo Core Contributors | ||
// | ||
// SPDX-License-Identifier: MIT | ||
// | ||
|
||
use holo_utils::bier::{BierInfo, Bsl, UnderlayProtocolType}; | ||
use holo_utils::ip::IpNetworkKind; | ||
|
||
use crate::instance::InstanceUpView; | ||
use crate::packet::tlv::BierSubSubTlv; | ||
use crate::route::RouteNet; | ||
use crate::spf::SpfIntraAreaNetwork; | ||
use crate::version::Version; | ||
|
||
pub(crate) fn bier_route_add<V>( | ||
instance: &InstanceUpView<'_, V>, | ||
new_route: &mut RouteNet<V>, | ||
stub: &SpfIntraAreaNetwork<'_, V>, | ||
) where | ||
V: Version, | ||
{ | ||
let bier_cfg = &instance.shared.bier_config; | ||
|
||
// 1. Does the BFR match a locally configured BIER sub-domain? | ||
stub.bier.iter().for_each(|tlv| { | ||
if instance.config.bier.mt_id == tlv.mt_id | ||
&& let Some(sd_cfg) = bier_cfg | ||
.sd_cfg | ||
.get(&(tlv.sub_domain_id, stub.prefix.address_family())) | ||
&& sd_cfg.underlay_protocol == UnderlayProtocolType::Ospf | ||
{ | ||
// 2. Register entry in BIRT for each supported bitstring length by the BFR prefix | ||
// TODO: Use BAR and IPA | ||
|
||
// TODO: Sanity check on bitstring lengths upon LSA reception | ||
|
||
let bfr_bss: Vec<Bsl> = tlv | ||
.subtlvs | ||
.iter() | ||
.filter_map(|stlv| match stlv { | ||
BierSubSubTlv::BierEncapSubSubTlv(encap) => { | ||
Bsl::try_from(encap.bs_len).ok() | ||
} | ||
}) | ||
.collect(); | ||
|
||
if !bfr_bss.is_empty() { | ||
new_route.bier_info = Some(BierInfo { | ||
bfr_bss, | ||
sd_id: tlv.sub_domain_id, | ||
bfr_id: tlv.bfr_id, | ||
}) | ||
} | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.