-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bgpd,lib: deal with bgp-flowspec pointer in bgpd
BGP-FlowSpec (BGP-FS) utilizes the 'ptr' pointer within the lib to store a raw copy of BGP-FS NLRI as seen in the structure definitions: > struct flowspec_prefix { > [...] > uintptr_t ptr; > }; > > /* FRR generic prefix structure. */ > struct prefix { > uint8_t family; > uint16_t prefixlen; > union { > uint8_t prefix; > [...] > struct linkstate_prefix prefix_flowspec; /* AF_FLOWSPEC */ > [...] > } u __attribute__((aligned(8))); > }; When copying a BGP-FS prefix with prefix_copy(), memory is allocated for a new 'ptr' pointer in the copy. If a 'struct prefix' for BGP-FS is declared on the stack and filled using prefix_copy(), this new pointer must be freed before the function exits. Releasing this pointer is not obvious. Forgetting to do so might leads to memory leaks. For example, the flowspec 'ptr' release is missing in route_node_get(). Deal with BGP-FS 'ptr' pointer memory in bgpd itself. Signed-off-by: Louis Scalbert <[email protected]>
- Loading branch information
1 parent
2babccc
commit 29838e7
Showing
6 changed files
with
34 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters