-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move MetaAddr serialization into zebra_network::protocol::external #3020
Conversation
Preparation for `addrv2` serialization.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! I saw one opportunity for improvement, but it's not directly part of the PR as the PR is just moving the code, so feel free to ignore it
let mut smallest_disallowed_vec = Vec::with_capacity(max_allocation + 1); | ||
for _ in 0..(MetaAddr::max_allocation() + 1) { | ||
smallest_disallowed_vec.push(addr); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional suggestion:
let mut smallest_disallowed_vec = Vec::with_capacity(max_allocation + 1); | |
for _ in 0..(MetaAddr::max_allocation() + 1) { | |
smallest_disallowed_vec.push(addr); | |
} | |
let mut smallest_disallowed_vec = vec![addr; max_allocation + 1]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Motivation
To prepare for
addrv2
serialization, we need to deserialize two different formats into theMetaAddr
data structure.Zebra expects each data structure to have a single format. So it doesn't provide a format argument to its deserialization functions. So I want to create two different types for deserialization:
AddrV1
andAddrV2
.Solution
This is the first part of that change, which moves the
MetaAddr
serialization code to thezebra_network::protocol::external
module.I split the code movement from the type changes, to make them both easier to review.
Review
@jvff can review this change.
It's not urgent, but there will be a series of PRs, so it would be great to get it done by Monday.
Reviewer Checklist
Follow Up Work
addrv2
in Zebra #2681