Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
133 commits
Select commit Hold shift + click to select a range
d1409d1
Basis for another attempt at AS Paths
DRiKE Mar 15, 2023
0a634f3
Add octseq as default feature flag
DRiKE Mar 15, 2023
c710db6
WIP
DRiKE Mar 15, 2023
513d505
more WIP
DRiKE Mar 15, 2023
3aaccd4
WIP in progress
DRiKE Mar 15, 2023
b4176bb
Implement composing of HopPath, and Index/IndexMut
DRiKE Mar 17, 2023
6506aab
Various fixes
DRiKE Mar 21, 2023
eea7942
Tidy up Displays
DRiKE Mar 21, 2023
e08954d
Implemented missing helpers to prepend/append segments
DRiKE Mar 21, 2023
b0c7218
Fix new segment methods, tests
DRiKE Mar 21, 2023
c75f6e8
Add fn origin() to AsPath and HopPath
DRiKE Mar 21, 2023
1e78973
Add fn contains() to HopPath
DRiKE Mar 21, 2023
a1f2b71
From impls for HopPath
DRiKE Mar 21, 2023
1849887
Add fn path_len to HopPath
DRiKE Mar 21, 2023
2c0d820
Rename path_len to hop_count on HopPath
DRiKE Mar 21, 2023
72ead8c
Add TryFrom<Hop> for Asn
DRiKE Mar 21, 2023
1db3490
Add try_into_asn shorthand on Hop
DRiKE Mar 21, 2023
db0438d
Add iter on HopPath
DRiKE Mar 21, 2023
aa1e41b
some derives
density215 Mar 21, 2023
69f9ec6
Impl IntoIterator on HopPath
DRiKE Mar 21, 2023
23a894e
Clippy
DRiKE Mar 21, 2023
e7aae4f
impl display
density215 Mar 21, 2023
01b5fd5
two more copy derivers
density215 Mar 21, 2023
75793f7
the right order
density215 Mar 21, 2023
4c01eb5
some impl displays
density215 Mar 21, 2023
23ad865
from Vec<Hop> to HopPath impl
density215 Mar 21, 2023
848eedb
Move aspath module under bgp
DRiKE Mar 22, 2023
a967371
attr_change_set proposal
density215 Mar 22, 2023
be5bf5a
Merge branch 'aspath-with-hops' of github.com:NLnetLabs/routecore int…
DRiKE Mar 22, 2023
a101b34
Fix use for moved AsPath
DRiKE Mar 22, 2023
4b49b3f
Switch UpdateMessage over to new AsPath module
DRiKE Mar 22, 2023
7039f36
Fix PathHops iterator in case of empty Sequences
DRiKE Mar 22, 2023
e153480
Clippy for 1.65
DRiKE Mar 22, 2023
e7f7ee0
Add support to create AsPath from legacy two octet wireformat
DRiKE Mar 22, 2023
ad7c90d
Add missing bound
DRiKE Mar 22, 2023
dfab224
Sorry Clippy
DRiKE Mar 22, 2023
6933b6d
Use size_hint() when creating new AsPath Segments
DRiKE Mar 24, 2023
9292b88
Make AsPath and friends two-byte ASN aware.
partim Mar 30, 2023
24b55eb
Change UpdateMessage::aspath to always return the AS PATH attribute.
partim Mar 30, 2023
00c3077
Clippy-suggested fixes.
partim Mar 30, 2023
e9d09e7
Check the path contents in the two-byte ASN update test.
partim Mar 30, 2023
67d40c6
Don't warn on Unimplemented Path Attributes anymore
DRiKE Apr 3, 2023
e7d62b4
Docs, cleanup, rearranging
DRiKE Apr 11, 2023
3b64f02
Fixing/tidying up docstrings
DRiKE Apr 12, 2023
ba6c69e
Add comment on unimplemented to_two_octet_as_path
DRiKE Apr 12, 2023
a1833f3
More support for legacy paths
DRiKE Apr 12, 2023
4f530f6
Reordering/comments/consistency
DRiKE Apr 14, 2023
73fb98c
Remove old AsPath in favour of new module
DRiKE Apr 14, 2023
0a9f8ba
Impl Hash for AsPath instead of deriving it
DRiKE Apr 14, 2023
3e5d252
Merge branch 'main' into aspath-with-hops
DRiKE Apr 14, 2023
ce691e0
Add Four Octet capability to OpenBuilder
DRiKE Apr 19, 2023
b962f92
Revert "Don’t signal breaking changes just yet."
ximon18 Apr 19, 2023
42a15f8
Implement `Arbitrary` for ASNs and IP resources. (#24)
partim Apr 20, 2023
9f621f8
Update changelog.
partim Apr 20, 2023
7c447a7
Bump version.
partim Apr 25, 2023
c7f534d
Quickfix ipv4/multicast parsing/checking
DRiKE May 2, 2023
76238fc
Quickfix the quickfix, add unit test
DRiKE May 2, 2023
8a5b63d
Improve unit test for ipv4/multicast
DRiKE May 2, 2023
cf50551
bgp: also fix withdrawals for SAFI multicast
DRiKE May 2, 2023
f70edee
Move Asn16 from bgp::communities into asn module
DRiKE May 9, 2023
ad2ad2f
Introduce type alias HopOcts
DRiKE May 9, 2023
e22609c
Fix docstrings
DRiKE May 9, 2023
2f73c95
Rename 'two_octets' to 'asn16' inmethod names
DRiKE May 9, 2023
e1d85dc
Properly impl PartialEq for AsPath and Segment
DRiKE May 9, 2023
faeba1c
Rename InvalidSegmentTypeError to InvalidSegmentType
DRiKE May 9, 2023
1a617e6
Add Hash impl for Segment
DRiKE May 9, 2023
db54c7e
More idiomatic ToPathError
DRiKE May 9, 2023
27a7f66
Basis for another attempt at AS Paths
DRiKE Mar 15, 2023
0dcc30c
Add octseq as default feature flag
DRiKE Mar 15, 2023
6cfa7a3
WIP
DRiKE Mar 15, 2023
d5d9419
more WIP
DRiKE Mar 15, 2023
561db12
WIP in progress
DRiKE Mar 15, 2023
82b3d72
Implement composing of HopPath, and Index/IndexMut
DRiKE Mar 17, 2023
178b0dd
Various fixes
DRiKE Mar 21, 2023
7d9fa34
Tidy up Displays
DRiKE Mar 21, 2023
fe3a056
Implemented missing helpers to prepend/append segments
DRiKE Mar 21, 2023
9392bcc
Fix new segment methods, tests
DRiKE Mar 21, 2023
95a74a6
Add fn origin() to AsPath and HopPath
DRiKE Mar 21, 2023
1be85bd
Add fn contains() to HopPath
DRiKE Mar 21, 2023
f4474d5
From impls for HopPath
DRiKE Mar 21, 2023
69aa230
Add fn path_len to HopPath
DRiKE Mar 21, 2023
fccf479
Rename path_len to hop_count on HopPath
DRiKE Mar 21, 2023
32d271a
Add TryFrom<Hop> for Asn
DRiKE Mar 21, 2023
28b2cfa
Add try_into_asn shorthand on Hop
DRiKE Mar 21, 2023
ac1c726
Add iter on HopPath
DRiKE Mar 21, 2023
fcc58c4
some derives
density215 Mar 21, 2023
7b0a909
Impl IntoIterator on HopPath
DRiKE Mar 21, 2023
1f0396e
Clippy
DRiKE Mar 21, 2023
72eac4b
two more copy derivers
density215 Mar 21, 2023
fd62a4c
impl display
density215 Mar 21, 2023
d922415
the right order
density215 Mar 21, 2023
d20ec56
from Vec<Hop> to HopPath impl
density215 Mar 21, 2023
901f145
Move aspath module under bgp
DRiKE Mar 22, 2023
b947555
attr_change_set proposal
density215 Mar 22, 2023
ebdea61
Fix use for moved AsPath
DRiKE Mar 22, 2023
e37592a
Switch UpdateMessage over to new AsPath module
DRiKE Mar 22, 2023
10b32db
Fix PathHops iterator in case of empty Sequences
DRiKE Mar 22, 2023
820d877
Clippy for 1.65
DRiKE Mar 22, 2023
9ce07be
Add support to create AsPath from legacy two octet wireformat
DRiKE Mar 22, 2023
a4189d1
Add missing bound
DRiKE Mar 22, 2023
d874e48
Sorry Clippy
DRiKE Mar 22, 2023
91d087b
Use size_hint() when creating new AsPath Segments
DRiKE Mar 24, 2023
ad67b3c
Make AsPath and friends two-byte ASN aware.
partim Mar 30, 2023
17d6de0
Change UpdateMessage::aspath to always return the AS PATH attribute.
partim Mar 30, 2023
717008e
Clippy-suggested fixes.
partim Mar 30, 2023
2e31a75
Check the path contents in the two-byte ASN update test.
partim Mar 30, 2023
0836fdc
Don't warn on Unimplemented Path Attributes anymore
DRiKE Apr 3, 2023
c6bc3c7
Docs, cleanup, rearranging
DRiKE Apr 11, 2023
01faff9
Fixing/tidying up docstrings
DRiKE Apr 12, 2023
3a8b426
Add comment on unimplemented to_two_octet_as_path
DRiKE Apr 12, 2023
03630d7
More support for legacy paths
DRiKE Apr 12, 2023
3844fa1
Reordering/comments/consistency
DRiKE Apr 14, 2023
c684944
Remove old AsPath in favour of new module
DRiKE Apr 14, 2023
2527c56
Impl Hash for AsPath instead of deriving it
DRiKE Apr 14, 2023
613c5e8
Add Four Octet capability to OpenBuilder
DRiKE Apr 19, 2023
344d06d
Quickfix ipv4/multicast parsing/checking
DRiKE May 2, 2023
301a281
Quickfix the quickfix, add unit test
DRiKE May 2, 2023
1918096
Improve unit test for ipv4/multicast
DRiKE May 2, 2023
d407632
bgp: also fix withdrawals for SAFI multicast
DRiKE May 2, 2023
a701d30
Move Asn16 from bgp::communities into asn module
DRiKE May 9, 2023
2da4503
Introduce type alias HopOcts
DRiKE May 9, 2023
a9aaf41
Fix docstrings
DRiKE May 9, 2023
76ea881
Rename 'two_octets' to 'asn16' inmethod names
DRiKE May 9, 2023
12cc8ee
Properly impl PartialEq for AsPath and Segment
DRiKE May 9, 2023
7129f79
Rename InvalidSegmentTypeError to InvalidSegmentType
DRiKE May 9, 2023
2e81289
Add Hash impl for Segment
DRiKE May 9, 2023
b47a35a
More idiomatic ToPathError
DRiKE May 9, 2023
f6a8ee9
Merge remote-tracking branch 'refs/remotes/origin/aspath-with-hops' i…
DRiKE May 10, 2023
00594cc
Rename compose_hops to compose_as_path
DRiKE May 12, 2023
be057b4
Rename HopOcts to OwnedHop
DRiKE May 12, 2023
e3a844d
Switch to new parse_something_be method names from OctSeq
DRiKE May 12, 2023
9d1fbaa
Update Cargo.toml to OctSeq 0.2.0
DRiKE May 12, 2023
3a31a3f
Forget the examples for now
DRiKE May 12, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "routecore"
version = "0.2.1-dev"
version = "0.4.0-dev"
authors = ["The NLnet Labs RPKI team <rpki-team@nlnetlabs.nl>"]
categories = ["network-programming"]
description = "A Library with Building Blocks for BGP Routing"
Expand All @@ -13,6 +13,7 @@ license = "BSD-3-Clause"
[dependencies]

# Optional dependencies which, if included, introduce additional functionality.
arbitrary = { version = "1", optional = true, features = ["derive"] }
bcder = { version = "0.7.0", optional = true }
serde = { version = "1.0.95", optional = true, features = ["derive"] }

Expand All @@ -22,14 +23,14 @@ chrono = { version = "0.4", optional = true }
const-str = { version = "0.5.3", optional = true, features = ["case"] }
log = { version = "0.4.17", optional = true }

octseq = { git = "https://github.com/NLnetLabs/octseq", features = ["bytes"], optional = true }
octseq = { version = "0.2.0", features = ["bytes"], optional = true }
tokio = { version = "1", features = ["sync", "rt"], optional = true }

[dev-dependencies]
serde_test = "1.0"

[features]
default = []
default = ["octseq"]
bgp = ["bytes", "log", "octseq", "const-str"]
bmp = ["bgp", "bytes", "chrono", "log", "octseq"]
std = []
8 changes: 6 additions & 2 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ New
* Added new `asn::SmallAsnSet` which, as, the name suggests, is supposed
to hold a relatively small set of ASNs. ([#22])

[#14]: https://github.com/NLnetLabs/routecore/pull/14
[#22]: https://github.com/NLnetLabs/routecore/pull/22
* Added implementations for the `arbitrary::Arbitrary` trait to ASN and IP
resource types. ([#24])

Bug fixes

Expand All @@ -32,6 +32,10 @@ Other changes
* Changed the the minimal supported Rust version to 1.65, as the parsing of
BGP and BMP messages relies on GATs.

[#14]: https://github.com/NLnetLabs/routecore/pull/14
[#22]: https://github.com/NLnetLabs/routecore/pull/22
[#24]: https://github.com/NLnetLabs/routecore/pull/24


## 0.2.0

Expand Down
39 changes: 39 additions & 0 deletions src/addr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use std::str::FromStr;
/// There is no way of distinguishing between IPv4 and IPv6 from just a value
/// of this type. This information needs to be carried separately.
#[derive(Clone, Copy, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
struct Bits(u128);

impl Bits {
Expand Down Expand Up @@ -202,6 +203,23 @@ impl FamilyAndLen {
}
}

#[cfg(feature = "arbitrary")]
impl<'a> arbitrary::Arbitrary<'a> for FamilyAndLen {
fn arbitrary(
u: &mut arbitrary::Unstructured<'a>
) -> arbitrary::Result<Self> {
if bool::arbitrary(u)? {
Ok(Self(u8::arbitrary(u)? % 33))
}
else {
match u8::arbitrary(u)? % 129 {
128 => Ok(Self(0x40)),
val => Ok(Self(val ^ 0xFF))
}
}
}
}


//------------ Prefix --------------------------------------------------------

Expand Down Expand Up @@ -511,6 +529,26 @@ impl fmt::Display for Prefix {
}


//--- Arbitrary

#[cfg(feature = "arbitrary")]
impl<'a> arbitrary::Arbitrary<'a> for Prefix {
fn arbitrary(
u: &mut arbitrary::Unstructured<'a>
) -> arbitrary::Result<Self> {
let fal = FamilyAndLen::arbitrary(u)?;
let mut bits = Bits::arbitrary(u)?;
if fal.is_v4() {
bits.0 <<= 96;
}
Ok(Self {
family_and_len: fal,
bits: bits.clear_host(fal.len())
})
}
}



//------------ MaxLenPrefix --------------------------------------------------

Expand All @@ -532,6 +570,7 @@ impl fmt::Display for Prefix {
/// that, we can safely order 'any max_len' before 'no max_len' for equal
/// prefixes.
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
pub struct MaxLenPrefix {
/// The prefix.
prefix: Prefix,
Expand Down
Loading