mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 20:32:18 +00:00
bgpd: Fix style issues for peer-group overrides
This commit fixes all outstanding style/formatting issues as detected by 'git clang-format' or 'checkpath' for the new peer-group override implementation, which spanned across several commits. Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
This commit is contained in:
parent
246bb5f07a
commit
cf9ac8bfb0
@ -5325,8 +5325,8 @@ static int peer_prefix_list_set_vty(struct vty *vty, const char *ip_str,
|
|||||||
const char *direct_str)
|
const char *direct_str)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct peer *peer;
|
|
||||||
int direct = FILTER_IN;
|
int direct = FILTER_IN;
|
||||||
|
struct peer *peer;
|
||||||
|
|
||||||
peer = peer_and_group_lookup_vty(vty, ip_str);
|
peer = peer_and_group_lookup_vty(vty, ip_str);
|
||||||
if (!peer)
|
if (!peer)
|
||||||
|
26
bgpd/bgpd.c
26
bgpd/bgpd.c
@ -5174,9 +5174,9 @@ int peer_allowas_in_set(struct peer *peer, afi_t afi, safi_t safi,
|
|||||||
if (origin) {
|
if (origin) {
|
||||||
if (member->allowas_in[afi][safi] != 0
|
if (member->allowas_in[afi][safi] != 0
|
||||||
|| !CHECK_FLAG(member->af_flags[afi][safi],
|
|| !CHECK_FLAG(member->af_flags[afi][safi],
|
||||||
PEER_FLAG_ALLOWAS_IN_ORIGIN)) {
|
PEER_FLAG_ALLOWAS_IN_ORIGIN)) {
|
||||||
SET_FLAG(member->af_flags[afi][safi],
|
SET_FLAG(member->af_flags[afi][safi],
|
||||||
PEER_FLAG_ALLOWAS_IN_ORIGIN);
|
PEER_FLAG_ALLOWAS_IN_ORIGIN);
|
||||||
member->allowas_in[afi][safi] = 0;
|
member->allowas_in[afi][safi] = 0;
|
||||||
peer_on_policy_change(peer, afi, safi, 0);
|
peer_on_policy_change(peer, afi, safi, 0);
|
||||||
}
|
}
|
||||||
@ -5208,7 +5208,7 @@ int peer_allowas_in_unset(struct peer *peer, afi_t afi, safi_t safi)
|
|||||||
if (peer_group_active(peer)) {
|
if (peer_group_active(peer)) {
|
||||||
peer_af_flag_inherit(peer, afi, safi, PEER_FLAG_ALLOWAS_IN);
|
peer_af_flag_inherit(peer, afi, safi, PEER_FLAG_ALLOWAS_IN);
|
||||||
peer_af_flag_inherit(peer, afi, safi,
|
peer_af_flag_inherit(peer, afi, safi,
|
||||||
PEER_FLAG_ALLOWAS_IN_ORIGIN);
|
PEER_FLAG_ALLOWAS_IN_ORIGIN);
|
||||||
PEER_ATTR_INHERIT(peer, allowas_in[afi][safi]);
|
PEER_ATTR_INHERIT(peer, allowas_in[afi][safi]);
|
||||||
peer_on_policy_change(peer, afi, safi, 0);
|
peer_on_policy_change(peer, afi, safi, 0);
|
||||||
|
|
||||||
@ -5232,19 +5232,18 @@ int peer_allowas_in_unset(struct peer *peer, afi_t afi, safi_t safi)
|
|||||||
for (ALL_LIST_ELEMENTS(peer->group->peer, node, nnode, member)) {
|
for (ALL_LIST_ELEMENTS(peer->group->peer, node, nnode, member)) {
|
||||||
/* Skip peers with overridden configuration. */
|
/* Skip peers with overridden configuration. */
|
||||||
if (CHECK_FLAG(member->af_flags_override[afi][safi],
|
if (CHECK_FLAG(member->af_flags_override[afi][safi],
|
||||||
PEER_FLAG_ALLOWAS_IN))
|
PEER_FLAG_ALLOWAS_IN))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Skip peers where flag is already disabled. */
|
/* Skip peers where flag is already disabled. */
|
||||||
if (!CHECK_FLAG(member->af_flags[afi][safi],
|
if (!CHECK_FLAG(member->af_flags[afi][safi],
|
||||||
PEER_FLAG_ALLOWAS_IN))
|
PEER_FLAG_ALLOWAS_IN))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Remove flags and configuration on peer-group member. */
|
/* Remove flags and configuration on peer-group member. */
|
||||||
|
UNSET_FLAG(member->af_flags[afi][safi], PEER_FLAG_ALLOWAS_IN);
|
||||||
UNSET_FLAG(member->af_flags[afi][safi],
|
UNSET_FLAG(member->af_flags[afi][safi],
|
||||||
PEER_FLAG_ALLOWAS_IN);
|
PEER_FLAG_ALLOWAS_IN_ORIGIN);
|
||||||
UNSET_FLAG(member->af_flags[afi][safi],
|
|
||||||
PEER_FLAG_ALLOWAS_IN_ORIGIN);
|
|
||||||
member->allowas_in[afi][safi] = 0;
|
member->allowas_in[afi][safi] = 0;
|
||||||
peer_on_policy_change(member, afi, safi, 0);
|
peer_on_policy_change(member, afi, safi, 0);
|
||||||
}
|
}
|
||||||
@ -6269,9 +6268,8 @@ int peer_maximum_prefix_set(struct peer *peer, afi_t afi, safi_t safi,
|
|||||||
/* Check if handling a regular peer. */
|
/* Check if handling a regular peer. */
|
||||||
if (!CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) {
|
if (!CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) {
|
||||||
/* Re-check if peer violates maximum-prefix. */
|
/* Re-check if peer violates maximum-prefix. */
|
||||||
if ((peer->status == Established) && (peer->afc[afi][safi])) {
|
if ((peer->status == Established) && (peer->afc[afi][safi]))
|
||||||
bgp_maximum_prefix_overflow(peer, afi, safi, 1);
|
bgp_maximum_prefix_overflow(peer, afi, safi, 1);
|
||||||
}
|
|
||||||
|
|
||||||
/* Skip peer-group mechanics for regular peers. */
|
/* Skip peer-group mechanics for regular peers. */
|
||||||
return 0;
|
return 0;
|
||||||
@ -7218,11 +7216,11 @@ static void bgp_config_write_peer_af(struct vty *vty, struct bgp *bgp,
|
|||||||
|
|
||||||
/* send-community print. */
|
/* send-community print. */
|
||||||
flag_scomm = peergroup_af_flag_check(peer, afi, safi,
|
flag_scomm = peergroup_af_flag_check(peer, afi, safi,
|
||||||
PEER_FLAG_SEND_COMMUNITY);
|
PEER_FLAG_SEND_COMMUNITY);
|
||||||
flag_secomm = peergroup_af_flag_check(peer, afi, safi,
|
flag_secomm = peergroup_af_flag_check(peer, afi, safi,
|
||||||
PEER_FLAG_SEND_EXT_COMMUNITY);
|
PEER_FLAG_SEND_EXT_COMMUNITY);
|
||||||
flag_slcomm = peergroup_af_flag_check(peer, afi, safi,
|
flag_slcomm = peergroup_af_flag_check(peer, afi, safi,
|
||||||
PEER_FLAG_SEND_LARGE_COMMUNITY);
|
PEER_FLAG_SEND_LARGE_COMMUNITY);
|
||||||
|
|
||||||
if (!bgp_option_check(BGP_OPT_CONFIG_CISCO)) {
|
if (!bgp_option_check(BGP_OPT_CONFIG_CISCO)) {
|
||||||
if (flag_scomm && flag_secomm && flag_slcomm) {
|
if (flag_scomm && flag_secomm && flag_slcomm) {
|
||||||
@ -7322,7 +7320,7 @@ static void bgp_config_write_peer_af(struct vty *vty, struct bgp *bgp,
|
|||||||
vty_out(vty, " neighbor %s allowas-in\n", addr);
|
vty_out(vty, " neighbor %s allowas-in\n", addr);
|
||||||
} else {
|
} else {
|
||||||
vty_out(vty, " neighbor %s allowas-in %d\n", addr,
|
vty_out(vty, " neighbor %s allowas-in %d\n", addr,
|
||||||
peer->allowas_in[afi][safi]);
|
peer->allowas_in[afi][safi]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1555,7 +1555,8 @@ extern int peer_flag_unset(struct peer *, uint32_t);
|
|||||||
extern int peer_af_flag_set(struct peer *, afi_t, safi_t, uint32_t);
|
extern int peer_af_flag_set(struct peer *, afi_t, safi_t, uint32_t);
|
||||||
extern int peer_af_flag_unset(struct peer *, afi_t, safi_t, uint32_t);
|
extern int peer_af_flag_unset(struct peer *, afi_t, safi_t, uint32_t);
|
||||||
extern int peer_af_flag_check(struct peer *, afi_t, safi_t, uint32_t);
|
extern int peer_af_flag_check(struct peer *, afi_t, safi_t, uint32_t);
|
||||||
extern void peer_af_flag_inherit(struct peer *, afi_t, safi_t, uint32_t);
|
extern void peer_af_flag_inherit(struct peer *peer, afi_t afi, safi_t safi,
|
||||||
|
uint32_t flag);
|
||||||
|
|
||||||
extern int peer_ebgp_multihop_set(struct peer *, int);
|
extern int peer_ebgp_multihop_set(struct peer *, int);
|
||||||
extern int peer_ebgp_multihop_unset(struct peer *);
|
extern int peer_ebgp_multihop_unset(struct peer *);
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
/* Required variables to link in libbgp */
|
/* Required variables to link in libbgp */
|
||||||
struct zebra_privs_t bgpd_privs = {0};
|
struct zebra_privs_t bgpd_privs = {0};
|
||||||
struct thread_master *master = NULL;
|
struct thread_master *master;
|
||||||
|
|
||||||
enum test_state {
|
enum test_state {
|
||||||
TEST_SUCCESS,
|
TEST_SUCCESS,
|
||||||
@ -673,10 +673,9 @@ static void test_execute(struct test *test, const char *fmt, ...)
|
|||||||
cmd, ret);
|
cmd, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free memory and return. */
|
/* Free memory. */
|
||||||
cmd_free_strvec(vline);
|
cmd_free_strvec(vline);
|
||||||
XFREE(MTYPE_TMP, cmd);
|
XFREE(MTYPE_TMP, cmd);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_config(struct test *test, const char *fmt, bool invert,
|
static void test_config(struct test *test, const char *fmt, bool invert,
|
||||||
@ -722,7 +721,6 @@ static void test_config(struct test *test, const char *fmt, bool invert,
|
|||||||
/* Free memory and return. */
|
/* Free memory and return. */
|
||||||
XFREE(MTYPE_TMP, matcher);
|
XFREE(MTYPE_TMP, matcher);
|
||||||
XFREE(MTYPE_TMP, config);
|
XFREE(MTYPE_TMP, config);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_config_present(struct test *test, const char *fmt, ...)
|
static void test_config_present(struct test *test, const char *fmt, ...)
|
||||||
@ -1017,7 +1015,7 @@ static void test_peer_attr(struct test *test, struct test_peer_attr *pa)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bgp_startup()
|
static void bgp_startup(void)
|
||||||
{
|
{
|
||||||
cmd_init(1);
|
cmd_init(1);
|
||||||
openzlog("testbgpd", "NONE", 0, LOG_CONS | LOG_NDELAY | LOG_PID,
|
openzlog("testbgpd", "NONE", 0, LOG_CONS | LOG_NDELAY | LOG_PID,
|
||||||
@ -1033,7 +1031,7 @@ static void bgp_startup()
|
|||||||
bgp_pthreads_run();
|
bgp_pthreads_run();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bgp_shutdown()
|
static void bgp_shutdown(void)
|
||||||
{
|
{
|
||||||
struct bgp *bgp;
|
struct bgp *bgp;
|
||||||
struct listnode *node, *nnode;
|
struct listnode *node, *nnode;
|
||||||
|
Loading…
Reference in New Issue
Block a user