-
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: Clean address-family config on daemon restart #17716
Conversation
Fixing issue #17463 |
bgpd/bgp_route.c
Outdated
@@ -15778,6 +15778,30 @@ static int bgp_distance_unset(struct vty *vty, const char *distance_str, | |||
return CMD_SUCCESS; | |||
} | |||
|
|||
int bgp_address_family_distance_clean() |
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.
Please use the same pattern as bgp_static_delete()
. More/less identical except for some adjustments.
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.
Done
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 meant not only void()
, but the structure, macros, logic inside also.
46919e9
to
98a6754
Compare
bgpd/bgp_route.h
Outdated
@@ -831,6 +831,7 @@ extern void bgp_redistribute_withdraw(struct bgp *, afi_t, int, unsigned short); | |||
|
|||
extern void bgp_static_add(struct bgp *); | |||
extern void bgp_static_delete(struct bgp *); | |||
extern void bgp_address_family_distance_clean(); |
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 name it also ..._delete()
?
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.
Done
bgpd/bgpd.c
Outdated
@@ -4237,6 +4237,14 @@ int bgp_delete(struct bgp *bgp) | |||
} | |||
} | |||
|
|||
// Clean BGP address family parameters |
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.
Please drop this comment or replace with /* */
.
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.
Done
bgpd/bgp_route.c
Outdated
struct bgp_dest *dest = NULL; | ||
struct bgp_distance *bdistance = NULL; | ||
|
||
for (afi=AFI_IP;afi<AFI_MAX;afi++) { |
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.
Let's use FOREACH_AFI_SAFI macro, see bgp_static_delete().
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.
Done
98a6754
to
3962f21
Compare
bgpd/bgp_route.h
Outdated
@@ -831,6 +831,7 @@ extern void bgp_redistribute_withdraw(struct bgp *, afi_t, int, unsigned short); | |||
|
|||
extern void bgp_static_add(struct bgp *); | |||
extern void bgp_static_delete(struct bgp *); | |||
extern void bgp_address_family_distance_delete(); |
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.
Please use extern void bgp_address_family_distance_delete(void);
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.
Done
bgpd/bgp_route.c
Outdated
@@ -15778,6 +15778,28 @@ static int bgp_distance_unset(struct vty *vty, const char *distance_str, | |||
return CMD_SUCCESS; | |||
} | |||
|
|||
void bgp_address_family_distance_delete() |
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.
void bgp_address_family_distance_delete(void)
, please.
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.
Done
bgpd/bgp_route.c
Outdated
XFREE(MTYPE_AS_LIST, bdistance->access_list); | ||
bgp_distance_free(bdistance); | ||
|
||
bgp_dest_set_bgp_path_info(dest, NULL); |
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.
We should use bgp_dest_set_bgp_distance_info()
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.
Done
Also, please take a look at frrbot and |
When stopping and restarting BGP daemon part of the configuration remains. It should be cleared. Particulary those are address-family parametes, like: distance, ead-es-frag, disable-ead-evi-rx, disable-ead-evi-tx. Signed-off-by: Yaroslav Kholod <[email protected]>
3962f21
to
663281c
Compare
Sorry for the mess. |
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.
LGTM
When stopping and restarting BGP daemon part of the configuration remains. It should be cleared.
Particulary those are address-family parametes, like: distance, ead-es-frag, disable-ead-evi-rx, disable-ead-evi-tx.