-
Notifications
You must be signed in to change notification settings - Fork 1.4k
ospf6d: Fix OSPFv3 SNMP interface state mapping #18697
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
Conversation
riw777
left a comment
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
ospf6d/ospf6_snmp.c
Outdated
| { | ||
| switch (state) { | ||
| case OSPF6_INTERFACE_DOWN: | ||
| return 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.
Can we have actual defines returned?
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.
I think it is better to return it this way instead of returning actual # defines for the matching ones and magic number for the not-matching ones.
Alternatively, we could create new define for SNMP and return those
for example #OSPFV6_INTERFACE_DOWN_SNMP
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.
I just don't want magic numbers. No-one is going to remember off the top of their head what 1 means, but they will pretty quickly understand OSPFV6_INTERFACE_DOWN_SNMP
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.
where are we on this?
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.
@donaldsharp : I've replaced the hard-coded values with #defines. Could you please review again and approve it if everything looks good?
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.
@riw777 @donaldsharp : Could you please take a look and approve if everything looks okay now ?
The OSPFv3 SNMP implementation was incorrectly returning internal state values directly without mapping them to the OSPFv3 MIB state values defined in RFC 5643. This caused a mismatch between the SNMP output and the actual interface states. Added a mapping function to convert internal OSPFv3 interface states to their corresponding OSPFv3 MIB state values: - OSPF6_INTERFACE_DOWN (1) -> down(1) - OSPF6_INTERFACE_LOOPBACK (2) -> loopback(2) - OSPF6_INTERFACE_WAITING (3) -> waiting(3) - OSPF6_INTERFACE_POINTTOPOINT (4) -> pointToPoint(4) - OSPF6_INTERFACE_DR (7) -> designatedRouter(5) - OSPF6_INTERFACE_BDR (6) -> backupDesignatedRouter(6) - OSPF6_INTERFACE_DROTHER (5) -> otherDesignatedRouter(7) This ensures that SNMP queries return the correct state values according to the OSPFv3 MIB specification. Ticket: #4402285 Ticket: #4362862 Signed-off-by: Mitesh Kanjariya <[email protected]>
d9b99c1 to
03e15fd
Compare
|
ci:rerun |
1 similar comment
|
ci:rerun |
The OSPFv3 SNMP implementation was incorrectly returning internal state values directly without mapping them to the OSPFv3 MIB state values defined in RFC 5643. This caused a mismatch between the SNMP output and the actual interface states.
Added a mapping function to convert internal OSPFv3 interface states to their corresponding OSPFv3 MIB state values:
This ensures that SNMP queries return the correct state values according to the OSPFv3 MIB specification.
Ticket: #4402285
Ticket: #4362862
UT:
before the fix:
After the fix: