-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
bgpd: fix various memleaks when using community aliases #9369
Conversation
Signed-off-by: Igor Ryzhov <[email protected]>
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.
Thanks for your contribution to FRR!
Click for style suggestions
To apply these suggestions:
curl -s https://gist.githubusercontent.com/polychaeta/cea8507b6c500a56d530a249e28068d6/raw/ead281f26e7ef8d2d5692ca4db612ec5f5c89ce0/cr_9369_1628673801.diff | git apply
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 80b73f7ac6..b2d5e659a0 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -10731,7 +10731,8 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi,
if (strcmp(alias, com2alias)
== 0)
found = true;
- XFREE(MTYPE_TMP, communities[i]);
+ XFREE(MTYPE_TMP,
+ communities[i]);
}
XFREE(MTYPE_TMP, communities);
}
@@ -10746,7 +10747,8 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi,
if (strcmp(alias, com2alias)
== 0)
found = true;
- XFREE(MTYPE_TMP, communities[i]);
+ XFREE(MTYPE_TMP,
+ communities[i]);
}
XFREE(MTYPE_TMP, communities);
}
If you are a new contributor to FRR, please see our contributing guidelines.
After making changes, you do not need to create a new PR. You should perform an amend or interactive rebase followed by a force push.
787f91d
to
56b68d4
Compare
Outdated results 🚧Basic BGPD CI results: Partial FAILURE, autoscript-2021-08-11-07:13:36.log.bz2 tests failed, has VALGRIND issues
For details, please contact louberger |
frrstr_split(path->attr->community->str, " ", &communities, | ||
&num); | ||
for (int i = 0; i < num; i++) { | ||
const char *com2alias = | ||
bgp_community2alias(communities[i]); | ||
if (strcmp(alias, com2alias) == 0) | ||
return RMAP_MATCH; | ||
found = true; |
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.
Hm, won't found
be overriden with false
with the next community (not matched)?
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.
No, there are no found = false
assignments anywhere in the loop.
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.
Yes, right 😄 🤦
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.
But still, I can change the expression to be if (!found && (strcmp(alias, com2alias) == 0))
to avoid additional comparisons when we already found the first match. I'll force-push once we get some feedback from Lou, as CI still fails even with these fixes.
Continuous Integration Result: FAILEDContinuous Integration Result: FAILEDSee below for issues. This is a comment from an automated CI system. Get source / Pull Request: SuccessfulBuilding Stage: SuccessfulBasic Tests: FailedTopotests Ubuntu 18.04 amd64 part 9: Failed (click for details)Topology Test Results are at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-TOPO9U18AMD64-20992/test Topology Tests failed for Topotests Ubuntu 18.04 amd64 part 9:
see full log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-20992/artifact/TOPO9U18AMD64/ErrorLog/log_topotests.txt Successful on other platforms/tests
|
Continuous Integration Result: SUCCESSFULContinuous Integration Result: SUCCESSFULCongratulations, this patch passed basic tests Tested-by: NetDEF / OpenSourceRouting.org CI System CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-20991/ This is a comment from an automated CI system. Warnings Generated during build:Checkout code: Successful with additional warnings
|
Signed-off-by: Igor Ryzhov <[email protected]>
56b68d4
to
3cad57f
Compare
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.
Thanks for your contribution to FRR!
Click for style suggestions
To apply these suggestions:
curl -s https://gist.githubusercontent.com/polychaeta/7ce0e223cafcea0b0074fa92025a42c7/raw/7afe5d744fe3814fa99cc4a75bec09addeb47340/cr_9369_1628855073.diff | git apply
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index fd5897dc84..c12d2394f3 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -10730,7 +10730,7 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi,
communities[i]);
if (!found
&& strcmp(alias, com2alias)
- == 0)
+ == 0)
found = true;
XFREE(MTYPE_TMP,
communities[i]);
@@ -10747,7 +10747,7 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi,
communities[i]);
if (!found
&& strcmp(alias, com2alias)
- == 0)
+ == 0)
found = true;
XFREE(MTYPE_TMP,
communities[i]);
If you are a new contributor to FRR, please see our contributing guidelines.
After making changes, you do not need to create a new PR. You should perform an amend or interactive rebase followed by a force push.
Signed-off-by: Igor Ryzhov <[email protected]>
3cad57f
to
cd9cc0e
Compare
Outdated results 💚Basic BGPD CI results: SUCCESS, 0 tests failed
For details, please contact louberger |
Continuous Integration Result: FAILEDContinuous Integration Result: FAILEDSee below for issues. This is a comment from an automated CI system. Get source / Pull Request: SuccessfulBuilding Stage: SuccessfulBasic Tests: FailedTopotests Ubuntu 18.04 i386 part 9: Failed (click for details)Topology Test Results are at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-TOPO9U18I386-21042/test Topology Tests failed for Topotests Ubuntu 18.04 i386 part 9:
see full log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-21042/artifact/TOPO9U18I386/ErrorLog/log_topotests.txt Successful on other platforms/tests
|
Continuous Integration Result: FAILEDContinuous Integration Result: FAILEDSee below for issues. This is a comment from an automated CI system. Get source / Pull Request: SuccessfulBuilding Stage: SuccessfulBasic Tests: FailedTopotests Ubuntu 18.04 amd64 part 9: Failed (click for details)Topology Test Results are at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-TOPO9U18AMD64-21043/test Topology Tests failed for Topotests Ubuntu 18.04 amd64 part 9:
see full log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-21043/artifact/TOPO9U18AMD64/ErrorLog/log_topotests.txt Successful on other platforms/tests
|
ci:rerun |
Outdated results 💚Basic BGPD CI results: SUCCESS, 0 tests failed
For details, please contact louberger |
Continuous Integration Result: FAILEDContinuous Integration Result: FAILEDSee below for issues. This is a comment from an automated CI system. Get source / Pull Request: SuccessfulBuilding Stage: SuccessfulBasic Tests: FailedTopotests debian 10 amd64 part 9: Failed (click for details)Topology Test Results are at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-TOPO9DEB10AMD64-21046/test Topology Tests failed for Topotests debian 10 amd64 part 9:
see full log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-21046/artifact/TOPO9DEB10AMD64/ErrorLog/log_topotests.txt Topotests Ubuntu 18.04 i386 part 9: Failed (click for details)Topology Test Results are at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-TOPO9U18I386-21046/test Topology Tests failed for Topotests Ubuntu 18.04 i386 part 9:
see full log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-21046/artifact/TOPO9U18I386/ErrorLog/log_topotests.txt Successful on other platforms/tests
|
ci:rerun |
💚 Basic BGPD CI results: SUCCESS, 0 tests failedResults table
For details, please contact louberger |
ci:rerun |
Continuous Integration Result: SUCCESSFULCongratulations, this patch passed basic tests Tested-by: NetDEF / OpenSourceRouting.org CI System CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-21084/ This is a comment from an automated CI system. |
No description provided.