Skip to content

Commit

Permalink
Merge pull request #2497 from ppmathis/backport/5.0-pgo-efas
Browse files Browse the repository at this point in the history
[5.0] bgpd: Backport peer-attribute overrides, peer-level enforce-first-as and filtered-routes fix
  • Loading branch information
riw777 committed Jun 20, 2018
2 parents f0adaee + ca81257 commit ea780a6
Show file tree
Hide file tree
Showing 13 changed files with 3,479 additions and 1,343 deletions.
3 changes: 1 addition & 2 deletions bgpd/bgp_attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1177,7 +1177,6 @@ static bgp_attr_parse_ret_t bgp_attr_aspath_check(struct peer *const peer,
* not right.
* So do the checks later, i.e. here
*/
struct bgp *bgp = peer->bgp;
struct aspath *aspath;

/* Confederation sanity check. */
Expand All @@ -1192,7 +1191,7 @@ static bgp_attr_parse_ret_t bgp_attr_aspath_check(struct peer *const peer,
}

/* First AS check for EBGP. */
if (bgp != NULL && bgp_flag_check(bgp, BGP_FLAG_ENFORCE_FIRST_AS)) {
if (CHECK_FLAG(peer->flags, PEER_FLAG_ENFORCE_FIRST_AS)) {
if (peer->sort == BGP_PEER_EBGP
&& !aspath_firstas_check(attr->aspath, peer->as)) {
zlog_err("%s incorrect first AS (must be %u)",
Expand Down
3 changes: 1 addition & 2 deletions bgpd/bgp_fsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ static struct peer *peer_xfer_conn(struct peer *from_peer)
peer->as = from_peer->as;
peer->v_holdtime = from_peer->v_holdtime;
peer->v_keepalive = from_peer->v_keepalive;
peer->routeadv = from_peer->routeadv;
peer->v_routeadv = from_peer->v_routeadv;
peer->v_gr_restart = from_peer->v_gr_restart;
peer->cap = from_peer->cap;
Expand Down Expand Up @@ -1143,7 +1142,7 @@ int bgp_stop(struct peer *peer)
}

/* Reset keepalive and holdtime */
if (PEER_OR_GROUP_TIMER_SET(peer)) {
if (CHECK_FLAG(peer->flags, PEER_FLAG_TIMER)) {
peer->v_keepalive = peer->keepalive;
peer->v_holdtime = peer->holdtime;
} else {
Expand Down
6 changes: 3 additions & 3 deletions bgpd/bgp_packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ void bgp_open_send(struct peer *peer)
uint16_t send_holdtime;
as_t local_as;

if (PEER_OR_GROUP_TIMER_SET(peer))
if (CHECK_FLAG(peer->flags, PEER_FLAG_TIMER))
send_holdtime = peer->holdtime;
else
send_holdtime = peer->bgp->default_holdtime;
Expand Down Expand Up @@ -1237,7 +1237,7 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size)
implementation MAY adjust the rate at which it sends KEEPALIVE
messages as a function of the Hold Time interval. */

if (PEER_OR_GROUP_TIMER_SET(peer))
if (CHECK_FLAG(peer->flags, PEER_FLAG_TIMER))
send_holdtime = peer->holdtime;
else
send_holdtime = peer->bgp->default_holdtime;
Expand All @@ -1247,7 +1247,7 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size)
else
peer->v_holdtime = send_holdtime;

if ((PEER_OR_GROUP_TIMER_SET(peer))
if ((CHECK_FLAG(peer->flags, PEER_FLAG_TIMER))
&& (peer->keepalive < peer->v_holdtime / 3))
peer->v_keepalive = peer->keepalive;
else
Expand Down
6 changes: 1 addition & 5 deletions bgpd/bgp_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -1169,12 +1169,8 @@ static int bgp_input_modifier(struct peer *peer, struct prefix *p,

peer->rmap_type = 0;

if (ret == RMAP_DENYMATCH) {
/* Free newly generated AS path and community by
* route-map. */
bgp_attr_flush(attr);
if (ret == RMAP_DENYMATCH)
return RMAP_DENY;
}
}
return RMAP_PERMIT;
}
Expand Down
10 changes: 5 additions & 5 deletions bgpd/bgp_snmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,17 +487,17 @@ static int write_bgpPeerTable(int action, uint8_t *var_val,
return SNMP_ERR_NOSUCHNAME;
break;
case BGPPEERCONNECTRETRYINTERVAL:
SET_FLAG(peer->config, PEER_CONFIG_CONNECT);
peer_flag_set(peer, PEER_FLAG_TIMER_CONNECT);
peer->connect = intval;
peer->v_connect = intval;
break;
case BGPPEERHOLDTIMECONFIGURED:
SET_FLAG(peer->config, PEER_CONFIG_TIMER);
peer_flag_set(peer, PEER_FLAG_TIMER);
peer->holdtime = intval;
peer->v_holdtime = intval;
break;
case BGPPEERKEEPALIVECONFIGURED:
SET_FLAG(peer->config, PEER_CONFIG_TIMER);
peer_flag_set(peer, PEER_FLAG_TIMER);
peer->keepalive = intval;
peer->v_keepalive = intval;
break;
Expand Down Expand Up @@ -617,14 +617,14 @@ static uint8_t *bgpPeerTable(struct variable *v, oid name[], size_t *length,
break;
case BGPPEERHOLDTIMECONFIGURED:
*write_method = write_bgpPeerTable;
if (PEER_OR_GROUP_TIMER_SET(peer))
if (CHECK_FLAG(peer->flags, PEER_FLAG_TIMER))
return SNMP_INTEGER(peer->holdtime);
else
return SNMP_INTEGER(peer->v_holdtime);
break;
case BGPPEERKEEPALIVECONFIGURED:
*write_method = write_bgpPeerTable;
if (PEER_OR_GROUP_TIMER_SET(peer))
if (CHECK_FLAG(peer->flags, PEER_FLAG_TIMER))
return SNMP_INTEGER(peer->keepalive);
else
return SNMP_INTEGER(peer->v_keepalive);
Expand Down

0 comments on commit ea780a6

Please sign in to comment.