-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
libnl3 updates for MPLS #7195
libnl3 updates for MPLS #7195
Conversation
@@ -0,0 +1,13 @@ | |||
diff --git a/lib/route/route_obj.c b/lib/route/route_obj.c |
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.
are they upstreamed? can you format the patch properly, author, description, bla, bla
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.
These changes are not upstreamed. Please provide an example of how patch files should be formatted.
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.
The patch files have been reformatted as requested. A PR has been created to upstream libnl3 changes, but there have been no PRs merged in that project in 2021, so these patches remain necessary.
3f4c34d
to
a0c399c
Compare
8d820c9
to
1de29ea
Compare
From c89d1a129f71d3d2f76e6cbadb11ef41d8941a73 Mon Sep 17 00:00:00 2001 | ||
From: Ann Pokora <[email protected]> | ||
Date: Tue, 25 May 2021 18:10:04 -0700 | ||
Subject: [PATCH 2/2] mpls remove nl_addr_valid |
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.
why are we remove the validation?
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.
@lguohan nl_addr_valid() arguments are supposed to be a pointer to an ASCII string and an address family value (AF_MPLS, AF_INET, AF_INET6)... it then uses these to validate that the string format contains an address for the specified family.
The removed calls to nl_addr_valid() were instead passing in a pointer to a binary address and the length of the binary address... this is completely wrong. For most cases, the length of the binary address would not match any of the values of supported address families, so nl_addr_valid() would return true. But if the binary address was an MPLS label stack with 3 labels, then the length would match the value of AF_DECnet (12) and it attempts to parse the binary address as if it were an ASCII string... this fails and nl_addr_valid() returns false.
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 you put the above explaination into the this patch file?
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.
@lguohan explanation is added to patch file.
36f7338
to
ce5205f
Compare
{ | ||
struct nl_addr *old = nh->rtnh_newdst; | ||
|
||
- if (!nl_addr_valid(nl_addr_get_binary_addr(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.
Instead of removing the validation, can we fix the arguments.
replace nl_addr_get_len(addr) with nl_addr_get_family(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.
@smahesh That still isn't valid. Look at the code for nl_addr_valid() in libnl3. It is looking for an ASCII string and validating the string format. addr does not container a string, The return from nl_addr_get_binary_addr() is not a string.
We would have to first convert addr to string. It's pointless. nl_addr_valid() is not used anywhere else in libnl3, so I do not know why someone decided to use it in these MPLS functions.
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.
nl_addr_valid() is using the route_nh_set which is not mpls specific. this is the IP functions. how can this function pass now?
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.
@lguohan RTA_NEWDST is specific to MPLS. NEWDST contains the MPLS labelstack associated with the NH.
leaf mpls { | ||
type string { | ||
pattern "enable|disable"; | ||
} |
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.
need description here, what does enable/disable mean here.
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.
@lguohan description is added.
ab18f4d
to
90d5aa8
Compare
Date: Tue, 25 May 2021 18:10:04 -0700 | ||
Subject: [PATCH 2/2] mpls remove nl_addr_valid | ||
|
||
The removed calls to nl_addr_valid() are passing in a pointer to a binary address and the length of the binary address, which does not match expected arguments for nl_addr_valid(). nl_addr_valid() expects a pointer to an ASCII string and the address family of the string format. The incorrect arguments cause unexpected failures and the expected arguments are not available in the context. |
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 you make it more readable, make it multi-line, limit by 80 char per line?
i am only review the libnl part, for the yang model part, it should be reviewed in the sonic yang subgroup meeting. @rlhui, |
e6cd1ae
to
2fc8eb8
Compare
/azp run |
Commenter does not have sufficient privileges for PR 7195 in repo Azure/sonic-buildimage |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
I was not aware this PR contains yang changes until last week. @qbdwlr could email the yang subgroup [email protected] and @anshuv-mfst to request for review asap. |
Looks good to me.. waiting for builds to pass. |
@lguohan @smaheshm Please review/approve this PR. The sonic-swss PR (sonic-net/sonic-swss#1686) will not build successfully until this PR is merged to master. |
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.
👍
For posterity can you add the link to libnl3 upstream patch in the description section. Thanks! |
What I did
SONiC buildimage support for MPLS:
Why I did it
SONiC libnl3 support for MPLS
How I verified it
Unit-tests in sonic-swss/tests/test_mpls.py and sonic-utilities/tests
System tests in sonic-mgmt
Details if related
Refer to HLD: sonic-net/SONiC#706
PR to upstream to libnl3 project: thom311/libnl#284