-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
Misc quality of life improvements #123
Conversation
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.
Great work! I left some comments for your questions.
Can the bgpkit-parser/src/parser/bgp/attributes/attr_09_originator.rs Lines 10 to 15 in e2d1ed4
|
They have to be 4 octets unless specified otherwise. They do not necessarily need to be IPv4 addresses. Corresponding RFC4271 section for
Corresponding RFC4456 section for
(when in doubt, check this attribute index: https://www.iana.org/assignments/bgp-parameters/bgp-parameters.xhtml#bgp-parameters-2) |
I think the changes are now about ready for review. I want to apologize again about the size of the PR. I did not realize it would get this large when I first started going off on tangents. Please let me know which areas you feel require changes, additional unit test coverage, or should be deferred/removed. I imagine there are plenty of things I either forgot or overlooked. Going forward, my current thinking is that the conversion to |
This pull request aims to address points of friction using the library. From my experience, those points of friction were:
Hash
.Deref
where appropriate.AsPath
andMpReachNlri
which are frequently used. Ideally, these attributes could be retrieved with helper methods instead of needing to iterate and match every attribute.*Value
enums to their respective*Type
enums.Deserialize
(covered by Add full serde support #122).Notes on changes
Attributes
is quite inefficient at the moment and has lots of areas for improvement. Firstly, it probably needs more methods for additional common attributes. I also chose to implementIntoIterator
withAttributeValue
since that is generally what the user is most interested in, but an argument can be made for usingAttribute
instead.AttrType
could have turned out better. Unfortunately, there is no default/other option for#[derive(Primitive)]
so the inclusion of an unknown attribute type requires that it be implemented manually.Attribute
struct adds additional boiler plate to accessing attributes. It would be easier to use ifAttributeValue
took the place ofAttribute
so it could be matched on directly. We can already determine theAttrType
based on justAttributeValue
so the only thing missing is theAttribute
flags. Perhaps, the flags could be added toAttributeValue
instead. Well-known attributes already have their flags pre-defined so they would only need to be added to some of the attributes. That being said, if new flags were to be added or the received flags are inconsistent with what is expected, they must be retained so they can be handled by the user.Debug
for a couple of types in an attempt to reduce the clutter when debug printing some values. I am not sure if this is worth keeping and may be better to simply derive.