Revert "*: reindent pt. 2"

This reverts commit c14777c6bf.

clang 5 is not widely available enough for people to indent with.  This
is particularly problematic when rebasing/adjusting branches.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
David Lamparter 2017-07-22 14:52:33 +02:00
parent dceb5f8ac7
commit 9d303b37d7
140 changed files with 1570 additions and 1925 deletions

View File

@ -878,8 +878,7 @@ size_t aspath_put(struct stream *s, struct aspath *as, int use32bit)
* The general assumption here is that many things tested will * The general assumption here is that many things tested will
* never happen. And, in real live, up to now, they have not. * never happen. And, in real live, up to now, they have not.
*/ */
while (seg while (seg && (ASSEGMENT_LEN(seg, use32bit)
&& (ASSEGMENT_LEN(seg, use32bit)
<= STREAM_WRITEABLE(s))) { <= STREAM_WRITEABLE(s))) {
struct assegment *next = seg->next; struct assegment *next = seg->next;
int written = 0; int written = 0;
@ -1585,13 +1584,11 @@ int aspath_cmp_left(const struct aspath *aspath1, const struct aspath *aspath2)
return 1; return 1;
/* find first non-confed segments for each */ /* find first non-confed segments for each */
while (seg1 while (seg1 && ((seg1->type == AS_CONFED_SEQUENCE)
&& ((seg1->type == AS_CONFED_SEQUENCE)
|| (seg1->type == AS_CONFED_SET))) || (seg1->type == AS_CONFED_SET)))
seg1 = seg1->next; seg1 = seg1->next;
while (seg2 while (seg2 && ((seg2->type == AS_CONFED_SEQUENCE)
&& ((seg2->type == AS_CONFED_SEQUENCE)
|| (seg2->type == AS_CONFED_SET))) || (seg2->type == AS_CONFED_SET)))
seg2 = seg2->next; seg2 = seg2->next;
@ -2069,8 +2066,7 @@ static void aspath_show_all_iterator(struct hash_backet *backet,
`show [ip] bgp paths' command. */ `show [ip] bgp paths' command. */
void aspath_print_all_vty(struct vty *vty) void aspath_print_all_vty(struct vty *vty)
{ {
hash_iterate(ashash, hash_iterate(ashash, (void (*)(struct hash_backet *,
(void (*)(struct hash_backet *,
void *))aspath_show_all_iterator, void *))aspath_show_all_iterator,
vty); vty);
} }

View File

@ -82,7 +82,8 @@ static const struct message attr_str[] = {
{BGP_ATTR_PREFIX_SID, "PREFIX_SID"}, {BGP_ATTR_PREFIX_SID, "PREFIX_SID"},
{0}}; {0}};
static const struct message attr_flag_str[] = { static const struct message attr_flag_str[] =
{
{BGP_ATTR_FLAG_OPTIONAL, "Optional"}, {BGP_ATTR_FLAG_OPTIONAL, "Optional"},
{BGP_ATTR_FLAG_TRANS, "Transitive"}, {BGP_ATTR_FLAG_TRANS, "Transitive"},
{BGP_ATTR_FLAG_PARTIAL, "Partial"}, {BGP_ATTR_FLAG_PARTIAL, "Partial"},
@ -679,9 +680,8 @@ static void attr_show_all_iterator(struct hash_backet *backet, struct vty *vty)
void attr_show_all(struct vty *vty) void attr_show_all(struct vty *vty)
{ {
hash_iterate( hash_iterate(attrhash, (void (*)(struct hash_backet *,
attrhash, void *))attr_show_all_iterator,
(void (*)(struct hash_backet *, void *))attr_show_all_iterator,
vty); vty);
} }
@ -1093,20 +1093,24 @@ const u_int8_t attr_flags_values[] = {
[BGP_ATTR_MULTI_EXIT_DISC] = BGP_ATTR_FLAG_OPTIONAL, [BGP_ATTR_MULTI_EXIT_DISC] = BGP_ATTR_FLAG_OPTIONAL,
[BGP_ATTR_LOCAL_PREF] = BGP_ATTR_FLAG_TRANS, [BGP_ATTR_LOCAL_PREF] = BGP_ATTR_FLAG_TRANS,
[BGP_ATTR_ATOMIC_AGGREGATE] = BGP_ATTR_FLAG_TRANS, [BGP_ATTR_ATOMIC_AGGREGATE] = BGP_ATTR_FLAG_TRANS,
[BGP_ATTR_AGGREGATOR] = BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL, [BGP_ATTR_AGGREGATOR] =
[BGP_ATTR_COMMUNITIES] = BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL, BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL,
[BGP_ATTR_COMMUNITIES] =
BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL,
[BGP_ATTR_ORIGINATOR_ID] = BGP_ATTR_FLAG_OPTIONAL, [BGP_ATTR_ORIGINATOR_ID] = BGP_ATTR_FLAG_OPTIONAL,
[BGP_ATTR_CLUSTER_LIST] = BGP_ATTR_FLAG_OPTIONAL, [BGP_ATTR_CLUSTER_LIST] = BGP_ATTR_FLAG_OPTIONAL,
[BGP_ATTR_MP_REACH_NLRI] = BGP_ATTR_FLAG_OPTIONAL, [BGP_ATTR_MP_REACH_NLRI] = BGP_ATTR_FLAG_OPTIONAL,
[BGP_ATTR_MP_UNREACH_NLRI] = BGP_ATTR_FLAG_OPTIONAL, [BGP_ATTR_MP_UNREACH_NLRI] = BGP_ATTR_FLAG_OPTIONAL,
[BGP_ATTR_EXT_COMMUNITIES] = [BGP_ATTR_EXT_COMMUNITIES] =
BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS, BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS,
[BGP_ATTR_AS4_PATH] = BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS, [BGP_ATTR_AS4_PATH] =
BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS,
[BGP_ATTR_AS4_AGGREGATOR] = [BGP_ATTR_AS4_AGGREGATOR] =
BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS, BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS,
[BGP_ATTR_LARGE_COMMUNITIES] = [BGP_ATTR_LARGE_COMMUNITIES] =
BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS, BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS,
[BGP_ATTR_PREFIX_SID] = BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS, [BGP_ATTR_PREFIX_SID] =
BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS,
}; };
static const size_t attr_flags_values_max = array_size(attr_flags_values) - 1; static const size_t attr_flags_values_max = array_size(attr_flags_values) - 1;
@ -2751,8 +2755,7 @@ static void bgp_packet_mpattr_tea(struct bgp *bgp, struct peer *peer,
struct bgp_attr_encap_subtlv *st; struct bgp_attr_encap_subtlv *st;
const char *attrname; const char *attrname;
if (!attr if (!attr || (attrtype == BGP_ATTR_ENCAP
|| (attrtype == BGP_ATTR_ENCAP
&& (!attr->encap_tunneltype && (!attr->encap_tunneltype
|| attr->encap_tunneltype == BGP_ENCAP_TYPE_MPLS))) || attr->encap_tunneltype == BGP_ENCAP_TYPE_MPLS)))
return; return;
@ -2801,7 +2804,8 @@ static void bgp_packet_mpattr_tea(struct bgp *bgp, struct peer *peer,
if (attrlenfield > 0xff) { if (attrlenfield > 0xff) {
/* 2-octet length field */ /* 2-octet length field */
stream_putc(s, BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL stream_putc(s,
BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL
| BGP_ATTR_FLAG_EXTLEN); | BGP_ATTR_FLAG_EXTLEN);
stream_putc(s, attrtype); stream_putc(s, attrtype);
stream_putw(s, attrlenfield & 0xffff); stream_putw(s, attrlenfield & 0xffff);
@ -3040,13 +3044,14 @@ bgp_size_t bgp_packet_attribute(struct bgp *bgp, struct peer *peer,
if (CHECK_FLAG(peer->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) if (CHECK_FLAG(peer->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
&& (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_COMMUNITIES))) { && (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_COMMUNITIES))) {
if (attr->community->size * 4 > 255) { if (attr->community->size * 4 > 255) {
stream_putc(s, BGP_ATTR_FLAG_OPTIONAL stream_putc(s,
| BGP_ATTR_FLAG_TRANS BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS
| BGP_ATTR_FLAG_EXTLEN); | BGP_ATTR_FLAG_EXTLEN);
stream_putc(s, BGP_ATTR_COMMUNITIES); stream_putc(s, BGP_ATTR_COMMUNITIES);
stream_putw(s, attr->community->size * 4); stream_putw(s, attr->community->size * 4);
} else { } else {
stream_putc(s, BGP_ATTR_FLAG_OPTIONAL stream_putc(s,
BGP_ATTR_FLAG_OPTIONAL
| BGP_ATTR_FLAG_TRANS); | BGP_ATTR_FLAG_TRANS);
stream_putc(s, BGP_ATTR_COMMUNITIES); stream_putc(s, BGP_ATTR_COMMUNITIES);
stream_putc(s, attr->community->size * 4); stream_putc(s, attr->community->size * 4);
@ -3061,13 +3066,14 @@ bgp_size_t bgp_packet_attribute(struct bgp *bgp, struct peer *peer,
PEER_FLAG_SEND_LARGE_COMMUNITY) PEER_FLAG_SEND_LARGE_COMMUNITY)
&& (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LARGE_COMMUNITIES))) { && (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LARGE_COMMUNITIES))) {
if (attr->lcommunity->size * 12 > 255) { if (attr->lcommunity->size * 12 > 255) {
stream_putc(s, BGP_ATTR_FLAG_OPTIONAL stream_putc(s,
| BGP_ATTR_FLAG_TRANS BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS
| BGP_ATTR_FLAG_EXTLEN); | BGP_ATTR_FLAG_EXTLEN);
stream_putc(s, BGP_ATTR_LARGE_COMMUNITIES); stream_putc(s, BGP_ATTR_LARGE_COMMUNITIES);
stream_putw(s, attr->lcommunity->size * 12); stream_putw(s, attr->lcommunity->size * 12);
} else { } else {
stream_putc(s, BGP_ATTR_FLAG_OPTIONAL stream_putc(s,
BGP_ATTR_FLAG_OPTIONAL
| BGP_ATTR_FLAG_TRANS); | BGP_ATTR_FLAG_TRANS);
stream_putc(s, BGP_ATTR_LARGE_COMMUNITIES); stream_putc(s, BGP_ATTR_LARGE_COMMUNITIES);
stream_putc(s, attr->lcommunity->size * 12); stream_putc(s, attr->lcommunity->size * 12);
@ -3120,13 +3126,15 @@ bgp_size_t bgp_packet_attribute(struct bgp *bgp, struct peer *peer,
if (peer->sort == BGP_PEER_IBGP if (peer->sort == BGP_PEER_IBGP
|| peer->sort == BGP_PEER_CONFED) { || peer->sort == BGP_PEER_CONFED) {
if (attr->ecommunity->size * 8 > 255) { if (attr->ecommunity->size * 8 > 255) {
stream_putc(s, BGP_ATTR_FLAG_OPTIONAL stream_putc(s,
BGP_ATTR_FLAG_OPTIONAL
| BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_TRANS
| BGP_ATTR_FLAG_EXTLEN); | BGP_ATTR_FLAG_EXTLEN);
stream_putc(s, BGP_ATTR_EXT_COMMUNITIES); stream_putc(s, BGP_ATTR_EXT_COMMUNITIES);
stream_putw(s, attr->ecommunity->size * 8); stream_putw(s, attr->ecommunity->size * 8);
} else { } else {
stream_putc(s, BGP_ATTR_FLAG_OPTIONAL stream_putc(s,
BGP_ATTR_FLAG_OPTIONAL
| BGP_ATTR_FLAG_TRANS); | BGP_ATTR_FLAG_TRANS);
stream_putc(s, BGP_ATTR_EXT_COMMUNITIES); stream_putc(s, BGP_ATTR_EXT_COMMUNITIES);
stream_putc(s, attr->ecommunity->size * 8); stream_putc(s, attr->ecommunity->size * 8);
@ -3193,7 +3201,8 @@ bgp_size_t bgp_packet_attribute(struct bgp *bgp, struct peer *peer,
label_index = attr->label_index; label_index = attr->label_index;
if (label_index != BGP_INVALID_LABEL_INDEX) { if (label_index != BGP_INVALID_LABEL_INDEX) {
stream_putc(s, BGP_ATTR_FLAG_OPTIONAL stream_putc(s,
BGP_ATTR_FLAG_OPTIONAL
| BGP_ATTR_FLAG_TRANS); | BGP_ATTR_FLAG_TRANS);
stream_putc(s, BGP_ATTR_PREFIX_SID); stream_putc(s, BGP_ATTR_PREFIX_SID);
stream_putc(s, 10); stream_putc(s, 10);
@ -3222,7 +3231,8 @@ bgp_size_t bgp_packet_attribute(struct bgp *bgp, struct peer *peer,
*/ */
aspath = aspath_delete_confed_seq(aspath); aspath = aspath_delete_confed_seq(aspath);
stream_putc(s, BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL stream_putc(s,
BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL
| BGP_ATTR_FLAG_EXTLEN); | BGP_ATTR_FLAG_EXTLEN);
stream_putc(s, BGP_ATTR_AS4_PATH); stream_putc(s, BGP_ATTR_AS4_PATH);
aspath_sizep = stream_get_endp(s); aspath_sizep = stream_get_endp(s);
@ -3408,13 +3418,14 @@ void bgp_dump_routes_attr(struct stream *s, struct attr *attr,
/* Community attribute. */ /* Community attribute. */
if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_COMMUNITIES)) { if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_COMMUNITIES)) {
if (attr->community->size * 4 > 255) { if (attr->community->size * 4 > 255) {
stream_putc(s, BGP_ATTR_FLAG_OPTIONAL stream_putc(s,
| BGP_ATTR_FLAG_TRANS BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS
| BGP_ATTR_FLAG_EXTLEN); | BGP_ATTR_FLAG_EXTLEN);
stream_putc(s, BGP_ATTR_COMMUNITIES); stream_putc(s, BGP_ATTR_COMMUNITIES);
stream_putw(s, attr->community->size * 4); stream_putw(s, attr->community->size * 4);
} else { } else {
stream_putc(s, BGP_ATTR_FLAG_OPTIONAL stream_putc(s,
BGP_ATTR_FLAG_OPTIONAL
| BGP_ATTR_FLAG_TRANS); | BGP_ATTR_FLAG_TRANS);
stream_putc(s, BGP_ATTR_COMMUNITIES); stream_putc(s, BGP_ATTR_COMMUNITIES);
stream_putc(s, attr->community->size * 4); stream_putc(s, attr->community->size * 4);
@ -3425,13 +3436,14 @@ void bgp_dump_routes_attr(struct stream *s, struct attr *attr,
/* Large Community attribute. */ /* Large Community attribute. */
if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LARGE_COMMUNITIES)) { if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LARGE_COMMUNITIES)) {
if (attr->lcommunity->size * 12 > 255) { if (attr->lcommunity->size * 12 > 255) {
stream_putc(s, BGP_ATTR_FLAG_OPTIONAL stream_putc(s,
| BGP_ATTR_FLAG_TRANS BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS
| BGP_ATTR_FLAG_EXTLEN); | BGP_ATTR_FLAG_EXTLEN);
stream_putc(s, BGP_ATTR_LARGE_COMMUNITIES); stream_putc(s, BGP_ATTR_LARGE_COMMUNITIES);
stream_putw(s, attr->lcommunity->size * 12); stream_putw(s, attr->lcommunity->size * 12);
} else { } else {
stream_putc(s, BGP_ATTR_FLAG_OPTIONAL stream_putc(s,
BGP_ATTR_FLAG_OPTIONAL
| BGP_ATTR_FLAG_TRANS); | BGP_ATTR_FLAG_TRANS);
stream_putc(s, BGP_ATTR_LARGE_COMMUNITIES); stream_putc(s, BGP_ATTR_LARGE_COMMUNITIES);
stream_putc(s, attr->lcommunity->size * 12); stream_putc(s, attr->lcommunity->size * 12);
@ -3477,7 +3489,8 @@ void bgp_dump_routes_attr(struct stream *s, struct attr *attr,
/* Prefix SID */ /* Prefix SID */
if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_PREFIX_SID)) { if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_PREFIX_SID)) {
if (attr->label_index != BGP_INVALID_LABEL_INDEX) { if (attr->label_index != BGP_INVALID_LABEL_INDEX) {
stream_putc(s, BGP_ATTR_FLAG_OPTIONAL stream_putc(s,
BGP_ATTR_FLAG_OPTIONAL
| BGP_ATTR_FLAG_TRANS); | BGP_ATTR_FLAG_TRANS);
stream_putc(s, BGP_ATTR_PREFIX_SID); stream_putc(s, BGP_ATTR_PREFIX_SID);
stream_putc(s, 10); stream_putc(s, 10);

View File

@ -212,8 +212,7 @@ static void bgp_bfd_update_type(struct peer *peer)
if ((multihop if ((multihop
&& !CHECK_FLAG(bfd_info->flags, && !CHECK_FLAG(bfd_info->flags,
BFD_FLAG_BFD_TYPE_MULTIHOP)) BFD_FLAG_BFD_TYPE_MULTIHOP))
|| (!multihop || (!multihop && CHECK_FLAG(bfd_info->flags,
&& CHECK_FLAG(bfd_info->flags,
BFD_FLAG_BFD_TYPE_MULTIHOP))) { BFD_FLAG_BFD_TYPE_MULTIHOP))) {
bgp_bfd_peer_sendmsg(peer, ZEBRA_BFD_DEST_DEREGISTER); bgp_bfd_peer_sendmsg(peer, ZEBRA_BFD_DEST_DEREGISTER);
bgp_bfd_peer_sendmsg(peer, ZEBRA_BFD_DEST_REGISTER); bgp_bfd_peer_sendmsg(peer, ZEBRA_BFD_DEST_REGISTER);

View File

@ -36,9 +36,7 @@
/* privileges */ /* privileges */
static zebra_capabilities_t _caps_p[] = { static zebra_capabilities_t _caps_p[] = {
ZCAP_BIND, ZCAP_BIND, ZCAP_NET_RAW, ZCAP_NET_ADMIN,
ZCAP_NET_RAW,
ZCAP_NET_ADMIN,
}; };
struct zebra_privs_t bgpd_privs = { struct zebra_privs_t bgpd_privs = {

View File

@ -369,8 +369,9 @@ static void bgp_damp_parameter_set(int hlife, int reuse, int sup, int maxsup)
/* Initialize params per bgp_damp_config. */ /* Initialize params per bgp_damp_config. */
damp->reuse_index_size = REUSE_ARRAY_SIZE; damp->reuse_index_size = REUSE_ARRAY_SIZE;
damp->ceiling = (int)(damp->reuse_limit damp->ceiling =
* (pow(2, (double)damp->max_suppress_time (int)(damp->reuse_limit * (pow(2,
(double)damp->max_suppress_time
/ damp->half_life))); / damp->half_life)));
/* Decay-array computations */ /* Decay-array computations */
@ -413,10 +414,8 @@ static void bgp_damp_parameter_set(int hlife, int reuse, int sup, int maxsup)
for (i = 0; i < damp->reuse_index_size; i++) { for (i = 0; i < damp->reuse_index_size; i++) {
damp->reuse_index[i] = damp->reuse_index[i] =
(int)(((double)damp->half_life / DELTA_REUSE) (int)(((double)damp->half_life / DELTA_REUSE)
* log10(1.0 * log10(1.0 / (damp->reuse_limit
/ (damp->reuse_limit * (1.0 + ((double)i
* (1.0
+ ((double)i
/ damp->scale_factor)))) / damp->scale_factor))))
/ log10(0.5)); / log10(0.5));
} }

View File

@ -244,7 +244,8 @@ static void bgp_dump_routes_index_table(struct bgp *bgp)
/* Populate fake peer at index 0, for locally originated routes */ /* Populate fake peer at index 0, for locally originated routes */
/* Peer type (IPv4) */ /* Peer type (IPv4) */
stream_putc(obuf, TABLE_DUMP_V2_PEER_INDEX_TABLE_AS4 stream_putc(obuf,
TABLE_DUMP_V2_PEER_INDEX_TABLE_AS4
+ TABLE_DUMP_V2_PEER_INDEX_TABLE_IP); + TABLE_DUMP_V2_PEER_INDEX_TABLE_IP);
/* Peer BGP ID (0.0.0.0) */ /* Peer BGP ID (0.0.0.0) */
stream_putl(obuf, 0); stream_putl(obuf, 0);

View File

@ -2718,9 +2718,8 @@ int bgp_evpn_local_vni_add(struct bgp *bgp, vni_t vni,
*/ */
void bgp_evpn_cleanup_on_disable(struct bgp *bgp) void bgp_evpn_cleanup_on_disable(struct bgp *bgp)
{ {
hash_iterate( hash_iterate(bgp->vnihash, (void (*)(struct hash_backet *,
bgp->vnihash, void *))cleanup_vni_on_disable,
(void (*)(struct hash_backet *, void *))cleanup_vni_on_disable,
bgp); bgp);
} }
@ -2731,9 +2730,8 @@ void bgp_evpn_cleanup_on_disable(struct bgp *bgp)
void bgp_evpn_cleanup(struct bgp *bgp) void bgp_evpn_cleanup(struct bgp *bgp)
{ {
if (bgp->vnihash) if (bgp->vnihash)
hash_iterate( hash_iterate(bgp->vnihash, (void (*)(struct hash_backet *,
bgp->vnihash, void *))free_vni_entry,
(void (*)(struct hash_backet *, void *))free_vni_entry,
bgp); bgp);
if (bgp->import_rt_hash) if (bgp->import_rt_hash)
hash_free(bgp->import_rt_hash); hash_free(bgp->import_rt_hash);

View File

@ -1301,9 +1301,8 @@ static void evpn_show_routes_vni_all(struct vty *vty, struct bgp *bgp,
wctx.bgp = bgp; wctx.bgp = bgp;
wctx.vty = vty; wctx.vty = vty;
wctx.vtep_ip = vtep_ip; wctx.vtep_ip = vtep_ip;
hash_iterate( hash_iterate(bgp->vnihash, (void (*)(struct hash_backet *,
bgp->vnihash, void *))show_vni_routes_hash,
(void (*)(struct hash_backet *, void *))show_vni_routes_hash,
&wctx); &wctx);
} }

View File

@ -1394,7 +1394,8 @@ static int bgp_establish(struct peer *peer)
} }
if (other == peer) if (other == peer)
ret = 1; /* bgp_establish specific code when xfer_conn ret =
1; /* bgp_establish specific code when xfer_conn
happens. */ happens. */
/* Reset capability open status flag. */ /* Reset capability open status flag. */

View File

@ -101,9 +101,7 @@ static int retain_mode = 0;
/* privileges */ /* privileges */
static zebra_capabilities_t _caps_p[] = { static zebra_capabilities_t _caps_p[] = {
ZCAP_BIND, ZCAP_BIND, ZCAP_NET_RAW, ZCAP_NET_ADMIN,
ZCAP_NET_RAW,
ZCAP_NET_ADMIN,
}; };
struct zebra_privs_t bgpd_privs = { struct zebra_privs_t bgpd_privs = {

View File

@ -675,8 +675,7 @@ void bgp_info_mpath_aggregate_update(struct bgp_info *new_best,
bgp_attr_dup(&attr, new_best->attr); bgp_attr_dup(&attr, new_best->attr);
if (new_best->peer if (new_best->peer && bgp_flag_check(new_best->peer->bgp,
&& bgp_flag_check(new_best->peer->bgp,
BGP_FLAG_MULTIPATH_RELAX_AS_SET)) { BGP_FLAG_MULTIPATH_RELAX_AS_SET)) {
/* aggregate attribute from multipath constituents */ /* aggregate attribute from multipath constituents */

View File

@ -612,8 +612,7 @@ int bgp_show_mpls_vpn(struct vty *vty, afi_t afi, struct prefix_rd *prd,
if (use_json) { if (use_json) {
json_object_object_add(json, "routes", json_nroute); json_object_object_add(json, "routes", json_nroute);
vty_out(vty, "%s\n", vty_out(vty, "%s\n", json_object_to_json_string_ext(
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} else { } else {

View File

@ -158,9 +158,8 @@ int bgp_set_socket_ttl(struct peer *peer, int bgp_sock)
if (ret) { if (ret) {
zlog_err( zlog_err(
"%s: Can't set TxTTL on peer (rtrid %s) socket, err = %d", "%s: Can't set TxTTL on peer (rtrid %s) socket, err = %d",
__func__, __func__, inet_ntop(AF_INET, &peer->remote_id,
inet_ntop(AF_INET, &peer->remote_id, buf, buf, sizeof(buf)),
sizeof(buf)),
errno); errno);
return ret; return ret;
} }
@ -173,9 +172,8 @@ int bgp_set_socket_ttl(struct peer *peer, int bgp_sock)
if (ret) { if (ret) {
zlog_err( zlog_err(
"%s: Can't set TxTTL on peer (rtrid %s) socket, err = %d", "%s: Can't set TxTTL on peer (rtrid %s) socket, err = %d",
__func__, __func__, inet_ntop(AF_INET, &peer->remote_id,
inet_ntop(AF_INET, &peer->remote_id, buf, buf, sizeof(buf)),
sizeof(buf)),
errno); errno);
return ret; return ret;
} }
@ -184,9 +182,8 @@ int bgp_set_socket_ttl(struct peer *peer, int bgp_sock)
if (ret) { if (ret) {
zlog_err( zlog_err(
"%s: Can't set MinTTL on peer (rtrid %s) socket, err = %d", "%s: Can't set MinTTL on peer (rtrid %s) socket, err = %d",
__func__, __func__, inet_ntop(AF_INET, &peer->remote_id,
inet_ntop(AF_INET, &peer->remote_id, buf, buf, sizeof(buf)),
sizeof(buf)),
errno); errno);
return ret; return ret;
} }

View File

@ -764,12 +764,18 @@ static const size_t cap_minsizes[] = {
* table should be set to 1. * table should be set to 1.
*/ */
static const size_t cap_modsizes[] = { static const size_t cap_modsizes[] = {
[CAPABILITY_CODE_MP] = 4, [CAPABILITY_CODE_REFRESH] = 1, [CAPABILITY_CODE_MP] = 4,
[CAPABILITY_CODE_ORF] = 1, [CAPABILITY_CODE_RESTART] = 1, [CAPABILITY_CODE_REFRESH] = 1,
[CAPABILITY_CODE_AS4] = 4, [CAPABILITY_CODE_ADDPATH] = 4, [CAPABILITY_CODE_ORF] = 1,
[CAPABILITY_CODE_DYNAMIC] = 1, [CAPABILITY_CODE_DYNAMIC_OLD] = 1, [CAPABILITY_CODE_RESTART] = 1,
[CAPABILITY_CODE_ENHE] = 6, [CAPABILITY_CODE_REFRESH_OLD] = 1, [CAPABILITY_CODE_AS4] = 4,
[CAPABILITY_CODE_ORF_OLD] = 1, [CAPABILITY_CODE_FQDN] = 1, [CAPABILITY_CODE_ADDPATH] = 4,
[CAPABILITY_CODE_DYNAMIC] = 1,
[CAPABILITY_CODE_DYNAMIC_OLD] = 1,
[CAPABILITY_CODE_ENHE] = 6,
[CAPABILITY_CODE_REFRESH_OLD] = 1,
[CAPABILITY_CODE_ORF_OLD] = 1,
[CAPABILITY_CODE_FQDN] = 1,
}; };
/** /**
@ -1309,7 +1315,8 @@ void bgp_open_capability(struct stream *s, struct peer *peer)
*/ */
SET_FLAG(peer->cap, PEER_CAP_ENHE_ADV); SET_FLAG(peer->cap, PEER_CAP_ENHE_ADV);
stream_putc(s, BGP_OPEN_OPT_CAP); stream_putc(s, BGP_OPEN_OPT_CAP);
stream_putc(s, CAPABILITY_CODE_ENHE_LEN stream_putc(s,
CAPABILITY_CODE_ENHE_LEN
+ 2); + 2);
stream_putc(s, CAPABILITY_CODE_ENHE); stream_putc(s, CAPABILITY_CODE_ENHE);
stream_putc(s, stream_putc(s,

View File

@ -547,7 +547,8 @@ void bgp_open_send(struct peer *peer)
/* Set open packet values. */ /* Set open packet values. */
stream_putc(s, BGP_VERSION_4); /* BGP version */ stream_putc(s, BGP_VERSION_4); /* BGP version */
stream_putw(s, (local_as <= BGP_AS_MAX) ? (u_int16_t)local_as stream_putw(s,
(local_as <= BGP_AS_MAX) ? (u_int16_t)local_as
: BGP_AS_TRANS); : BGP_AS_TRANS);
stream_putw(s, send_holdtime); /* Hold Time */ stream_putw(s, send_holdtime); /* Hold Time */
stream_put_in_addr(s, &peer->local_id); /* BGP Identifier */ stream_put_in_addr(s, &peer->local_id); /* BGP Identifier */

View File

@ -1916,8 +1916,7 @@ int subgroup_process_announce_selected(struct update_subgroup *subgrp,
: NULL); : NULL);
/* First update is deferred until ORF or ROUTE-REFRESH is received */ /* First update is deferred until ORF or ROUTE-REFRESH is received */
if (onlypeer if (onlypeer && CHECK_FLAG(onlypeer->af_sflags[afi][safi],
&& CHECK_FLAG(onlypeer->af_sflags[afi][safi],
PEER_STATUS_ORF_WAIT_REFRESH)) PEER_STATUS_ORF_WAIT_REFRESH))
return 0; return 0;
@ -5210,16 +5209,14 @@ DEFUN (no_bgp_network_mask_natural,
} }
ALIAS(no_bgp_network, no_bgp_network_label_index_cmd, ALIAS(no_bgp_network, no_bgp_network_label_index_cmd,
"no network A.B.C.D/M label-index (0-1048560)", "no network A.B.C.D/M label-index (0-1048560)", NO_STR
NO_STR
"Specify a network to announce via BGP\n" "Specify a network to announce via BGP\n"
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
"Label index to associate with the prefix\n" "Label index to associate with the prefix\n"
"Label index value\n") "Label index value\n")
ALIAS(no_bgp_network, no_bgp_network_label_index_route_map_cmd, ALIAS(no_bgp_network, no_bgp_network_label_index_route_map_cmd,
"no network A.B.C.D/M label-index (0-1048560) route-map WORD", "no network A.B.C.D/M label-index (0-1048560) route-map WORD", NO_STR
NO_STR
"Specify a network to announce via BGP\n" "Specify a network to announce via BGP\n"
"IP prefix\n" "IP prefix\n"
"Label index to associate with the prefix\n" "Label index to associate with the prefix\n"
@ -5301,16 +5298,14 @@ DEFUN (no_ipv6_bgp_network,
} }
ALIAS(no_ipv6_bgp_network, no_ipv6_bgp_network_label_index_cmd, ALIAS(no_ipv6_bgp_network, no_ipv6_bgp_network_label_index_cmd,
"no network X:X::X:X/M label-index (0-1048560)", "no network X:X::X:X/M label-index (0-1048560)", NO_STR
NO_STR
"Specify a network to announce via BGP\n" "Specify a network to announce via BGP\n"
"IPv6 prefix <network>/<length>\n" "IPv6 prefix <network>/<length>\n"
"Label index to associate with the prefix\n" "Label index to associate with the prefix\n"
"Label index value\n") "Label index value\n")
ALIAS(no_ipv6_bgp_network, no_ipv6_bgp_network_label_index_route_map_cmd, ALIAS(no_ipv6_bgp_network, no_ipv6_bgp_network_label_index_route_map_cmd,
"no network X:X::X:X/M label-index (0-1048560) route-map WORD", "no network X:X::X:X/M label-index (0-1048560) route-map WORD", NO_STR
NO_STR
"Specify a network to announce via BGP\n" "Specify a network to announce via BGP\n"
"IPv6 prefix\n" "IPv6 prefix\n"
"Label index to associate with the prefix\n" "Label index to associate with the prefix\n"
@ -6510,7 +6505,8 @@ void route_vty_out(struct vty *vty, struct prefix *p, struct bgp_info *binfo,
len = vty_out( len = vty_out(
vty, "%s", vty, "%s",
binfo->peer->conf_if); binfo->peer->conf_if);
len = 7 - len; /* len of IPv6 len =
7 - len; /* len of IPv6
addr + max addr + max
len of def len of def
ifname */ ifname */
@ -7000,10 +6996,9 @@ static void damp_route_vty_out(struct vty *vty, struct prefix *p,
bgp_damp_reuse_time_vty(vty, binfo, timebuf, BGP_UPTIME_LEN, bgp_damp_reuse_time_vty(vty, binfo, timebuf, BGP_UPTIME_LEN,
use_json, json); use_json, json);
else else
vty_out(vty, "%s ", vty_out(vty, "%s ", bgp_damp_reuse_time_vty(vty, binfo, timebuf,
bgp_damp_reuse_time_vty(vty, binfo, timebuf, BGP_UPTIME_LEN,
BGP_UPTIME_LEN, use_json, use_json, json));
json));
/* Print attribute */ /* Print attribute */
attr = binfo->attr; attr = binfo->attr;
@ -7082,9 +7077,8 @@ static void flap_route_vty_out(struct vty *vty, struct prefix *p,
peer_uptime(bdi->start_time, timebuf, BGP_UPTIME_LEN, use_json, peer_uptime(bdi->start_time, timebuf, BGP_UPTIME_LEN, use_json,
json); json);
else else
vty_out(vty, "%s ", vty_out(vty, "%s ", peer_uptime(bdi->start_time, timebuf,
peer_uptime(bdi->start_time, timebuf, BGP_UPTIME_LEN, 0, BGP_UPTIME_LEN, 0, NULL));
NULL));
if (CHECK_FLAG(binfo->flags, BGP_INFO_DAMPED) if (CHECK_FLAG(binfo->flags, BGP_INFO_DAMPED)
&& !CHECK_FLAG(binfo->flags, BGP_INFO_HISTORY)) { && !CHECK_FLAG(binfo->flags, BGP_INFO_HISTORY)) {
@ -8604,8 +8598,7 @@ static int bgp_show_route_in_table(struct vty *vty, struct bgp *bgp,
if (display) if (display)
json_object_object_add(json, "paths", json_paths); json_object_object_add(json, "paths", json_paths);
vty_out(vty, "%s\n", vty_out(vty, "%s\n", json_object_to_json_string_ext(
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} else { } else {
@ -9280,7 +9273,8 @@ static const char *table_stats_strs[] = {
[BGP_STATS_TOTPLEN] = "Average prefix length", [BGP_STATS_TOTPLEN] = "Average prefix length",
[BGP_STATS_RIB] = "Total Advertisements", [BGP_STATS_RIB] = "Total Advertisements",
[BGP_STATS_UNAGGREGATEABLE] = "Unaggregateable prefixes", [BGP_STATS_UNAGGREGATEABLE] = "Unaggregateable prefixes",
[BGP_STATS_MAX_AGGREGATEABLE] = "Maximum aggregateable prefixes", [BGP_STATS_MAX_AGGREGATEABLE] =
"Maximum aggregateable prefixes",
[BGP_STATS_AGGREGATES] = "BGP Aggregate advertisements", [BGP_STATS_AGGREGATES] = "BGP Aggregate advertisements",
[BGP_STATS_SPACE] = "Address space advertised", [BGP_STATS_SPACE] = "Address space advertised",
[BGP_STATS_ASPATH_COUNT] = "Advertisements with paths", [BGP_STATS_ASPATH_COUNT] = "Advertisements with paths",
@ -9524,11 +9518,16 @@ enum bgp_pcounts {
}; };
static const char *pcount_strs[] = { static const char *pcount_strs[] = {
[PCOUNT_ADJ_IN] = "Adj-in", [PCOUNT_DAMPED] = "Damped", [PCOUNT_ADJ_IN] = "Adj-in",
[PCOUNT_REMOVED] = "Removed", [PCOUNT_HISTORY] = "History", [PCOUNT_DAMPED] = "Damped",
[PCOUNT_STALE] = "Stale", [PCOUNT_VALID] = "Valid", [PCOUNT_REMOVED] = "Removed",
[PCOUNT_ALL] = "All RIB", [PCOUNT_COUNTED] = "PfxCt counted", [PCOUNT_HISTORY] = "History",
[PCOUNT_PFCNT] = "Useable", [PCOUNT_MAX] = NULL, [PCOUNT_STALE] = "Stale",
[PCOUNT_VALID] = "Valid",
[PCOUNT_ALL] = "All RIB",
[PCOUNT_COUNTED] = "PfxCt counted",
[PCOUNT_PFCNT] = "Useable",
[PCOUNT_MAX] = NULL,
}; };
struct peer_pcounts { struct peer_pcounts {
@ -9888,8 +9887,7 @@ static void show_adj_route(struct vty *vty, struct peer *peer, afi_t afi,
"bgpOriginatingDefaultNetwork", "bgpOriginatingDefaultNetwork",
"0.0.0.0"); "0.0.0.0");
} else { } else {
vty_out(vty, vty_out(vty, "BGP table version is %" PRIu64
"BGP table version is %" PRIu64
", local router ID is %s\n", ", local router ID is %s\n",
table->version, inet_ntoa(bgp->router_id)); table->version, inet_ntoa(bgp->router_id));
vty_out(vty, BGP_SHOW_SCODE_HEADER); vty_out(vty, BGP_SHOW_SCODE_HEADER);

View File

@ -97,7 +97,9 @@ struct bgp_info_extra {
struct in6_addr addr6; struct in6_addr addr6;
} un; /* cached un address */ } un; /* cached un address */
time_t create_time; time_t create_time;
struct prefix aux_prefix; /* AFI_L2VPN: the IP addr, struct
prefix
aux_prefix; /* AFI_L2VPN: the IP addr,
if family set */ if family set */
} import; } import;

View File

@ -652,10 +652,7 @@ static route_map_result_t route_match_metric(void *rule, struct prefix *prefix,
/* Route map commands for metric matching. */ /* Route map commands for metric matching. */
struct route_map_rule_cmd route_match_metric_cmd = { struct route_map_rule_cmd route_match_metric_cmd = {
"metric", "metric", route_match_metric, route_value_compile, route_value_free,
route_match_metric,
route_value_compile,
route_value_free,
}; };
/* `match as-path ASPATH' */ /* `match as-path ASPATH' */
@ -1050,9 +1047,7 @@ static route_map_result_t route_match_tag(void *rule, struct prefix *prefix,
/* Route map commands for tag matching. */ /* Route map commands for tag matching. */
static struct route_map_rule_cmd route_match_tag_cmd = { static struct route_map_rule_cmd route_match_tag_cmd = {
"tag", "tag", route_match_tag, route_map_rule_tag_compile,
route_match_tag,
route_map_rule_tag_compile,
route_map_rule_tag_free, route_map_rule_tag_free,
}; };
@ -1197,9 +1192,7 @@ static route_map_result_t route_set_local_pref(void *rule,
/* Set local preference rule structure. */ /* Set local preference rule structure. */
struct route_map_rule_cmd route_set_local_pref_cmd = { struct route_map_rule_cmd route_set_local_pref_cmd = {
"local-preference", "local-preference", route_set_local_pref, route_value_compile,
route_set_local_pref,
route_value_compile,
route_value_free, route_value_free,
}; };
@ -1228,10 +1221,7 @@ static route_map_result_t route_set_weight(void *rule, struct prefix *prefix,
/* Set local preference rule structure. */ /* Set local preference rule structure. */
struct route_map_rule_cmd route_set_weight_cmd = { struct route_map_rule_cmd route_set_weight_cmd = {
"weight", "weight", route_set_weight, route_value_compile, route_value_free,
route_set_weight,
route_value_compile,
route_value_free,
}; };
/* `set metric METRIC' */ /* `set metric METRIC' */
@ -1263,10 +1253,7 @@ static route_map_result_t route_set_metric(void *rule, struct prefix *prefix,
/* Set metric rule structure. */ /* Set metric rule structure. */
struct route_map_rule_cmd route_set_metric_cmd = { struct route_map_rule_cmd route_set_metric_cmd = {
"metric", "metric", route_set_metric, route_value_compile, route_value_free,
route_set_metric,
route_value_compile,
route_value_free,
}; };
/* `set as-path prepend ASPATH' */ /* `set as-path prepend ASPATH' */
@ -1324,10 +1311,8 @@ static void route_set_aspath_prepend_free(void *rule)
/* Set as-path prepend rule structure. */ /* Set as-path prepend rule structure. */
struct route_map_rule_cmd route_set_aspath_prepend_cmd = { struct route_map_rule_cmd route_set_aspath_prepend_cmd = {
"as-path prepend", "as-path prepend", route_set_aspath_prepend,
route_set_aspath_prepend, route_set_aspath_prepend_compile, route_set_aspath_prepend_free,
route_set_aspath_prepend_compile,
route_set_aspath_prepend_free,
}; };
/* `set as-path exclude ASn' */ /* `set as-path exclude ASn' */
@ -1360,9 +1345,7 @@ static route_map_result_t route_set_aspath_exclude(void *rule,
/* Set ASn exlude rule structure. */ /* Set ASn exlude rule structure. */
struct route_map_rule_cmd route_set_aspath_exclude_cmd = { struct route_map_rule_cmd route_set_aspath_exclude_cmd = {
"as-path exclude", "as-path exclude", route_set_aspath_exclude, route_aspath_compile,
route_set_aspath_exclude,
route_aspath_compile,
route_aspath_free, route_aspath_free,
}; };
@ -1475,9 +1458,7 @@ static void route_set_community_free(void *rule)
/* Set community rule structure. */ /* Set community rule structure. */
struct route_map_rule_cmd route_set_community_cmd = { struct route_map_rule_cmd route_set_community_cmd = {
"community", "community", route_set_community, route_set_community_compile,
route_set_community,
route_set_community_compile,
route_set_community_free, route_set_community_free,
}; };
@ -1595,9 +1576,7 @@ static void route_set_lcommunity_free(void *rule)
/* Set community rule structure. */ /* Set community rule structure. */
struct route_map_rule_cmd route_set_lcommunity_cmd = { struct route_map_rule_cmd route_set_lcommunity_cmd = {
"large-community", "large-community", route_set_lcommunity, route_set_lcommunity_compile,
route_set_lcommunity,
route_set_lcommunity_compile,
route_set_lcommunity_free, route_set_lcommunity_free,
}; };
@ -1680,10 +1659,8 @@ static void route_set_lcommunity_delete_free(void *rule)
/* Set lcommunity rule structure. */ /* Set lcommunity rule structure. */
struct route_map_rule_cmd route_set_lcommunity_delete_cmd = { struct route_map_rule_cmd route_set_lcommunity_delete_cmd = {
"large-comm-list", "large-comm-list", route_set_lcommunity_delete,
route_set_lcommunity_delete, route_set_lcommunity_delete_compile, route_set_lcommunity_delete_free,
route_set_lcommunity_delete_compile,
route_set_lcommunity_delete_free,
}; };
@ -1766,10 +1743,8 @@ static void route_set_community_delete_free(void *rule)
/* Set community rule structure. */ /* Set community rule structure. */
struct route_map_rule_cmd route_set_community_delete_cmd = { struct route_map_rule_cmd route_set_community_delete_cmd = {
"comm-list", "comm-list", route_set_community_delete,
route_set_community_delete, route_set_community_delete_compile, route_set_community_delete_free,
route_set_community_delete_compile,
route_set_community_delete_free,
}; };
/* `set extcommunity rt COMMUNITY' */ /* `set extcommunity rt COMMUNITY' */
@ -1836,10 +1811,8 @@ static void route_set_ecommunity_free(void *rule)
/* Set community rule structure. */ /* Set community rule structure. */
struct route_map_rule_cmd route_set_ecommunity_rt_cmd = { struct route_map_rule_cmd route_set_ecommunity_rt_cmd = {
"extcommunity rt", "extcommunity rt", route_set_ecommunity,
route_set_ecommunity, route_set_ecommunity_rt_compile, route_set_ecommunity_free,
route_set_ecommunity_rt_compile,
route_set_ecommunity_free,
}; };
/* `set extcommunity soo COMMUNITY' */ /* `set extcommunity soo COMMUNITY' */
@ -1858,10 +1831,8 @@ static void *route_set_ecommunity_soo_compile(const char *arg)
/* Set community rule structure. */ /* Set community rule structure. */
struct route_map_rule_cmd route_set_ecommunity_soo_cmd = { struct route_map_rule_cmd route_set_ecommunity_soo_cmd = {
"extcommunity soo", "extcommunity soo", route_set_ecommunity,
route_set_ecommunity, route_set_ecommunity_soo_compile, route_set_ecommunity_free,
route_set_ecommunity_soo_compile,
route_set_ecommunity_free,
}; };
/* `set origin ORIGIN' */ /* `set origin ORIGIN' */
@ -1909,9 +1880,7 @@ static void route_set_origin_free(void *rule)
/* Set origin rule structure. */ /* Set origin rule structure. */
struct route_map_rule_cmd route_set_origin_cmd = { struct route_map_rule_cmd route_set_origin_cmd = {
"origin", "origin", route_set_origin, route_set_origin_compile,
route_set_origin,
route_set_origin_compile,
route_set_origin_free, route_set_origin_free,
}; };
@ -1948,10 +1917,8 @@ static void route_set_atomic_aggregate_free(void *rule)
/* Set atomic aggregate rule structure. */ /* Set atomic aggregate rule structure. */
struct route_map_rule_cmd route_set_atomic_aggregate_cmd = { struct route_map_rule_cmd route_set_atomic_aggregate_cmd = {
"atomic-aggregate", "atomic-aggregate", route_set_atomic_aggregate,
route_set_atomic_aggregate, route_set_atomic_aggregate_compile, route_set_atomic_aggregate_free,
route_set_atomic_aggregate_compile,
route_set_atomic_aggregate_free,
}; };
/* `set aggregator as AS A.B.C.D' */ /* `set aggregator as AS A.B.C.D' */
@ -2006,10 +1973,8 @@ static void route_set_aggregator_as_free(void *rule)
} }
struct route_map_rule_cmd route_set_aggregator_as_cmd = { struct route_map_rule_cmd route_set_aggregator_as_cmd = {
"aggregator as", "aggregator as", route_set_aggregator_as,
route_set_aggregator_as, route_set_aggregator_as_compile, route_set_aggregator_as_free,
route_set_aggregator_as_compile,
route_set_aggregator_as_free,
}; };
/* Set tag to object. object must be pointer to struct bgp_info */ /* Set tag to object. object must be pointer to struct bgp_info */
@ -2032,9 +1997,7 @@ static route_map_result_t route_set_tag(void *rule, struct prefix *prefix,
/* Route map commands for tag set. */ /* Route map commands for tag set. */
static struct route_map_rule_cmd route_set_tag_cmd = { static struct route_map_rule_cmd route_set_tag_cmd = {
"tag", "tag", route_set_tag, route_map_rule_tag_compile,
route_set_tag,
route_map_rule_tag_compile,
route_map_rule_tag_free, route_map_rule_tag_free,
}; };
@ -2067,9 +2030,7 @@ static route_map_result_t route_set_label_index(void *rule,
/* Route map commands for label-index set. */ /* Route map commands for label-index set. */
static struct route_map_rule_cmd route_set_label_index_cmd = { static struct route_map_rule_cmd route_set_label_index_cmd = {
"label-index", "label-index", route_set_label_index, route_value_compile,
route_set_label_index,
route_value_compile,
route_value_free, route_value_free,
}; };
@ -2596,10 +2557,8 @@ static void route_set_originator_id_free(void *rule)
/* Set originator-id rule structure. */ /* Set originator-id rule structure. */
struct route_map_rule_cmd route_set_originator_id_cmd = { struct route_map_rule_cmd route_set_originator_id_cmd = {
"originator-id", "originator-id", route_set_originator_id,
route_set_originator_id, route_set_originator_id_compile, route_set_originator_id_free,
route_set_originator_id_compile,
route_set_originator_id_free,
}; };
/* Add bgp route map rule. */ /* Add bgp route map rule. */

View File

@ -864,6 +864,8 @@ static u_char *bgp4PathAttrTable(struct variable *v, oid name[], size_t *length,
return SNMP_INTEGER(-1); return SNMP_INTEGER(-1);
break; break;
case BGP4PATHATTRBEST: /* 13 */ case BGP4PATHATTRBEST: /* 13 */
/* $FRR indent$ */
/* clang-format off */
#define BGP4_PathAttrBest_false 1 #define BGP4_PathAttrBest_false 1
#define BGP4_PathAttrBest_true 2 #define BGP4_PathAttrBest_true 2
if (CHECK_FLAG(binfo->flags, BGP_INFO_SELECTED)) if (CHECK_FLAG(binfo->flags, BGP_INFO_SELECTED))

View File

@ -267,6 +267,7 @@ struct update_subgroup {
*/ */
#define SUBGRP_DECR_STAT(subgrp, stat) SUBGRP_INCR_STAT_BY(subgrp, stat, -1) #define SUBGRP_DECR_STAT(subgrp, stat) SUBGRP_INCR_STAT_BY(subgrp, stat, -1)
typedef int (*updgrp_walkcb)(struct update_group *updgrp, void *ctx); typedef int (*updgrp_walkcb)(struct update_group *updgrp, void *ctx);
/* really a private structure */ /* really a private structure */

View File

@ -646,8 +646,7 @@ void subgroup_announce_route(struct update_subgroup *subgrp)
*/ */
onlypeer = ((SUBGRP_PCOUNT(subgrp) == 1) ? (SUBGRP_PFIRST(subgrp))->peer onlypeer = ((SUBGRP_PCOUNT(subgrp) == 1) ? (SUBGRP_PFIRST(subgrp))->peer
: NULL); : NULL);
if (onlypeer if (onlypeer && CHECK_FLAG(onlypeer->af_sflags[SUBGRP_AFI(subgrp)]
&& CHECK_FLAG(onlypeer->af_sflags[SUBGRP_AFI(subgrp)]
[SUBGRP_SAFI(subgrp)], [SUBGRP_SAFI(subgrp)],
PEER_STATUS_ORF_WAIT_REFRESH)) PEER_STATUS_ORF_WAIT_REFRESH))
return; return;

View File

@ -732,9 +732,8 @@ struct bpacket *subgroup_update_packet(struct update_subgroup *subgrp)
space_remaining = STREAM_CONCAT_REMAIN(s, snlri, STREAM_SIZE(s)) space_remaining = STREAM_CONCAT_REMAIN(s, snlri, STREAM_SIZE(s))
- BGP_MAX_PACKET_SIZE_OVERFLOW; - BGP_MAX_PACKET_SIZE_OVERFLOW;
space_needed = space_needed = BGP_NLRI_LENGTH + bgp_packet_mpattr_prefix_size(
BGP_NLRI_LENGTH afi, safi, &rn->p);
+ bgp_packet_mpattr_prefix_size(afi, safi, &rn->p);
/* When remaining space can't include NLRI and it's length. */ /* When remaining space can't include NLRI and it's length. */
if (space_remaining < space_needed) if (space_remaining < space_needed)
@ -778,8 +777,8 @@ struct bpacket *subgroup_update_packet(struct update_subgroup *subgrp)
space_remaining = space_remaining =
STREAM_CONCAT_REMAIN(s, snlri, STREAM_SIZE(s)) STREAM_CONCAT_REMAIN(s, snlri, STREAM_SIZE(s))
- BGP_MAX_PACKET_SIZE_OVERFLOW; - BGP_MAX_PACKET_SIZE_OVERFLOW;
space_needed = BGP_NLRI_LENGTH space_needed =
+ bgp_packet_mpattr_prefix_size( BGP_NLRI_LENGTH + bgp_packet_mpattr_prefix_size(
afi, safi, &rn->p); afi, safi, &rn->p);
/* If the attributes alone do not leave any room for /* If the attributes alone do not leave any room for

View File

@ -242,8 +242,7 @@ int show_adj_route_vpn(struct vty *vty, struct peer *peer,
} }
if (use_json) { if (use_json) {
json_object_object_add(json, "routes", json_routes); json_object_object_add(json, "routes", json_routes);
vty_out(vty, "%s\n", vty_out(vty, "%s\n", json_object_to_json_string_ext(
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} }

View File

@ -1470,8 +1470,7 @@ DEFUN (no_bgp_maxpaths,
} }
ALIAS_HIDDEN(no_bgp_maxpaths, no_bgp_maxpaths_hidden_cmd, ALIAS_HIDDEN(no_bgp_maxpaths, no_bgp_maxpaths_hidden_cmd,
"no maximum-paths [" CMD_RANGE_STR(1, MULTIPATH_NUM) "]", "no maximum-paths [" CMD_RANGE_STR(1, MULTIPATH_NUM) "]", NO_STR
NO_STR
"Forward packets over multiple paths\n" "Forward packets over multiple paths\n"
"Number of paths\n") "Number of paths\n")
@ -6377,8 +6376,7 @@ DEFUN (show_bgp_vrfs,
json_object_int_add(json, "totalVrfs", count); json_object_int_add(json, "totalVrfs", count);
vty_out(vty, "%s\n", vty_out(vty, "%s\n", json_object_to_json_string_ext(
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} else { } else {
@ -6473,19 +6471,16 @@ DEFUN (show_bgp_memory,
/* Other attributes */ /* Other attributes */
if ((count = community_count())) if ((count = community_count()))
vty_out(vty, "%ld BGP community entries, using %s of memory\n", vty_out(vty, "%ld BGP community entries, using %s of memory\n",
count, count, mtype_memstr(memstrbuf, sizeof(memstrbuf),
mtype_memstr(memstrbuf, sizeof(memstrbuf),
count * sizeof(struct community))); count * sizeof(struct community)));
if ((count = mtype_stats_alloc(MTYPE_ECOMMUNITY))) if ((count = mtype_stats_alloc(MTYPE_ECOMMUNITY)))
vty_out(vty, "%ld BGP community entries, using %s of memory\n", vty_out(vty, "%ld BGP community entries, using %s of memory\n",
count, count, mtype_memstr(memstrbuf, sizeof(memstrbuf),
mtype_memstr(memstrbuf, sizeof(memstrbuf),
count * sizeof(struct ecommunity))); count * sizeof(struct ecommunity)));
if ((count = mtype_stats_alloc(MTYPE_LCOMMUNITY))) if ((count = mtype_stats_alloc(MTYPE_LCOMMUNITY)))
vty_out(vty, vty_out(vty,
"%ld BGP large-community entries, using %s of memory\n", "%ld BGP large-community entries, using %s of memory\n",
count, count, mtype_memstr(memstrbuf, sizeof(memstrbuf),
mtype_memstr(memstrbuf, sizeof(memstrbuf),
count * sizeof(struct lcommunity))); count * sizeof(struct lcommunity)));
if ((count = mtype_stats_alloc(MTYPE_CLUSTER))) if ((count = mtype_stats_alloc(MTYPE_CLUSTER)))
@ -6515,8 +6510,7 @@ DEFUN (show_bgp_memory,
count * sizeof(struct hash_backet))); count * sizeof(struct hash_backet)));
if ((count = mtype_stats_alloc(MTYPE_BGP_REGEXP))) if ((count = mtype_stats_alloc(MTYPE_BGP_REGEXP)))
vty_out(vty, "%ld compiled regexes, using %s of memory\n", vty_out(vty, "%ld compiled regexes, using %s of memory\n",
count, count, mtype_memstr(memstrbuf, sizeof(memstrbuf),
mtype_memstr(memstrbuf, sizeof(memstrbuf),
count * sizeof(regex_t))); count * sizeof(regex_t)));
return CMD_SUCCESS; return CMD_SUCCESS;
} }
@ -6742,8 +6736,7 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
ents); ents);
json_object_int_add( json_object_int_add(
json, "peerGroupMemory", json, "peerGroupMemory",
ents ents * sizeof(struct
* sizeof(struct
peer_group)); peer_group));
} }
@ -6775,8 +6768,7 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
mtype_memstr( mtype_memstr(
memstrbuf, memstrbuf,
sizeof(memstrbuf), sizeof(memstrbuf),
ents ents * sizeof(struct
* sizeof(struct
bgp_node))); bgp_node)));
/* Peer related usage */ /* Peer related usage */
@ -6787,8 +6779,7 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
mtype_memstr( mtype_memstr(
memstrbuf, memstrbuf,
sizeof(memstrbuf), sizeof(memstrbuf),
ents ents * sizeof(struct
* sizeof(struct
peer))); peer)));
if ((ents = listcount(bgp->group))) if ((ents = listcount(bgp->group)))
@ -6798,8 +6789,7 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
mtype_memstr( mtype_memstr(
memstrbuf, memstrbuf,
sizeof(memstrbuf), sizeof(memstrbuf),
ents ents * sizeof(struct
* sizeof(struct
peer_group))); peer_group)));
if (CHECK_FLAG(bgp->af_flags[afi][safi], if (CHECK_FLAG(bgp->af_flags[afi][safi],
@ -6918,8 +6908,7 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
vty_out(vty, "%*s", vty_out(vty, "%*s",
max_neighbor_width - len, " "); max_neighbor_width - len, " ");
vty_out(vty, vty_out(vty, "4 %10u %7d %7d %8" PRIu64
"4 %10u %7d %7d %8" PRIu64
" %4d %4zd %8s", " %4d %4zd %8s",
peer->as, peer->as,
peer->open_in + peer->update_in peer->open_in + peer->update_in
@ -6968,8 +6957,7 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
json_object_int_add(json, "totalPeers", count); json_object_int_add(json, "totalPeers", count);
json_object_int_add(json, "dynamicPeers", dn_count); json_object_int_add(json, "dynamicPeers", dn_count);
vty_out(vty, "%s\n", vty_out(vty, "%s\n", json_object_to_json_string_ext(
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} else { } else {
@ -7065,7 +7053,8 @@ static void bgp_show_summary_afi_safi(struct vty *vty, struct bgp *bgp, int afi,
} }
safi++; safi++;
if (safi == SAFI_RESERVED_4 if (safi == SAFI_RESERVED_4
|| safi == SAFI_RESERVED_5) /* handle special || safi
== SAFI_RESERVED_5) /* handle special
cases to match cases to match
zebra.h */ zebra.h */
safi++; safi++;
@ -7626,9 +7615,8 @@ static void bgp_show_peer_afi(struct vty *vty, struct peer *p, afi_t afi,
paf = peer_af_find(p, afi, safi); paf = peer_af_find(p, afi, safi);
if (paf && PAF_SUBGRP(paf)) { if (paf && PAF_SUBGRP(paf)) {
vty_out(vty, vty_out(vty, " Update group %" PRIu64
" Update group %" PRIu64 ", subgroup %" PRIu64 ", subgroup %" PRIu64 "\n",
"\n",
PAF_UPDGRP(paf)->id, PAF_SUBGRP(paf)->id); PAF_UPDGRP(paf)->id, PAF_SUBGRP(paf)->id);
vty_out(vty, " Packet Queue length %d\n", vty_out(vty, " Packet Queue length %d\n",
bpacket_queue_virtual_length(paf)); bpacket_queue_virtual_length(paf));
@ -9394,8 +9382,7 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, u_char use_json,
} else } else
vty_out(vty, vty_out(vty,
" Reduce the no. of prefix from %s, will restart in %ld seconds\n", " Reduce the no. of prefix from %s, will restart in %ld seconds\n",
p->host, p->host, thread_timer_remain_second(
thread_timer_remain_second(
p->t_pmax_restart)); p->t_pmax_restart));
} else { } else {
if (use_json) if (use_json)
@ -9636,8 +9623,7 @@ static int bgp_show_neighbor(struct vty *vty, struct bgp *bgp,
} }
if (use_json) { if (use_json) {
vty_out(vty, "%s\n", vty_out(vty, "%s\n", json_object_to_json_string_ext(
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} else { } else {
@ -11093,45 +11079,31 @@ int bgp_config_write_redistribute(struct vty *vty, struct bgp *bgp, afi_t afi,
/* BGP node structure. */ /* BGP node structure. */
static struct cmd_node bgp_node = { static struct cmd_node bgp_node = {
BGP_NODE, BGP_NODE, "%s(config-router)# ", 1,
"%s(config-router)# ",
1,
}; };
static struct cmd_node bgp_ipv4_unicast_node = { static struct cmd_node bgp_ipv4_unicast_node = {
BGP_IPV4_NODE, BGP_IPV4_NODE, "%s(config-router-af)# ", 1,
"%s(config-router-af)# ",
1,
}; };
static struct cmd_node bgp_ipv4_multicast_node = { static struct cmd_node bgp_ipv4_multicast_node = {
BGP_IPV4M_NODE, BGP_IPV4M_NODE, "%s(config-router-af)# ", 1,
"%s(config-router-af)# ",
1,
}; };
static struct cmd_node bgp_ipv4_labeled_unicast_node = { static struct cmd_node bgp_ipv4_labeled_unicast_node = {
BGP_IPV4L_NODE, BGP_IPV4L_NODE, "%s(config-router-af)# ", 1,
"%s(config-router-af)# ",
1,
}; };
static struct cmd_node bgp_ipv6_unicast_node = { static struct cmd_node bgp_ipv6_unicast_node = {
BGP_IPV6_NODE, BGP_IPV6_NODE, "%s(config-router-af)# ", 1,
"%s(config-router-af)# ",
1,
}; };
static struct cmd_node bgp_ipv6_multicast_node = { static struct cmd_node bgp_ipv6_multicast_node = {
BGP_IPV6M_NODE, BGP_IPV6M_NODE, "%s(config-router-af)# ", 1,
"%s(config-router-af)# ",
1,
}; };
static struct cmd_node bgp_ipv6_labeled_unicast_node = { static struct cmd_node bgp_ipv6_labeled_unicast_node = {
BGP_IPV6L_NODE, BGP_IPV6L_NODE, "%s(config-router-af)# ", 1,
"%s(config-router-af)# ",
1,
}; };
static struct cmd_node bgp_vpnv4_node = {BGP_VPNV4_NODE, static struct cmd_node bgp_vpnv4_node = {BGP_VPNV4_NODE,

View File

@ -621,12 +621,10 @@ static int zebra_read_ipv4(int command, struct zclient *zclient,
zlog_debug( zlog_debug(
"Rx IPv4 route add VRF %u %s[%d] %s/%d nexthop %s metric %u tag %" ROUTE_TAG_PRI, "Rx IPv4 route add VRF %u %s[%d] %s/%d nexthop %s metric %u tag %" ROUTE_TAG_PRI,
vrf_id, zebra_route_string(api.type), vrf_id, zebra_route_string(api.type),
api.instance, api.instance, inet_ntop(AF_INET, &p.prefix,
inet_ntop(AF_INET, &p.prefix, buf[0], buf[0], sizeof(buf[0])),
sizeof(buf[0])), p.prefixlen, inet_ntop(AF_INET, &nexthop,
p.prefixlen, buf[1], sizeof(buf[1])),
inet_ntop(AF_INET, &nexthop, buf[1],
sizeof(buf[1])),
api.metric, api.tag); api.metric, api.tag);
} }
@ -657,12 +655,10 @@ static int zebra_read_ipv4(int command, struct zclient *zclient,
"Rx IPv4 route delete VRF %u %s[%d] %s/%d " "Rx IPv4 route delete VRF %u %s[%d] %s/%d "
"nexthop %s metric %u tag %" ROUTE_TAG_PRI, "nexthop %s metric %u tag %" ROUTE_TAG_PRI,
vrf_id, zebra_route_string(api.type), vrf_id, zebra_route_string(api.type),
api.instance, api.instance, inet_ntop(AF_INET, &p.prefix,
inet_ntop(AF_INET, &p.prefix, buf[0], buf[0], sizeof(buf[0])),
sizeof(buf[0])), p.prefixlen, inet_ntop(AF_INET, &nexthop,
p.prefixlen, buf[1], sizeof(buf[1])),
inet_ntop(AF_INET, &nexthop, buf[1],
sizeof(buf[1])),
api.metric, api.tag); api.metric, api.tag);
} }
bgp_redistribute_delete(bgp, (struct prefix *)&p, api.type, bgp_redistribute_delete(bgp, (struct prefix *)&p, api.type,
@ -752,12 +748,10 @@ static int zebra_read_ipv6(int command, struct zclient *zclient,
zlog_debug( zlog_debug(
"Rx IPv6 route add VRF %u %s[%d] %s/%d nexthop %s metric %u tag %" ROUTE_TAG_PRI, "Rx IPv6 route add VRF %u %s[%d] %s/%d nexthop %s metric %u tag %" ROUTE_TAG_PRI,
vrf_id, zebra_route_string(api.type), vrf_id, zebra_route_string(api.type),
api.instance, api.instance, inet_ntop(AF_INET6, &p.prefix,
inet_ntop(AF_INET6, &p.prefix, buf[0], buf[0], sizeof(buf[0])),
sizeof(buf[0])), p.prefixlen, inet_ntop(AF_INET, &nexthop,
p.prefixlen, buf[1], sizeof(buf[1])),
inet_ntop(AF_INET, &nexthop, buf[1],
sizeof(buf[1])),
api.metric, api.tag); api.metric, api.tag);
} }
@ -787,12 +781,10 @@ static int zebra_read_ipv6(int command, struct zclient *zclient,
"Rx IPv6 route delete VRF %u %s[%d] %s/%d " "Rx IPv6 route delete VRF %u %s[%d] %s/%d "
"nexthop %s metric %u tag %" ROUTE_TAG_PRI, "nexthop %s metric %u tag %" ROUTE_TAG_PRI,
vrf_id, zebra_route_string(api.type), vrf_id, zebra_route_string(api.type),
api.instance, api.instance, inet_ntop(AF_INET6, &p.prefix,
inet_ntop(AF_INET6, &p.prefix, buf[0], buf[0], sizeof(buf[0])),
sizeof(buf[0])), p.prefixlen, inet_ntop(AF_INET6, &nexthop,
p.prefixlen, buf[1], sizeof(buf[1])),
inet_ntop(AF_INET6, &nexthop, buf[1],
sizeof(buf[1])),
api.metric, api.tag); api.metric, api.tag);
} }
bgp_redistribute_delete(bgp, (struct prefix *)&p, api.type, bgp_redistribute_delete(bgp, (struct prefix *)&p, api.type,
@ -1324,9 +1316,8 @@ void bgp_zebra_announce(struct bgp_node *rn, struct prefix *p,
"Tx IPv4 route %s VRF %u %s/%d metric %u tag %" ROUTE_TAG_PRI "Tx IPv4 route %s VRF %u %s/%d metric %u tag %" ROUTE_TAG_PRI
" count %d", " count %d",
(valid_nh_count ? "add" : "delete"), (valid_nh_count ? "add" : "delete"),
bgp->vrf_id, bgp->vrf_id, inet_ntop(AF_INET, &p->u.prefix4,
inet_ntop(AF_INET, &p->u.prefix4, buf[0], buf[0], sizeof(buf[0])),
sizeof(buf[0])),
p->prefixlen, api.metric, api.tag, p->prefixlen, api.metric, api.tag,
api.nexthop_num); api.nexthop_num);
for (i = 0; i < api.nexthop_num; i++) { for (i = 0; i < api.nexthop_num; i++) {

View File

@ -3886,8 +3886,7 @@ static int peer_af_flag_modify(struct peer *peer, afi_t afi, safi_t safi,
} }
/* Track if addpath TX is in use */ /* Track if addpath TX is in use */
if (flag if (flag & (PEER_FLAG_ADDPATH_TX_ALL_PATHS
& (PEER_FLAG_ADDPATH_TX_ALL_PATHS
| PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS)) { | PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS)) {
bgp = peer->bgp; bgp = peer->bgp;
addpath_tx_used = 0; addpath_tx_used = 0;
@ -6758,8 +6757,7 @@ static void bgp_config_write_peer_af(struct vty *vty, struct bgp *bgp,
} else { } else {
if (!peer_af_flag_check(peer, afi, safi, if (!peer_af_flag_check(peer, afi, safi,
PEER_FLAG_SEND_COMMUNITY) PEER_FLAG_SEND_COMMUNITY)
&& (!g_peer && (!g_peer || peer_af_flag_check(g_peer, afi, safi,
|| peer_af_flag_check(g_peer, afi, safi,
PEER_FLAG_SEND_COMMUNITY)) PEER_FLAG_SEND_COMMUNITY))
&& !peer_af_flag_check(peer, afi, safi, && !peer_af_flag_check(peer, afi, safi,
PEER_FLAG_SEND_EXT_COMMUNITY) PEER_FLAG_SEND_EXT_COMMUNITY)
@ -6768,8 +6766,7 @@ static void bgp_config_write_peer_af(struct vty *vty, struct bgp *bgp,
PEER_FLAG_SEND_EXT_COMMUNITY)) PEER_FLAG_SEND_EXT_COMMUNITY))
&& !peer_af_flag_check(peer, afi, safi, && !peer_af_flag_check(peer, afi, safi,
PEER_FLAG_SEND_LARGE_COMMUNITY) PEER_FLAG_SEND_LARGE_COMMUNITY)
&& (!g_peer && (!g_peer || peer_af_flag_check(
|| peer_af_flag_check(
g_peer, afi, safi, g_peer, afi, safi,
PEER_FLAG_SEND_LARGE_COMMUNITY))) { PEER_FLAG_SEND_LARGE_COMMUNITY))) {
afi_header_vty_out( afi_header_vty_out(
@ -6802,8 +6799,7 @@ static void bgp_config_write_peer_af(struct vty *vty, struct bgp *bgp,
if (!peer_af_flag_check(peer, afi, safi, if (!peer_af_flag_check(peer, afi, safi,
PEER_FLAG_SEND_COMMUNITY) PEER_FLAG_SEND_COMMUNITY)
&& (!g_peer && (!g_peer || peer_af_flag_check(
|| peer_af_flag_check(
g_peer, afi, safi, g_peer, afi, safi,
PEER_FLAG_SEND_COMMUNITY))) { PEER_FLAG_SEND_COMMUNITY))) {
afi_header_vty_out( afi_header_vty_out(

View File

@ -251,10 +251,9 @@ struct bgp {
/* $FRR indent$ */ /* $FRR indent$ */
/* clang-format off */ /* clang-format off */
#define BGP_MAXMED_ADMIN_UNCONFIGURED 0 /* Off by default */ #define BGP_MAXMED_ADMIN_UNCONFIGURED 0 /* Off by default */
u_int32_t maxmed_admin_value; /* Max-med value when administrative in on u_int32_t
maxmed_admin_value; /* Max-med value when administrative in on
*/ */
/* $FRR indent$ */
/* clang-format off */
#define BGP_MAXMED_VALUE_DEFAULT 4294967294 /* Maximum by default */ #define BGP_MAXMED_VALUE_DEFAULT 4294967294 /* Maximum by default */
u_char maxmed_active; /* 1/0 if max-med is active or not */ u_char maxmed_active; /* 1/0 if max-med is active or not */

View File

@ -503,7 +503,8 @@ DEFUN (vnc_defaults_responselifetime,
} else { } else {
rspint = strtoul(argv[1]->arg, NULL, 10); rspint = strtoul(argv[1]->arg, NULL, 10);
if (rspint > INT32_MAX) if (rspint > INT32_MAX)
rspint = INT32_MAX; /* is really an int, not an unsigned rspint =
INT32_MAX; /* is really an int, not an unsigned
int */ int */
} }
@ -1673,8 +1674,7 @@ DEFUN (vnc_nve_group_export_no_prefixlist,
} }
if (argv[2]->arg[0] == 'b') { if (argv[2]->arg[0] == 'b') {
if (((argc > 5) if (((argc > 5) && strmatch(argv[5]->text,
&& strmatch(argv[5]->text,
rfg->plist_export_bgp_name[afi])) rfg->plist_export_bgp_name[afi]))
|| (argc <= 5)) { || (argc <= 5)) {
@ -1686,8 +1686,7 @@ DEFUN (vnc_nve_group_export_no_prefixlist,
vnc_direct_bgp_reexport_group_afi(bgp, rfg, afi); vnc_direct_bgp_reexport_group_afi(bgp, rfg, afi);
} }
} else { } else {
if (((argc > 5) if (((argc > 5) && strmatch(argv[5]->text,
&& strmatch(argv[5]->text,
rfg->plist_export_zebra_name[afi])) rfg->plist_export_zebra_name[afi]))
|| (argc <= 5)) { || (argc <= 5)) {
if (rfg->plist_export_zebra_name[afi]) if (rfg->plist_export_zebra_name[afi])
@ -1792,8 +1791,7 @@ DEFUN (vnc_nve_group_export_no_routemap,
vnc_direct_bgp_reexport_group_afi(bgp, rfg, AFI_IP6); vnc_direct_bgp_reexport_group_afi(bgp, rfg, AFI_IP6);
} }
} else { } else {
if (((argc > 4) if (((argc > 4) && strmatch(argv[4]->text,
&& strmatch(argv[4]->text,
rfg->routemap_export_zebra_name)) rfg->routemap_export_zebra_name))
|| (argc <= 4)) { || (argc <= 4)) {
if (rfg->routemap_export_zebra_name) if (rfg->routemap_export_zebra_name)
@ -2447,8 +2445,7 @@ bgp_rfapi_delete_named_nve_group(struct vty *vty, /* NULL = no output */
*/ */
for (ALL_LIST_ELEMENTS_RO(bgp->rfapi_cfg->rfg_export_direct_bgp_l, node, for (ALL_LIST_ELEMENTS_RO(bgp->rfapi_cfg->rfg_export_direct_bgp_l, node,
rfgn)) { rfgn)) {
if (rfg_name == NULL if (rfg_name == NULL || (type == RFAPI_GROUP_CFG_NVE
|| (type == RFAPI_GROUP_CFG_NVE
&& !strcmp(rfgn->name, rfg_name))) { && !strcmp(rfgn->name, rfg_name))) {
rfgn->rfg = NULL; rfgn->rfg = NULL;
/* remove exported routes from this group */ /* remove exported routes from this group */
@ -2463,8 +2460,7 @@ bgp_rfapi_delete_named_nve_group(struct vty *vty, /* NULL = no output */
for (ALL_LIST_ELEMENTS_RO(bgp->rfapi_cfg->rfg_export_zebra_l, node, for (ALL_LIST_ELEMENTS_RO(bgp->rfapi_cfg->rfg_export_zebra_l, node,
rfgn)) { rfgn)) {
if (rfg_name == NULL if (rfg_name == NULL || (type == RFAPI_GROUP_CFG_NVE
|| (type == RFAPI_GROUP_CFG_NVE
&& !strcmp(rfgn->name, rfg_name))) { && !strcmp(rfgn->name, rfg_name))) {
rfgn->rfg = NULL; rfgn->rfg = NULL;
/* remove exported routes from this group */ /* remove exported routes from this group */

View File

@ -2603,8 +2603,7 @@ int rfapi_register(void *handle, struct rfapi_ip_prefix *prefix,
ZEBRA_ROUTE_BGP, BGP_ROUTE_RFP, NULL, ZEBRA_ROUTE_BGP, BGP_ROUTE_RFP, NULL,
action == RFAPI_REGISTER_KILL); action == RFAPI_REGISTER_KILL);
if (0 if (0 == rfapiApDelete(bgp, rfd, &p, pfx_mac, &prd,
== rfapiApDelete(bgp, rfd, &p, pfx_mac, &prd,
&adv_tunnel)) { &adv_tunnel)) {
if (adv_tunnel) if (adv_tunnel)
rfapiTunnelRouteAnnounce( rfapiTunnelRouteAnnounce(

View File

@ -1086,7 +1086,8 @@ int rfapiEcommunityGetEthernetTag(struct ecommunity *ecom, uint16_t *tag_id)
} else if (encode == ECOMMUNITY_ENCODE_AS) { } else if (encode == ECOMMUNITY_ENCODE_AS) {
as = (*p++ << 8); as = (*p++ << 8);
as |= (*p++); as |= (*p++);
p += 2; /* skip next two, tag/vid p +=
2; /* skip next two, tag/vid
always in lowest bytes */ always in lowest bytes */
} }
if (as == bgp->as) { if (as == bgp->as) {
@ -2010,8 +2011,7 @@ static void rfapiBgpInfoAttachSorted(struct route_node *rn,
for (prev = NULL, next = rn->info; next; for (prev = NULL, next = rn->info; next;
prev = next, next = next->next) { prev = next, next = next->next) {
if (!bgp if (!bgp || (!CHECK_FLAG(info_new->flags, BGP_INFO_REMOVED)
|| (!CHECK_FLAG(info_new->flags, BGP_INFO_REMOVED)
&& CHECK_FLAG(next->flags, BGP_INFO_REMOVED)) && CHECK_FLAG(next->flags, BGP_INFO_REMOVED))
|| bgp_info_cmp_compatible(bgp, info_new, next, pfx_buf, || bgp_info_cmp_compatible(bgp, info_new, next, pfx_buf,
afi, safi) afi, safi)
@ -3554,10 +3554,9 @@ void rfapiBgpInfoFilteredImportVPN(
vnc_zlog_debug_verbose( vnc_zlog_debug_verbose(
"%s: withdrawing at prefix %s/%d%s", "%s: withdrawing at prefix %s/%d%s",
__func__, __func__, rfapi_ntop(rn->p.family,
rfapi_ntop(rn->p.family, &rn->p.u.prefix,
&rn->p.u.prefix, buf, buf, BUFSIZ),
BUFSIZ),
rn->p.prefixlen, rn->p.prefixlen,
(washolddown (washolddown
? " (already being withdrawn)" ? " (already being withdrawn)"
@ -4311,8 +4310,9 @@ void bgp_rfapi_destroy(struct bgp *bgp, struct rfapi *h)
void *cursor; void *cursor;
int rc; int rc;
for (cursor = NULL, rc = skiplist_next(h->import_mac, NULL, for (cursor = NULL,
(void **)&it, &cursor); rc = skiplist_next(h->import_mac, NULL, (void **)&it,
&cursor);
!rc; rc = skiplist_next(h->import_mac, NULL, (void **)&it, !rc; rc = skiplist_next(h->import_mac, NULL, (void **)&it,
&cursor)) { &cursor)) {
@ -4711,8 +4711,9 @@ void rfapiDeleteRemotePrefixes(struct prefix *un, struct prefix *vn,
void *cursor = NULL; void *cursor = NULL;
int rc; int rc;
for (cursor = NULL, rc = skiplist_next(h->import_mac, NULL, for (cursor = NULL,
(void **)&it, &cursor); rc = skiplist_next(h->import_mac, NULL, (void **)&it,
&cursor);
!rc; rc = skiplist_next(h->import_mac, NULL, (void **)&it, !rc; rc = skiplist_next(h->import_mac, NULL, (void **)&it,
&cursor)) { &cursor)) {
@ -4805,8 +4806,9 @@ void rfapiCountAllItRoutes(int *pALRcount, /* active local routes */
int rc; int rc;
if (h->import_mac) { if (h->import_mac) {
for (cursor = NULL, rc = skiplist_next(h->import_mac, NULL, for (cursor = NULL,
(void **)&it, &cursor); rc = skiplist_next(h->import_mac, NULL, (void **)&it,
&cursor);
!rc; rc = skiplist_next(h->import_mac, NULL, (void **)&it, !rc; rc = skiplist_next(h->import_mac, NULL, (void **)&it,
&cursor)) { &cursor)) {

View File

@ -1339,11 +1339,10 @@ struct route_node *rfapiMonitorEthAdd(struct bgp *bgp,
{ {
char buf[BUFSIZ]; char buf[BUFSIZ];
vnc_zlog_debug_verbose("%s: LNI=%d: rfd=%p, pfx=%s", __func__, vnc_zlog_debug_verbose(
logical_net_id, rfd, "%s: LNI=%d: rfd=%p, pfx=%s", __func__, logical_net_id,
rfapi_ntop(pfx_mac_buf.family, rfd, rfapi_ntop(pfx_mac_buf.family, pfx_mac_buf.u.val,
pfx_mac_buf.u.val, buf, buf, BUFSIZ));
BUFSIZ));
} }

View File

@ -527,11 +527,11 @@ void rfapiRibClear(struct rfapi_descriptor *rfd)
struct rfapi_info *ri; struct rfapi_info *ri;
while (0 while (0 == skiplist_first(
== skiplist_first(
(struct skiplist *) (struct skiplist *)
rn->info, rn->info,
NULL, (void **)&ri)) { NULL,
(void **)&ri)) {
rfapi_info_free(ri); rfapi_info_free(ri);
skiplist_delete_first( skiplist_delete_first(

View File

@ -375,9 +375,8 @@ static int vnc_zebra_read_ipv4(int command, struct zclient *zclient,
__func__, zebra_route_string(api.type), __func__, zebra_route_string(api.type),
inet_ntop(AF_INET, &p.prefix, buf[0], inet_ntop(AF_INET, &p.prefix, buf[0],
sizeof(buf[0])), sizeof(buf[0])),
p.prefixlen, p.prefixlen, inet_ntop(AF_INET, &nexthop,
inet_ntop(AF_INET, &nexthop, buf[1], buf[1], sizeof(buf[1])),
sizeof(buf[1])),
api.metric); api.metric);
} }
vnc_redistribute_add((struct prefix *)&p, &nexthop, api.metric, vnc_redistribute_add((struct prefix *)&p, &nexthop, api.metric,
@ -391,9 +390,8 @@ static int vnc_zebra_read_ipv4(int command, struct zclient *zclient,
__func__, zebra_route_string(api.type), __func__, zebra_route_string(api.type),
inet_ntop(AF_INET, &p.prefix, buf[0], inet_ntop(AF_INET, &p.prefix, buf[0],
sizeof(buf[0])), sizeof(buf[0])),
p.prefixlen, p.prefixlen, inet_ntop(AF_INET, &nexthop,
inet_ntop(AF_INET, &nexthop, buf[1], buf[1], sizeof(buf[1])),
sizeof(buf[1])),
api.metric); api.metric);
} }
vnc_redistribute_delete((struct prefix *)&p, api.type); vnc_redistribute_delete((struct prefix *)&p, api.type);

View File

@ -552,8 +552,7 @@ struct eigrp_interface *eigrp_if_lookup_recv_if(struct eigrp *eigrp,
if (prefix_match(CONNECTED_PREFIX(ei->connected), if (prefix_match(CONNECTED_PREFIX(ei->connected),
(struct prefix *)&addr)) { (struct prefix *)&addr)) {
if ((match == NULL) if ((match == NULL) || (match->address->prefixlen
|| (match->address->prefixlen
< ei->address->prefixlen)) < ei->address->prefixlen))
match = ei; match = ei;
} }

View File

@ -68,9 +68,7 @@
/* eigprd privileges */ /* eigprd privileges */
zebra_capabilities_t _caps_p[] = { zebra_capabilities_t _caps_p[] = {
ZCAP_NET_RAW, ZCAP_NET_RAW, ZCAP_BIND, ZCAP_NET_ADMIN,
ZCAP_BIND,
ZCAP_NET_ADMIN,
}; };
struct zebra_privs_t eigrpd_privs = { struct zebra_privs_t eigrpd_privs = {

View File

@ -134,8 +134,7 @@ int eigrp_make_md5_digest(struct eigrp_interface *ei, struct stream *s,
MD5Update(&ctx, zeropad, 16 - strlen(key->string)); MD5Update(&ctx, zeropad, 16 - strlen(key->string));
if (backup_end > (EIGRP_HEADER_LEN + EIGRP_AUTH_MD5_TLV_SIZE)) { if (backup_end > (EIGRP_HEADER_LEN + EIGRP_AUTH_MD5_TLV_SIZE)) {
MD5Update(&ctx, MD5Update(&ctx,
ibuf ibuf + (EIGRP_HEADER_LEN
+ (EIGRP_HEADER_LEN
+ EIGRP_AUTH_MD5_TLV_SIZE), + EIGRP_AUTH_MD5_TLV_SIZE),
backup_end - 20 backup_end - 20
- (EIGRP_HEADER_LEN - (EIGRP_HEADER_LEN
@ -209,8 +208,7 @@ int eigrp_check_md5_digest(struct stream *s,
MD5Update(&ctx, zeropad, 16 - strlen(key->string)); MD5Update(&ctx, zeropad, 16 - strlen(key->string));
if (backup_end > (EIGRP_HEADER_LEN + EIGRP_AUTH_MD5_TLV_SIZE)) { if (backup_end > (EIGRP_HEADER_LEN + EIGRP_AUTH_MD5_TLV_SIZE)) {
MD5Update(&ctx, MD5Update(&ctx,
ibuf ibuf + (EIGRP_HEADER_LEN
+ (EIGRP_HEADER_LEN
+ EIGRP_AUTH_MD5_TLV_SIZE), + EIGRP_AUTH_MD5_TLV_SIZE),
backup_end - 20 backup_end - 20
- (EIGRP_HEADER_LEN - (EIGRP_HEADER_LEN

View File

@ -644,9 +644,7 @@ static void route_set_metric_free(void *rule)
/* Set metric rule structure. */ /* Set metric rule structure. */
static struct route_map_rule_cmd route_set_metric_cmd = { static struct route_map_rule_cmd route_set_metric_cmd = {
"metric", "metric", route_set_metric, route_set_metric_compile,
route_set_metric,
route_set_metric_compile,
route_set_metric_free, route_set_metric_free,
}; };
@ -778,8 +776,7 @@ DEFUN (no_match_metric,
} }
ALIAS(no_match_metric, no_match_metric_val_cmd, ALIAS(no_match_metric, no_match_metric_val_cmd,
"no match metric <0-4294967295>", "no match metric <0-4294967295>", NO_STR MATCH_STR
NO_STR MATCH_STR
"Match metric of route\n" "Match metric of route\n"
"Metric value\n") "Metric value\n")
@ -842,8 +839,7 @@ DEFUN (no_match_ip_next_hop,
} }
ALIAS(no_match_ip_next_hop, no_match_ip_next_hop_val_cmd, ALIAS(no_match_ip_next_hop, no_match_ip_next_hop_val_cmd,
"no match ip next-hop (<1-199>|<1300-2699>|WORD)", "no match ip next-hop (<1-199>|<1300-2699>|WORD)", NO_STR MATCH_STR IP_STR
NO_STR MATCH_STR IP_STR
"Match next-hop address of route\n" "Match next-hop address of route\n"
"IP access-list number\n" "IP access-list number\n"
"IP access-list number (expanded range)\n" "IP access-list number (expanded range)\n"
@ -881,8 +877,7 @@ DEFUN (no_match_ip_next_hop_prefix_list,
ALIAS(no_match_ip_next_hop_prefix_list, ALIAS(no_match_ip_next_hop_prefix_list,
no_match_ip_next_hop_prefix_list_val_cmd, no_match_ip_next_hop_prefix_list_val_cmd,
"no match ip next-hop prefix-list WORD", "no match ip next-hop prefix-list WORD", NO_STR MATCH_STR IP_STR
NO_STR MATCH_STR IP_STR
"Match next-hop address of route\n" "Match next-hop address of route\n"
"Match entries of prefix-lists\n" "Match entries of prefix-lists\n"
"IP prefix-list name\n") "IP prefix-list name\n")
@ -916,8 +911,7 @@ DEFUN (no_match_ip_address,
} }
ALIAS(no_match_ip_address, no_match_ip_address_val_cmd, ALIAS(no_match_ip_address, no_match_ip_address_val_cmd,
"no match ip address (<1-199>|<1300-2699>|WORD)", "no match ip address (<1-199>|<1300-2699>|WORD)", NO_STR MATCH_STR IP_STR
NO_STR MATCH_STR IP_STR
"Match address of route\n" "Match address of route\n"
"IP access-list number\n" "IP access-list number\n"
"IP access-list number (expanded range)\n" "IP access-list number (expanded range)\n"
@ -954,8 +948,7 @@ DEFUN (no_match_ip_address_prefix_list,
} }
ALIAS(no_match_ip_address_prefix_list, no_match_ip_address_prefix_list_val_cmd, ALIAS(no_match_ip_address_prefix_list, no_match_ip_address_prefix_list_val_cmd,
"no match ip address prefix-list WORD", "no match ip address prefix-list WORD", NO_STR MATCH_STR IP_STR
NO_STR MATCH_STR IP_STR
"Match address of route\n" "Match address of route\n"
"Match entries of prefix-lists\n" "Match entries of prefix-lists\n"
"IP prefix-list name\n") "IP prefix-list name\n")
@ -1000,8 +993,7 @@ DEFUN (set_metric,
return eigrp_route_set_add(vty, vty->index, "metric", argv[0]); return eigrp_route_set_add(vty, vty->index, "metric", argv[0]);
} }
ALIAS(set_metric, set_metric_addsub_cmd, "set metric <+/-metric>", ALIAS(set_metric, set_metric_addsub_cmd, "set metric <+/-metric>", SET_STR
SET_STR
"Metric value for destination routing protocol\n" "Metric value for destination routing protocol\n"
"Add or subtract metric\n") "Add or subtract metric\n")
@ -1019,8 +1011,7 @@ DEFUN (no_set_metric,
} }
ALIAS(no_set_metric, no_set_metric_val_cmd, ALIAS(no_set_metric, no_set_metric_val_cmd,
"no set metric (<0-4294967295>|<+/-metric>)", "no set metric (<0-4294967295>|<+/-metric>)", NO_STR SET_STR
NO_STR SET_STR
"Metric value for destination routing protocol\n" "Metric value for destination routing protocol\n"
"Metric value\n" "Metric value\n"
"Add or subtract metric\n") "Add or subtract metric\n")
@ -1061,8 +1052,7 @@ DEFUN (no_set_ip_nexthop,
} }
ALIAS(no_set_ip_nexthop, no_set_ip_nexthop_val_cmd, ALIAS(no_set_ip_nexthop, no_set_ip_nexthop_val_cmd,
"no set ip next-hop A.B.C.D", "no set ip next-hop A.B.C.D", NO_STR SET_STR IP_STR
NO_STR SET_STR IP_STR
"Next hop address\n" "Next hop address\n"
"IP address of next hop\n") "IP address of next hop\n")
@ -1089,8 +1079,7 @@ DEFUN (no_set_tag,
return eigrp_route_set_delete(vty, vty->index, "tag", argv[0]); return eigrp_route_set_delete(vty, vty->index, "tag", argv[0]);
} }
ALIAS(no_set_tag, no_set_tag_val_cmd, "no set tag <0-65535>", ALIAS(no_set_tag, no_set_tag_val_cmd, "no set tag <0-65535>", NO_STR SET_STR
NO_STR SET_STR
"Tag value for routing protocol\n" "Tag value for routing protocol\n"
"Tag value\n") "Tag value\n")

View File

@ -104,7 +104,8 @@ struct eigrp {
uint64_t serno; /* Global serial number counter for topology entry uint64_t serno; /* Global serial number counter for topology entry
changes*/ changes*/
uint64_t serno_last_update; /* Highest serial number of information send uint64_t
serno_last_update; /* Highest serial number of information send
by last update*/ by last update*/
struct list *topology_changes_internalIPV4; struct list *topology_changes_internalIPV4;
struct list *topology_changes_externalIPV4; struct list *topology_changes_externalIPV4;

View File

@ -771,8 +771,8 @@ void eigrp_update_send_all(struct eigrp *eigrp,
/** /**
* @fn eigrp_update_send_GR_part * @fn eigrp_update_send_GR_part
* *
* @param[in] nbr contains neighbor who would receive * @param[in] nbr contains neighbor who would receive Graceful
* Graceful restart * restart
* *
* @return void * @return void
* *
@ -1034,8 +1034,8 @@ int eigrp_update_send_GR_thread(struct thread *thread)
/** /**
* @fn eigrp_update_send_GR * @fn eigrp_update_send_GR
* *
* @param[in] nbr Neighbor who would receive * @param[in] nbr Neighbor who would receive Graceful
* Graceful restart * restart
* @param[in] gr_type Who executed Graceful restart * @param[in] gr_type Who executed Graceful restart
* @param[in] vty Virtual terminal for log output * @param[in] vty Virtual terminal for log output
* *
@ -1094,8 +1094,8 @@ void eigrp_update_send_GR(struct eigrp_neighbor *nbr, enum GR_type gr_type,
/** /**
* @fn eigrp_update_send_interface_GR * @fn eigrp_update_send_interface_GR
* *
* @param[in] ei Interface to neighbors of which the * @param[in] ei Interface to neighbors of which the GR
* GR is sent * is sent
* @param[in] gr_type Who executed Graceful restart * @param[in] gr_type Who executed Graceful restart
* @param[in] vty Virtual terminal for log output * @param[in] vty Virtual terminal for log output
* *

View File

@ -446,8 +446,7 @@ void isis_adj_print_vty(struct isis_adjacency *adj, struct vty *vty,
adj->dis_record[ISIS_LEVELS + level - 1] adj->dis_record[ISIS_LEVELS + level - 1]
.dis), .dis),
adj->dischanges[level - 1], adj->dischanges[level - 1],
time2string(now time2string(now - (adj->dis_record[ISIS_LEVELS
- (adj->dis_record[ISIS_LEVELS
+ level - 1] + level - 1]
.last_dis_change))); .last_dis_change)));
} }

View File

@ -1270,9 +1270,7 @@ int isis_circuit_passwd_hmac_md5_set(struct isis_circuit *circuit,
passwd); passwd);
} }
struct cmd_node interface_node = { struct cmd_node interface_node = {
INTERFACE_NODE, INTERFACE_NODE, "%s(config-if)# ", 1,
"%s(config-if)# ",
1,
}; };
int isis_circuit_circ_type_set(struct isis_circuit *circuit, int circ_type) int isis_circuit_circ_type_set(struct isis_circuit *circuit, int circ_type)

View File

@ -838,29 +838,25 @@ static void lsp_print_mt_ipv6_reach(struct list *list, struct vty *vty,
if (mtid == ISIS_MT_IPV4_UNICAST) { if (mtid == ISIS_MT_IPV4_UNICAST) {
if ((ipv6_reach->control_info & CTRL_INFO_DISTRIBUTION) if ((ipv6_reach->control_info & CTRL_INFO_DISTRIBUTION)
== DISTRIBUTION_INTERNAL) == DISTRIBUTION_INTERNAL)
vty_out(vty, vty_out(vty, " Metric : %-8" PRIu32
" Metric : %-8" PRIu32
" IPv6-Internal : %s/%d\n", " IPv6-Internal : %s/%d\n",
ntohl(ipv6_reach->metric), buff, ntohl(ipv6_reach->metric), buff,
ipv6_reach->prefix_len); ipv6_reach->prefix_len);
else else
vty_out(vty, vty_out(vty, " Metric : %-8" PRIu32
" Metric : %-8" PRIu32
" IPv6-External : %s/%d\n", " IPv6-External : %s/%d\n",
ntohl(ipv6_reach->metric), buff, ntohl(ipv6_reach->metric), buff,
ipv6_reach->prefix_len); ipv6_reach->prefix_len);
} else { } else {
if ((ipv6_reach->control_info & CTRL_INFO_DISTRIBUTION) if ((ipv6_reach->control_info & CTRL_INFO_DISTRIBUTION)
== DISTRIBUTION_INTERNAL) == DISTRIBUTION_INTERNAL)
vty_out(vty, vty_out(vty, " Metric : %-8" PRIu32
" Metric : %-8" PRIu32
" IPv6-MT-Int : %s/%d %s\n", " IPv6-MT-Int : %s/%d %s\n",
ntohl(ipv6_reach->metric), buff, ntohl(ipv6_reach->metric), buff,
ipv6_reach->prefix_len, ipv6_reach->prefix_len,
isis_mtid2str(mtid)); isis_mtid2str(mtid));
else else
vty_out(vty, vty_out(vty, " Metric : %-8" PRIu32
" Metric : %-8" PRIu32
" IPv6-MT-Ext : %s/%d %s\n", " IPv6-MT-Ext : %s/%d %s\n",
ntohl(ipv6_reach->metric), buff, ntohl(ipv6_reach->metric), buff,
ipv6_reach->prefix_len, ipv6_reach->prefix_len,
@ -879,8 +875,7 @@ static void lsp_print_mt_ipv4_reach(struct list *list, struct vty *vty,
if (mtid == ISIS_MT_IPV4_UNICAST) { if (mtid == ISIS_MT_IPV4_UNICAST) {
/* FIXME: There should be better way to output this /* FIXME: There should be better way to output this
* stuff. */ * stuff. */
vty_out(vty, vty_out(vty, " Metric : %-8" PRIu32
" Metric : %-8" PRIu32
" IPv4-Extended : %s/%d\n", " IPv4-Extended : %s/%d\n",
ntohl(te_ipv4_reach->te_metric), ntohl(te_ipv4_reach->te_metric),
inet_ntoa(newprefix2inaddr( inet_ntoa(newprefix2inaddr(
@ -890,8 +885,7 @@ static void lsp_print_mt_ipv4_reach(struct list *list, struct vty *vty,
} else { } else {
/* FIXME: There should be better way to output this /* FIXME: There should be better way to output this
* stuff. */ * stuff. */
vty_out(vty, vty_out(vty, " Metric : %-8" PRIu32
" Metric : %-8" PRIu32
" IPv4-MT : %s/%d %s\n", " IPv4-MT : %s/%d %s\n",
ntohl(te_ipv4_reach->te_metric), ntohl(te_ipv4_reach->te_metric),
inet_ntoa(newprefix2inaddr( inet_ntoa(newprefix2inaddr(
@ -993,8 +987,7 @@ void lsp_print_detail(struct isis_lsp *lsp, struct vty *vty, char dynhost)
for (ALL_LIST_ELEMENTS_RO(lsp->tlv_data.is_neighs, lnode, for (ALL_LIST_ELEMENTS_RO(lsp->tlv_data.is_neighs, lnode,
is_neigh)) { is_neigh)) {
lspid_print(is_neigh->neigh_id, LSPid, dynhost, 0); lspid_print(is_neigh->neigh_id, LSPid, dynhost, 0);
vty_out(vty, vty_out(vty, " Metric : %-8" PRIu8
" Metric : %-8" PRIu8
" IS : %s\n", " IS : %s\n",
is_neigh->metrics.metric_default, LSPid); is_neigh->metrics.metric_default, LSPid);
} }
@ -1007,8 +1000,7 @@ void lsp_print_detail(struct isis_lsp *lsp, struct vty *vty, char dynhost)
sizeof(ipv4_reach_prefix)); sizeof(ipv4_reach_prefix));
memcpy(ipv4_reach_mask, inet_ntoa(ipv4_reach->mask), memcpy(ipv4_reach_mask, inet_ntoa(ipv4_reach->mask),
sizeof(ipv4_reach_mask)); sizeof(ipv4_reach_mask));
vty_out(vty, vty_out(vty, " Metric : %-8" PRIu8
" Metric : %-8" PRIu8
" IPv4-Internal : %s %s\n", " IPv4-Internal : %s %s\n",
ipv4_reach->metrics.metric_default, ipv4_reach->metrics.metric_default,
ipv4_reach_prefix, ipv4_reach_mask); ipv4_reach_prefix, ipv4_reach_mask);
@ -1022,8 +1014,7 @@ void lsp_print_detail(struct isis_lsp *lsp, struct vty *vty, char dynhost)
sizeof(ipv4_reach_prefix)); sizeof(ipv4_reach_prefix));
memcpy(ipv4_reach_mask, inet_ntoa(ipv4_reach->mask), memcpy(ipv4_reach_mask, inet_ntoa(ipv4_reach->mask),
sizeof(ipv4_reach_mask)); sizeof(ipv4_reach_mask));
vty_out(vty, vty_out(vty, " Metric : %-8" PRIu8
" Metric : %-8" PRIu8
" IPv4-External : %s %s\n", " IPv4-External : %s %s\n",
ipv4_reach->metrics.metric_default, ipv4_reach->metrics.metric_default,
ipv4_reach_prefix, ipv4_reach_mask); ipv4_reach_prefix, ipv4_reach_mask);
@ -2763,8 +2754,8 @@ int lsp_regenerate_schedule_pseudo(struct isis_circuit *circuit, int level)
THREAD_TIMER_OFF(circuit->u.bc.t_refresh_pseudo_lsp[lvl - 1]); THREAD_TIMER_OFF(circuit->u.bc.t_refresh_pseudo_lsp[lvl - 1]);
diff = now - lsp->last_generated; diff = now - lsp->last_generated;
if (diff < circuit->area->lsp_gen_interval[lvl - 1]) { if (diff < circuit->area->lsp_gen_interval[lvl - 1]) {
timeout = 1000 timeout =
* (circuit->area->lsp_gen_interval[lvl - 1] 1000 * (circuit->area->lsp_gen_interval[lvl - 1]
- diff); - diff);
sched_debug( sched_debug(
"ISIS (%s): Sechduling in %ld ms to match configured lsp_gen_interval", "ISIS (%s): Sechduling in %ld ms to match configured lsp_gen_interval",
@ -2990,8 +2981,8 @@ void lsp_purge_non_exist(int level, struct isis_link_state_hdr *lsp_hdr,
lsp->level = level; lsp->level = level;
lsp->pdu = stream_new(LLC_LEN + area->lsp_mtu); lsp->pdu = stream_new(LLC_LEN + area->lsp_mtu);
lsp->isis_header = (struct isis_fixed_hdr *)STREAM_DATA(lsp->pdu); lsp->isis_header = (struct isis_fixed_hdr *)STREAM_DATA(lsp->pdu);
fill_fixed_hdr(lsp->isis_header, (lsp->level == IS_LEVEL_1) fill_fixed_hdr(lsp->isis_header,
? L1_LINK_STATE (lsp->level == IS_LEVEL_1) ? L1_LINK_STATE
: L2_LINK_STATE); : L2_LINK_STATE);
lsp->lsp_header = (struct isis_link_state_hdr *)(STREAM_DATA(lsp->pdu) lsp->lsp_header = (struct isis_link_state_hdr *)(STREAM_DATA(lsp->pdu)
+ ISIS_FIXED_HDR_LEN); + ISIS_FIXED_HDR_LEN);

View File

@ -1391,7 +1391,8 @@ dontcheckadj:
lsp_set_all_srmflags(lsp); lsp_set_all_srmflags(lsp);
/* v */ /* v */
ISIS_FLAGS_CLEAR_ALL( ISIS_FLAGS_CLEAR_ALL(
lsp->SSNflags); /* FIXME: lsp
->SSNflags); /* FIXME:
OTHER OTHER
than c than c
*/ */

View File

@ -47,7 +47,8 @@
extern struct zebra_privs_t isisd_privs; extern struct zebra_privs_t isisd_privs;
/* tcpdump -i eth0 'isis' -dd */ /* tcpdump -i eth0 'isis' -dd */
static struct sock_filter isisfilter[] = { static struct sock_filter isisfilter[] =
{
/* NB: we're in SOCK_DGRAM, so src/dst mac + length are stripped /* NB: we're in SOCK_DGRAM, so src/dst mac + length are stripped
* off! * off!
* (OTOH it's a bit more lower-layer agnostic and might work * (OTOH it's a bit more lower-layer agnostic and might work

View File

@ -389,9 +389,9 @@ static void isis_redist_update_zebra_subscriptions(struct isis *isis)
for (protocol = 0; protocol < REDIST_PROTOCOL_COUNT; protocol++) for (protocol = 0; protocol < REDIST_PROTOCOL_COUNT; protocol++)
for (type = 0; type < ZEBRA_ROUTE_MAX + 1; type++) for (type = 0; type < ZEBRA_ROUTE_MAX + 1; type++)
for (level = 0; level < ISIS_LEVELS; level++) for (level = 0; level < ISIS_LEVELS; level++)
if (area->redist_settings if (area->redist_settings[protocol]
[protocol][type][level] [type]
.redist) [level].redist)
do_subscribe[protocol][type] = do_subscribe[protocol][type] =
1; 1;

View File

@ -366,7 +366,8 @@ static struct isis_vertex *isis_spf_add_root(struct isis_spftree *spftree,
zlog_warn("ISIS-Spf: could not find own l%d LSP!", zlog_warn("ISIS-Spf: could not find own l%d LSP!",
spftree->level); spftree->level);
vertex = isis_vertex_new(id, spftree->area->oldmetric vertex = isis_vertex_new(id,
spftree->area->oldmetric
? VTYPE_NONPSEUDO_IS ? VTYPE_NONPSEUDO_IS
: VTYPE_NONPSEUDO_TE_IS); : VTYPE_NONPSEUDO_TE_IS);
listnode_add(spftree->paths, vertex); listnode_add(spftree->paths, vertex);
@ -507,12 +508,10 @@ static void isis_spf_add_local(struct isis_spftree *spftree,
/* d) */ /* d) */
if (listcount(vertex->Adj_N) > ISIS_MAX_PATH_SPLITS) if (listcount(vertex->Adj_N) > ISIS_MAX_PATH_SPLITS)
remove_excess_adjs(vertex->Adj_N); remove_excess_adjs(vertex->Adj_N);
if (parent if (parent && (listnode_lookup(vertex->parents, parent)
&& (listnode_lookup(vertex->parents, parent)
== NULL)) == NULL))
listnode_add(vertex->parents, parent); listnode_add(vertex->parents, parent);
if (parent if (parent && (listnode_lookup(parent->children, vertex)
&& (listnode_lookup(parent->children, vertex)
== NULL)) == NULL))
listnode_add(parent->children, vertex); listnode_add(parent->children, vertex);
return; return;
@ -650,8 +649,7 @@ static int isis_spf_process_lsp(struct isis_spftree *spftree,
mt_router_info = tlvs_lookup_mt_router_info(&lsp->tlv_data, mt_router_info = tlvs_lookup_mt_router_info(&lsp->tlv_data,
spftree->mtid); spftree->mtid);
if (!pseudo_lsp if (!pseudo_lsp && (spftree->mtid == ISIS_MT_IPV4_UNICAST
&& (spftree->mtid == ISIS_MT_IPV4_UNICAST
&& !speaks(lsp->tlv_data.nlpids, spftree->family)) && !speaks(lsp->tlv_data.nlpids, spftree->family))
&& !mt_router_info) && !mt_router_info)
return ISIS_OK; return ISIS_OK;
@ -669,8 +667,7 @@ lspfragloop:
#endif /* EXTREME_DEBUG */ #endif /* EXTREME_DEBUG */
/* RFC3787 section 4 SHOULD ignore overload bit in pseudo LSPs */ /* RFC3787 section 4 SHOULD ignore overload bit in pseudo LSPs */
if (pseudo_lsp if (pseudo_lsp || (spftree->mtid == ISIS_MT_IPV4_UNICAST
|| (spftree->mtid == ISIS_MT_IPV4_UNICAST
&& !ISIS_MASK_LSP_OL_BIT(lsp->lsp_header->lsp_bits)) && !ISIS_MASK_LSP_OL_BIT(lsp->lsp_header->lsp_bits))
|| (mt_router_info && !mt_router_info->overload)) || (mt_router_info && !mt_router_info->overload))

View File

@ -56,23 +56,19 @@ struct host host;
/* Standard command node structures. */ /* Standard command node structures. */
static struct cmd_node auth_node = { static struct cmd_node auth_node = {
AUTH_NODE, AUTH_NODE, "Password: ",
"Password: ",
}; };
static struct cmd_node view_node = { static struct cmd_node view_node = {
VIEW_NODE, VIEW_NODE, "%s> ",
"%s> ",
}; };
static struct cmd_node auth_enable_node = { static struct cmd_node auth_enable_node = {
AUTH_ENABLE_NODE, AUTH_ENABLE_NODE, "Password: ",
"Password: ",
}; };
static struct cmd_node enable_node = { static struct cmd_node enable_node = {
ENABLE_NODE, ENABLE_NODE, "%s# ",
"%s# ",
}; };
static struct cmd_node config_node = {CONFIG_NODE, "%s(config)# ", 1}; static struct cmd_node config_node = {CONFIG_NODE, "%s(config)# ", 1};
@ -653,8 +649,7 @@ void cmd_variable_complete(struct cmd_token *token, const char *arg,
for (ALL_LIST_ELEMENTS_RO(varhandlers, ln, cvh)) { for (ALL_LIST_ELEMENTS_RO(varhandlers, ln, cvh)) {
if (cvh->tokenname && strcmp(cvh->tokenname, token->text)) if (cvh->tokenname && strcmp(cvh->tokenname, token->text))
continue; continue;
if (cvh->varname if (cvh->varname && (!token->varname
&& (!token->varname
|| strcmp(cvh->varname, token->varname))) || strcmp(cvh->varname, token->varname)))
continue; continue;
cvh->completions(tmpcomps, token); cvh->completions(tmpcomps, token);
@ -1500,8 +1495,7 @@ DEFUN (config_write,
struct stat conf_stat; struct stat conf_stat;
// if command was 'write terminal' or 'show running-config' // if command was 'write terminal' or 'show running-config'
if (argc == 2 if (argc == 2 && (strmatch(argv[idx_type]->text, "terminal")
&& (strmatch(argv[idx_type]->text, "terminal")
|| strmatch(argv[0]->text, "show"))) { || strmatch(argv[0]->text, "show"))) {
vty_write_config(vty); vty_write_config(vty);
return CMD_SUCCESS; return CMD_SUCCESS;

View File

@ -619,8 +619,7 @@ int long_only;
if (longopts != NULL if (longopts != NULL
&& (argv[optind][1] == '-' && (argv[optind][1] == '-'
|| (long_only || (long_only && (argv[optind][2]
&& (argv[optind][2]
|| !my_index(optstring, argv[optind][1]))))) { || !my_index(optstring, argv[optind][1]))))) {
char *nameend; char *nameend;
const struct option *p; const struct option *p;

View File

@ -161,8 +161,7 @@ extern void _hook_unregister(struct hook *hook, void *funcptr, void *arg,
*/ */
#define DEFINE_HOOK(hookname, arglist, passlist) \ #define DEFINE_HOOK(hookname, arglist, passlist) \
struct hook _hook_##hookname = { \ struct hook _hook_##hookname = { \
.name = #hookname, \ .name = #hookname, .entries = NULL, \
.entries = NULL, \
}; \ }; \
static int hook_call_##hookname arglist \ static int hook_call_##hookname arglist \
{ \ { \

View File

@ -1063,7 +1063,8 @@ void zlog_hexdump(const void *mem, unsigned int len)
printing */ printing */
s += sprintf(s, " "); s += sprintf(s, " ");
else if (isprint((int)((const char *)mem) else if (
isprint((int)((const char *)mem)
[j])) /* printable char [j])) /* printable char
*/ */
s += sprintf( s += sprintf(

View File

@ -509,9 +509,7 @@ int _rb_check(const struct rb_type *, void *, unsigned long);
return _cmp(l, r); \ return _cmp(l, r); \
} \ } \
static const struct rb_type _name##_RB_INFO = { \ static const struct rb_type _name##_RB_INFO = { \
_name##_RB_COMPARE, \ _name##_RB_COMPARE, _aug, offsetof(struct _type, _field), \
_aug, \
offsetof(struct _type, _field), \
}; \ }; \
const struct rb_type *const _name##_RB_TYPE = &_name##_RB_INFO; const struct rb_type *const _name##_RB_TYPE = &_name##_RB_INFO;

View File

@ -1918,8 +1918,7 @@ int prefix_bgp_show_prefix_list(struct vty *vty, afi_t afi, char *name,
json_object_object_add(json, "ipv6PrefixList", json_object_object_add(json, "ipv6PrefixList",
json_prefix); json_prefix);
vty_out(vty, "%s\n", vty_out(vty, "%s\n", json_object_to_json_string_ext(
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} else { } else {

View File

@ -1151,9 +1151,8 @@ const char *prefix2str(union prefixconstptr pu, char *str, int size)
switch (p->family) { switch (p->family) {
case AF_INET: case AF_INET:
case AF_INET6: case AF_INET6:
snprintf(str, size, "%s/%d", snprintf(str, size, "%s/%d", inet_ntop(p->family, &p->u.prefix,
inet_ntop(p->family, &p->u.prefix, buf, buf, PREFIX2STR_BUFFER),
PREFIX2STR_BUFFER),
p->prefixlen); p->prefixlen);
break; break;

View File

@ -101,23 +101,19 @@ static struct {
#ifdef HAVE_LCAPS /* Quagga -> Linux capabilities mappings */ #ifdef HAVE_LCAPS /* Quagga -> Linux capabilities mappings */
[ZCAP_SETID] = [ZCAP_SETID] =
{ {
2, 2, (pvalue_t[]){CAP_SETGID, CAP_SETUID},
(pvalue_t[]){CAP_SETGID, CAP_SETUID},
}, },
[ZCAP_BIND] = [ZCAP_BIND] =
{ {
1, 1, (pvalue_t[]){CAP_NET_BIND_SERVICE},
(pvalue_t[]){CAP_NET_BIND_SERVICE},
}, },
[ZCAP_NET_ADMIN] = [ZCAP_NET_ADMIN] =
{ {
1, 1, (pvalue_t[]){CAP_NET_ADMIN},
(pvalue_t[]){CAP_NET_ADMIN},
}, },
[ZCAP_NET_RAW] = [ZCAP_NET_RAW] =
{ {
1, 1, (pvalue_t[]){CAP_NET_RAW},
(pvalue_t[]){CAP_NET_RAW},
}, },
[ZCAP_CHROOT] = [ZCAP_CHROOT] =
{ {
@ -128,101 +124,87 @@ static struct {
}, },
[ZCAP_NICE] = [ZCAP_NICE] =
{ {
1, 1, (pvalue_t[]){CAP_SYS_NICE},
(pvalue_t[]){CAP_SYS_NICE},
}, },
[ZCAP_PTRACE] = [ZCAP_PTRACE] =
{ {
1, 1, (pvalue_t[]){CAP_SYS_PTRACE},
(pvalue_t[]){CAP_SYS_PTRACE},
}, },
[ZCAP_DAC_OVERRIDE] = [ZCAP_DAC_OVERRIDE] =
{ {
1, 1, (pvalue_t[]){CAP_DAC_OVERRIDE},
(pvalue_t[]){CAP_DAC_OVERRIDE},
}, },
[ZCAP_READ_SEARCH] = [ZCAP_READ_SEARCH] =
{ {
1, 1, (pvalue_t[]){CAP_DAC_READ_SEARCH},
(pvalue_t[]){CAP_DAC_READ_SEARCH},
}, },
[ZCAP_SYS_ADMIN] = [ZCAP_SYS_ADMIN] =
{ {
1, 1, (pvalue_t[]){CAP_SYS_ADMIN},
(pvalue_t[]){CAP_SYS_ADMIN},
}, },
[ZCAP_FOWNER] = [ZCAP_FOWNER] =
{ {
1, 1, (pvalue_t[]){CAP_FOWNER},
(pvalue_t[]){CAP_FOWNER},
}, },
#elif defined(HAVE_SOLARIS_CAPABILITIES) /* HAVE_LCAPS */ #elif defined(HAVE_SOLARIS_CAPABILITIES) /* HAVE_LCAPS */
/* Quagga -> Solaris privilege mappings */ /* Quagga -> Solaris privilege mappings */
[ZCAP_SETID] = [ZCAP_SETID] =
{ {
1, 1, (pvalue_t[]){PRIV_PROC_SETID},
(pvalue_t[]){PRIV_PROC_SETID},
}, },
[ZCAP_BIND] = [ZCAP_BIND] =
{ {
1, 1, (pvalue_t[]){PRIV_NET_PRIVADDR},
(pvalue_t[]){PRIV_NET_PRIVADDR},
}, },
/* IP_CONFIG is a subset of NET_CONFIG and is allowed in zones */ /* IP_CONFIG is a subset of NET_CONFIG and is allowed in zones */
#ifdef PRIV_SYS_IP_CONFIG #ifdef PRIV_SYS_IP_CONFIG
[ZCAP_NET_ADMIN] = [ZCAP_NET_ADMIN] =
{ {
1, 1, (pvalue_t[]){PRIV_SYS_IP_CONFIG},
(pvalue_t[]){PRIV_SYS_IP_CONFIG},
}, },
#else #else
[ZCAP_NET_ADMIN] = [ZCAP_NET_ADMIN] =
{ {
1, 1, (pvalue_t[]){PRIV_SYS_NET_CONFIG},
(pvalue_t[]){PRIV_SYS_NET_CONFIG},
}, },
#endif #endif
[ZCAP_NET_RAW] = [ZCAP_NET_RAW] =
{ {
2, 2, (pvalue_t[]){PRIV_NET_RAWACCESS,
(pvalue_t[]){PRIV_NET_RAWACCESS, PRIV_NET_ICMPACCESS}, PRIV_NET_ICMPACCESS},
}, },
[ZCAP_CHROOT] = [ZCAP_CHROOT] =
{ {
1, 1, (pvalue_t[]){PRIV_PROC_CHROOT},
(pvalue_t[]){PRIV_PROC_CHROOT},
}, },
[ZCAP_NICE] = [ZCAP_NICE] =
{ {
1, 1, (pvalue_t[]){PRIV_PROC_PRIOCNTL},
(pvalue_t[]){PRIV_PROC_PRIOCNTL},
}, },
[ZCAP_PTRACE] = [ZCAP_PTRACE] =
{ {
1, 1, (pvalue_t[]){PRIV_PROC_SESSION},
(pvalue_t[]){PRIV_PROC_SESSION},
}, },
[ZCAP_DAC_OVERRIDE] = [ZCAP_DAC_OVERRIDE] =
{ {
5, 5, (pvalue_t[]){PRIV_FILE_DAC_EXECUTE,
(pvalue_t[]){PRIV_FILE_DAC_EXECUTE, PRIV_FILE_DAC_READ, PRIV_FILE_DAC_READ,
PRIV_FILE_DAC_SEARCH, PRIV_FILE_DAC_WRITE, PRIV_FILE_DAC_SEARCH,
PRIV_FILE_DAC_WRITE,
PRIV_FILE_DAC_SEARCH}, PRIV_FILE_DAC_SEARCH},
}, },
[ZCAP_READ_SEARCH] = [ZCAP_READ_SEARCH] =
{ {
2, 2, (pvalue_t[]){PRIV_FILE_DAC_SEARCH,
(pvalue_t[]){PRIV_FILE_DAC_SEARCH, PRIV_FILE_DAC_READ}, PRIV_FILE_DAC_READ},
}, },
[ZCAP_SYS_ADMIN] = [ZCAP_SYS_ADMIN] =
{ {
1, 1, (pvalue_t[]){PRIV_SYS_ADMIN},
(pvalue_t[]){PRIV_SYS_ADMIN},
}, },
[ZCAP_FOWNER] = [ZCAP_FOWNER] =
{ {
1, 1, (pvalue_t[]){PRIV_FILE_OWNER},
(pvalue_t[]){PRIV_FILE_OWNER},
}, },
#endif /* HAVE_SOLARIS_CAPABILITIES */ #endif /* HAVE_SOLARIS_CAPABILITIES */
}; };

View File

@ -1232,8 +1232,7 @@ int route_map_delete_match(struct route_map_index *index,
return 1; return 1;
for (rule = index->match_list.head; rule; rule = rule->next) for (rule = index->match_list.head; rule; rule = rule->next)
if (rule->cmd == cmd if (rule->cmd == cmd && (rulecmp(rule->rule_str, match_arg) == 0
&& (rulecmp(rule->rule_str, match_arg) == 0
|| match_arg == NULL)) { || match_arg == NULL)) {
route_map_rule_delete(&index->match_list, rule); route_map_rule_delete(&index->match_list, rule);
/* Execute event hook. */ /* Execute event hook. */
@ -1320,8 +1319,7 @@ int route_map_delete_set(struct route_map_index *index, const char *set_name,
return 1; return 1;
for (rule = index->set_list.head; rule; rule = rule->next) for (rule = index->set_list.head; rule; rule = rule->next)
if ((rule->cmd == cmd) if ((rule->cmd == cmd) && (rulecmp(rule->rule_str, set_arg) == 0
&& (rulecmp(rule->rule_str, set_arg) == 0
|| set_arg == NULL)) { || set_arg == NULL)) {
route_map_rule_delete(&index->set_list, rule); route_map_rule_delete(&index->set_list, rule);
/* Execute event hook. */ /* Execute event hook. */

View File

@ -210,24 +210,21 @@ static void smux_getresp_send(oid objid[], size_t objid_len, long reqid,
ptr = asn_build_sequence(ptr, &len, (u_char)SMUX_GETRSP, 0); ptr = asn_build_sequence(ptr, &len, (u_char)SMUX_GETRSP, 0);
h1e = ptr; h1e = ptr;
ptr = asn_build_int( ptr = asn_build_int(ptr, &len, (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE
ptr, &len, | ASN_INTEGER),
(u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER), &reqid, &reqid, sizeof(reqid));
sizeof(reqid));
if (debug_smux) if (debug_smux)
zlog_debug("SMUX GETRSP errstat: %ld", errstat); zlog_debug("SMUX GETRSP errstat: %ld", errstat);
ptr = asn_build_int( ptr = asn_build_int(ptr, &len, (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE
ptr, &len, | ASN_INTEGER),
(u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER), &errstat, &errstat, sizeof(errstat));
sizeof(errstat));
if (debug_smux) if (debug_smux)
zlog_debug("SMUX GETRSP errindex: %ld", errindex); zlog_debug("SMUX GETRSP errindex: %ld", errindex);
ptr = asn_build_int( ptr = asn_build_int(ptr, &len, (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE
ptr, &len, | ASN_INTEGER),
(u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER),
&errindex, sizeof(errindex)); &errindex, sizeof(errindex));
h2 = ptr; h2 = ptr;
@ -887,27 +884,23 @@ static int smux_open(int sock)
/* SMUX Open. */ /* SMUX Open. */
version = 0; version = 0;
ptr = asn_build_int( ptr = asn_build_int(ptr, &len, (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE
ptr, &len, | ASN_INTEGER),
(u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER), &version, &version, sizeof(version));
sizeof(version));
/* SMUX connection oid. */ /* SMUX connection oid. */
ptr = asn_build_objid( ptr = asn_build_objid(ptr, &len, (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE
ptr, &len, | ASN_OBJECT_ID),
(u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OBJECT_ID),
smux_oid, smux_oid_len); smux_oid, smux_oid_len);
/* SMUX connection description. */ /* SMUX connection description. */
ptr = asn_build_string( ptr = asn_build_string(ptr, &len, (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE
ptr, &len, | ASN_OCTET_STR),
(u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR),
(const u_char *)progname, strlen(progname)); (const u_char *)progname, strlen(progname));
/* SMUX connection password. */ /* SMUX connection password. */
ptr = asn_build_string( ptr = asn_build_string(ptr, &len, (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE
ptr, &len, | ASN_OCTET_STR),
(u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR),
(u_char *)smux_passwd, strlen(smux_passwd)); (u_char *)smux_passwd, strlen(smux_passwd));
/* Fill in real SMUX header. We exclude ASN header size (2). */ /* Fill in real SMUX header. We exclude ASN header size (2). */
@ -948,30 +941,26 @@ int smux_trap(struct variable *vp, size_t vp_len, const oid *ename,
ptr = asn_build_header(ptr, &len, (u_char)SMUX_TRAP, 0); ptr = asn_build_header(ptr, &len, (u_char)SMUX_TRAP, 0);
/* Sub agent enterprise oid. */ /* Sub agent enterprise oid. */
ptr = asn_build_objid( ptr = asn_build_objid(ptr, &len, (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE
ptr, &len, | ASN_OBJECT_ID),
(u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OBJECT_ID),
smux_oid, smux_oid_len); smux_oid, smux_oid_len);
/* IP address. */ /* IP address. */
addr.s_addr = 0; addr.s_addr = 0;
ptr = asn_build_string( ptr = asn_build_string(ptr, &len, (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE
ptr, &len, | ASN_IPADDRESS),
(u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_IPADDRESS),
(u_char *)&addr, sizeof(addr)); (u_char *)&addr, sizeof(addr));
/* Generic trap integer. */ /* Generic trap integer. */
val = SNMP_TRAP_ENTERPRISESPECIFIC; val = SNMP_TRAP_ENTERPRISESPECIFIC;
ptr = asn_build_int( ptr = asn_build_int(ptr, &len, (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE
ptr, &len, | ASN_INTEGER),
(u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER),
(long *)&val, sizeof(val)); (long *)&val, sizeof(val));
/* Specific trap integer. */ /* Specific trap integer. */
val = sptrap; val = sptrap;
ptr = asn_build_int( ptr = asn_build_int(ptr, &len, (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE
ptr, &len, | ASN_INTEGER),
(u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER),
(long *)&val, sizeof(val)); (long *)&val, sizeof(val));
/* Timeticks timestamp. */ /* Timeticks timestamp. */

View File

@ -261,8 +261,7 @@ int setsockopt_ipv4_multicast(int sock, int optname, struct in_addr if_addr,
zlog_info( zlog_info(
"setsockopt_ipv4_multicast attempting to drop and " "setsockopt_ipv4_multicast attempting to drop and "
"re-add (fd %d, mcast %s, ifindex %u)", "re-add (fd %d, mcast %s, ifindex %u)",
sock, sock, inet_ntop(AF_INET, &mreqn.imr_multiaddr, buf[0],
inet_ntop(AF_INET, &mreqn.imr_multiaddr, buf[0],
sizeof(buf[0])), sizeof(buf[0])),
ifindex); ifindex);
setsockopt(sock, IPPROTO_IP, IP_DROP_MEMBERSHIP, (void *)&mreqn, setsockopt(sock, IPPROTO_IP, IP_DROP_MEMBERSHIP, (void *)&mreqn,
@ -304,8 +303,7 @@ int setsockopt_ipv4_multicast(int sock, int optname, struct in_addr if_addr,
zlog_info( zlog_info(
"setsockopt_ipv4_multicast attempting to drop and " "setsockopt_ipv4_multicast attempting to drop and "
"re-add (fd %d, mcast %s, ifindex %u)", "re-add (fd %d, mcast %s, ifindex %u)",
sock, sock, inet_ntop(AF_INET, &mreq.imr_multiaddr, buf[0],
inet_ntop(AF_INET, &mreq.imr_multiaddr, buf[0],
sizeof(buf[0])), sizeof(buf[0])),
ifindex); ifindex);
setsockopt(sock, IPPROTO_IP, IP_DROP_MEMBERSHIP, (void *)&mreq, setsockopt(sock, IPPROTO_IP, IP_DROP_MEMBERSHIP, (void *)&mreq,

View File

@ -2822,9 +2822,7 @@ static int vty_config_write(struct vty *vty)
} }
struct cmd_node vty_node = { struct cmd_node vty_node = {
VTY_NODE, VTY_NODE, "%s(config-line)# ", 1,
"%s(config-line)# ",
1,
}; };
/* Reset all VTY status. */ /* Reset all VTY status. */

View File

@ -34,8 +34,7 @@ extern void _zlog_assert_failed(const char *assertion, const char *file,
#endif #endif
#define zassert(EX) \ #define zassert(EX) \
((void)((EX) ? 0 \ ((void)((EX) ? 0 : (_zlog_assert_failed(#EX, __FILE__, __LINE__, \
: (_zlog_assert_failed(#EX, __FILE__, __LINE__, \
__ASSERT_FUNCTION), \ __ASSERT_FUNCTION), \
0))) 0)))

View File

@ -1480,8 +1480,7 @@ struct connected *zebra_interface_address_read(int type, struct stream *s,
zlog_warn( zlog_warn(
"warning: interface %s address %s " "warning: interface %s address %s "
"with peer flag set, but no peer address!", "with peer flag set, but no peer address!",
ifp->name, ifp->name, prefix2str(ifc->address, buf,
prefix2str(ifc->address, buf,
sizeof buf)); sizeof buf));
UNSET_FLAG(ifc->flags, ZEBRA_IFA_PEER); UNSET_FLAG(ifc->flags, ZEBRA_IFA_PEER);
} }

View File

@ -848,9 +848,7 @@ static route_map_result_t ospf6_routemap_rule_match_tag(void *rule,
} }
static struct route_map_rule_cmd ospf6_routemap_rule_match_tag_cmd = { static struct route_map_rule_cmd ospf6_routemap_rule_match_tag_cmd = {
"tag", "tag", ospf6_routemap_rule_match_tag, route_map_rule_tag_compile,
ospf6_routemap_rule_match_tag,
route_map_rule_tag_compile,
route_map_rule_tag_free, route_map_rule_tag_free,
}; };
@ -885,8 +883,7 @@ static void ospf6_routemap_rule_set_metric_type_free(void *rule)
} }
struct route_map_rule_cmd ospf6_routemap_rule_set_metric_type_cmd = { struct route_map_rule_cmd ospf6_routemap_rule_set_metric_type_cmd = {
"metric-type", "metric-type", ospf6_routemap_rule_set_metric_type,
ospf6_routemap_rule_set_metric_type,
ospf6_routemap_rule_set_metric_type_compile, ospf6_routemap_rule_set_metric_type_compile,
ospf6_routemap_rule_set_metric_type_free, ospf6_routemap_rule_set_metric_type_free,
}; };
@ -921,8 +918,7 @@ static void ospf6_routemap_rule_set_metric_free(void *rule)
} }
struct route_map_rule_cmd ospf6_routemap_rule_set_metric_cmd = { struct route_map_rule_cmd ospf6_routemap_rule_set_metric_cmd = {
"metric", "metric", ospf6_routemap_rule_set_metric,
ospf6_routemap_rule_set_metric,
ospf6_routemap_rule_set_metric_compile, ospf6_routemap_rule_set_metric_compile,
ospf6_routemap_rule_set_metric_free, ospf6_routemap_rule_set_metric_free,
}; };
@ -960,8 +956,7 @@ static void ospf6_routemap_rule_set_forwarding_free(void *rule)
} }
struct route_map_rule_cmd ospf6_routemap_rule_set_forwarding_cmd = { struct route_map_rule_cmd ospf6_routemap_rule_set_forwarding_cmd = {
"forwarding-address", "forwarding-address", ospf6_routemap_rule_set_forwarding,
ospf6_routemap_rule_set_forwarding,
ospf6_routemap_rule_set_forwarding_compile, ospf6_routemap_rule_set_forwarding_compile,
ospf6_routemap_rule_set_forwarding_free, ospf6_routemap_rule_set_forwarding_free,
}; };
@ -983,9 +978,7 @@ static route_map_result_t ospf6_routemap_rule_set_tag(void *rule,
} }
static struct route_map_rule_cmd ospf6_routemap_rule_set_tag_cmd = { static struct route_map_rule_cmd ospf6_routemap_rule_set_tag_cmd = {
"tag", "tag", ospf6_routemap_rule_set_tag, route_map_rule_tag_compile,
ospf6_routemap_rule_set_tag,
route_map_rule_tag_compile,
route_map_rule_tag_free, route_map_rule_tag_free,
}; };

View File

@ -1402,8 +1402,7 @@ DEFUN (ipv6_ospf6_priority,
oi->priority = strtol(argv[idx_number]->arg, NULL, 10); oi->priority = strtol(argv[idx_number]->arg, NULL, 10);
if (oi->area if (oi->area && (oi->state == OSPF6_INTERFACE_DROTHER
&& (oi->state == OSPF6_INTERFACE_DROTHER
|| oi->state == OSPF6_INTERFACE_BDR || oi->state == OSPF6_INTERFACE_BDR
|| oi->state == OSPF6_INTERFACE_DR)) || oi->state == OSPF6_INTERFACE_DR))
ospf6_interface_state_change(dr_election(oi), oi); ospf6_interface_state_change(dr_election(oi), oi);

View File

@ -73,8 +73,7 @@ static char *ospf6_router_lsa_get_nbr_id(struct ospf6_lsa *lsa, char *buf,
lsdesc = (struct ospf6_router_lsdesc lsdesc = (struct ospf6_router_lsdesc
*)(start *)(start
+ pos + pos * (sizeof(struct
* (sizeof(struct
ospf6_router_lsdesc))); ospf6_router_lsdesc)));
if ((char *)lsdesc < end) { if ((char *)lsdesc < end) {
if (buf && (buflen > INET_ADDRSTRLEN * 2)) { if (buf && (buflen > INET_ADDRSTRLEN * 2)) {

View File

@ -347,8 +347,7 @@ static int config_write_ospf6_zebra(struct vty *vty)
/* Zebra node structure. */ /* Zebra node structure. */
static struct cmd_node zebra_node = { static struct cmd_node zebra_node = {
ZEBRA_NODE, ZEBRA_NODE, "%s(config-zebra)# ",
"%s(config-zebra)# ",
}; };
#define ADD 0 #define ADD 0

View File

@ -1034,7 +1034,8 @@ static void ospf_abr_process_network_rt(struct ospf *ospf,
continue; continue;
} }
if (or->path_type == OSPF_PATH_INTRA_AREA if (
or->path_type == OSPF_PATH_INTRA_AREA
&& !ospf_abr_should_announce( && !ospf_abr_should_announce(
ospf, (struct prefix_ipv4 *)&rn->p, ospf, (struct prefix_ipv4 *)&rn->p,
or)) { or)) {
@ -1044,7 +1045,8 @@ static void ospf_abr_process_network_rt(struct ospf *ospf,
continue; continue;
} }
if (or->path_type == OSPF_PATH_INTRA_AREA if (
or->path_type == OSPF_PATH_INTRA_AREA
&& !ospf_abr_plist_out_check( && !ospf_abr_plist_out_check(
area, or, area, or,
(struct prefix_ipv4 *)&rn->p)) { (struct prefix_ipv4 *)&rn->p)) {
@ -1269,7 +1271,8 @@ static void ospf_abr_process_router_rt(struct ospf *ospf,
continue; continue;
} }
if (or->path_type == OSPF_PATH_INTER_AREA if (
or->path_type == OSPF_PATH_INTER_AREA
&& !OSPF_IS_AREA_ID_BACKBONE( && !OSPF_IS_AREA_ID_BACKBONE(
or->u.std.area_id)) { or->u.std.area_id)) {
if (IS_DEBUG_OSPF_EVENT) if (IS_DEBUG_OSPF_EVENT)

View File

@ -131,60 +131,46 @@ const char *ospf_api_typename(int msgtype)
{ {
struct nametab NameTab[] = { struct nametab NameTab[] = {
{ {
MSG_REGISTER_OPAQUETYPE, MSG_REGISTER_OPAQUETYPE, "Register opaque-type",
"Register opaque-type",
}, },
{ {
MSG_UNREGISTER_OPAQUETYPE, MSG_UNREGISTER_OPAQUETYPE, "Unregister opaque-type",
"Unregister opaque-type",
}, },
{ {
MSG_REGISTER_EVENT, MSG_REGISTER_EVENT, "Register event",
"Register event",
}, },
{ {
MSG_SYNC_LSDB, MSG_SYNC_LSDB, "Sync LSDB",
"Sync LSDB",
}, },
{ {
MSG_ORIGINATE_REQUEST, MSG_ORIGINATE_REQUEST, "Originate request",
"Originate request",
}, },
{ {
MSG_DELETE_REQUEST, MSG_DELETE_REQUEST, "Delete request",
"Delete request",
}, },
{ {
MSG_REPLY, MSG_REPLY, "Reply",
"Reply",
}, },
{ {
MSG_READY_NOTIFY, MSG_READY_NOTIFY, "Ready notify",
"Ready notify",
}, },
{ {
MSG_LSA_UPDATE_NOTIFY, MSG_LSA_UPDATE_NOTIFY, "LSA update notify",
"LSA update notify",
}, },
{ {
MSG_LSA_DELETE_NOTIFY, MSG_LSA_DELETE_NOTIFY, "LSA delete notify",
"LSA delete notify",
}, },
{ {
MSG_NEW_IF, MSG_NEW_IF, "New interface",
"New interface",
}, },
{ {
MSG_DEL_IF, MSG_DEL_IF, "Del interface",
"Del interface",
}, },
{ {
MSG_ISM_CHANGE, MSG_ISM_CHANGE, "ISM change",
"ISM change",
}, },
{ {
MSG_NSM_CHANGE, MSG_NSM_CHANGE, "NSM change",
"NSM change",
}, },
}; };
@ -205,48 +191,38 @@ const char *ospf_api_errname(int errcode)
{ {
struct nametab NameTab[] = { struct nametab NameTab[] = {
{ {
OSPF_API_OK, OSPF_API_OK, "OK",
"OK",
}, },
{ {
OSPF_API_NOSUCHINTERFACE, OSPF_API_NOSUCHINTERFACE, "No such interface",
"No such interface",
}, },
{ {
OSPF_API_NOSUCHAREA, OSPF_API_NOSUCHAREA, "No such area",
"No such area",
}, },
{ {
OSPF_API_NOSUCHLSA, OSPF_API_NOSUCHLSA, "No such LSA",
"No such LSA",
}, },
{ {
OSPF_API_ILLEGALLSATYPE, OSPF_API_ILLEGALLSATYPE, "Illegal LSA type",
"Illegal LSA type",
}, },
{ {
OSPF_API_OPAQUETYPEINUSE, OSPF_API_OPAQUETYPEINUSE, "Opaque type in use",
"Opaque type in use",
}, },
{ {
OSPF_API_OPAQUETYPENOTREGISTERED, OSPF_API_OPAQUETYPENOTREGISTERED,
"Opaque type not registered", "Opaque type not registered",
}, },
{ {
OSPF_API_NOTREADY, OSPF_API_NOTREADY, "Not ready",
"Not ready",
}, },
{ {
OSPF_API_NOMEMORY, OSPF_API_NOMEMORY, "No memory",
"No memory",
}, },
{ {
OSPF_API_ERROR, OSPF_API_ERROR, "Other error",
"Other error",
}, },
{ {
OSPF_API_UNDEF, OSPF_API_UNDEF, "Undefined",
"Undefined",
}, },
}; };

View File

@ -361,8 +361,10 @@ static void ospf_update_network_route(struct ospf *ospf, struct route_table *rt,
} }
if (ospf->abr_type == OSPF_ABR_SHORTCUT) { if (ospf->abr_type == OSPF_ABR_SHORTCUT) {
if (or->path_type == OSPF_PATH_INTRA_AREA if (
&& !OSPF_IS_AREA_ID_BACKBONE(or->u.std.area_id)) { or->path_type == OSPF_PATH_INTRA_AREA
&& !OSPF_IS_AREA_ID_BACKBONE(
or->u.std.area_id)) {
if (IS_DEBUG_OSPF_EVENT) if (IS_DEBUG_OSPF_EVENT)
zlog_debug( zlog_debug(
"ospf_update_network_route(): Shortcut: " "ospf_update_network_route(): Shortcut: "

View File

@ -428,8 +428,7 @@ struct ospf_interface *ospf_if_lookup_recv_if(struct ospf *ospf,
match = oi; match = oi;
else if (prefix_match(CONNECTED_PREFIX(oi->connected), else if (prefix_match(CONNECTED_PREFIX(oi->connected),
(struct prefix *)&addr)) { (struct prefix *)&addr)) {
if ((match == NULL) if ((match == NULL) || (match->address->prefixlen
|| (match->address->prefixlen
< oi->address->prefixlen)) < oi->address->prefixlen))
match = oi; match = oi;
} }

View File

@ -429,8 +429,8 @@ static char link_info_set(struct stream *s, struct in_addr id,
* *
* Simpler just to subtract OSPF_MAX_LSA_SIZE though. * Simpler just to subtract OSPF_MAX_LSA_SIZE though.
*/ */
ret = stream_resize(s, OSPF_MAX_PACKET_SIZE ret = stream_resize(
- OSPF_MAX_LSA_SIZE); s, OSPF_MAX_PACKET_SIZE - OSPF_MAX_LSA_SIZE);
} }
if (ret == OSPF_MAX_LSA_SIZE) { if (ret == OSPF_MAX_LSA_SIZE) {
@ -519,8 +519,7 @@ static int lsa_link_broadcast_set(struct stream *s, struct ospf_interface *oi)
dr = ospf_nbr_lookup_by_addr(oi->nbrs, &DR(oi)); dr = ospf_nbr_lookup_by_addr(oi->nbrs, &DR(oi));
/* Describe Type 2 link. */ /* Describe Type 2 link. */
if (dr if (dr && (dr->state == NSM_Full
&& (dr->state == NSM_Full
|| IPV4_ADDR_SAME(&oi->address->u.prefix4, &DR(oi))) || IPV4_ADDR_SAME(&oi->address->u.prefix4, &DR(oi)))
&& ospf_nbr_count(oi, NSM_Full) > 0) { && ospf_nbr_count(oi, NSM_Full) > 0) {
if (IS_DEBUG_OSPF(lsa, LSA_GENERATE)) if (IS_DEBUG_OSPF(lsa, LSA_GENERATE))

View File

@ -55,9 +55,7 @@
/* ospfd privileges */ /* ospfd privileges */
zebra_capabilities_t _caps_p[] = { zebra_capabilities_t _caps_p[] = {
ZCAP_NET_RAW, ZCAP_NET_RAW, ZCAP_BIND, ZCAP_NET_ADMIN,
ZCAP_BIND,
ZCAP_NET_ADMIN,
}; };
struct zebra_privs_t ospfd_privs = { struct zebra_privs_t ospfd_privs = {

View File

@ -460,7 +460,8 @@ struct ospf_neighbor *ospf_nbr_get(struct ospf_interface *oi,
if (oi->type == OSPF_IFTYPE_VIRTUALLINK if (oi->type == OSPF_IFTYPE_VIRTUALLINK
|| oi->type == OSPF_IFTYPE_POINTOPOINT) || oi->type == OSPF_IFTYPE_POINTOPOINT)
key.u.prefix4 = ospfh->router_id; /* index vlink and ptp nbrs by key.u.prefix4 =
ospfh->router_id; /* index vlink and ptp nbrs by
router-id */ router-id */
else else
key.u.prefix4 = iph->ip_src; key.u.prefix4 = iph->ip_src;

View File

@ -1358,7 +1358,8 @@ void ospf_opaque_lsa_originate_schedule(struct ospf_interface *oi, int *delay0)
* list_isempty (oipt->id_list) * list_isempty (oipt->id_list)
* not being empty. * not being empty.
*/ */
if (oipt->t_opaque_lsa_self if (
oipt->t_opaque_lsa_self
!= NULL /* Waiting for a thread call. */ != NULL /* Waiting for a thread call. */
|| oipt->status == PROC_SUSPEND) /* Cannot || oipt->status == PROC_SUSPEND) /* Cannot
originate originate
@ -1383,7 +1384,8 @@ void ospf_opaque_lsa_originate_schedule(struct ospf_interface *oi, int *delay0)
* list_isempty (oipt->id_list) * list_isempty (oipt->id_list)
* not being empty. * not being empty.
*/ */
if (oipt->t_opaque_lsa_self if (
oipt->t_opaque_lsa_self
!= NULL /* Waiting for a thread call. */ != NULL /* Waiting for a thread call. */
|| oipt->status == PROC_SUSPEND) /* Cannot || oipt->status == PROC_SUSPEND) /* Cannot
originate originate
@ -1408,7 +1410,8 @@ void ospf_opaque_lsa_originate_schedule(struct ospf_interface *oi, int *delay0)
* list_isempty (oipt->id_list) * list_isempty (oipt->id_list)
* not being empty. * not being empty.
*/ */
if (oipt->t_opaque_lsa_self if (
oipt->t_opaque_lsa_self
!= NULL /* Waiting for a thread call. */ != NULL /* Waiting for a thread call. */
|| oipt->status == PROC_SUSPEND) /* Cannot || oipt->status == PROC_SUSPEND) /* Cannot
originate originate

View File

@ -2436,8 +2436,8 @@ static int ospf_check_auth(struct ospf_interface *oi, struct ospf_header *ospfh)
return 0; return 0;
} }
/* only MD5 crypto method can pass ospf_packet_examin() */ /* only MD5 crypto method can pass ospf_packet_examin() */
if (NULL if (
== (ck = listgetdata(listtail( NULL == (ck = listgetdata(listtail(
OSPF_IF_PARAM(oi, auth_crypt)))) OSPF_IF_PARAM(oi, auth_crypt))))
|| ospfh->u.crypt.key_id != ck->key_id || || ospfh->u.crypt.key_id != ck->key_id ||
/* Condition above uses the last key ID on the list, /* Condition above uses the last key ID on the list,
@ -2888,8 +2888,8 @@ int ospf_read(struct thread *thread)
ospfh = (struct ospf_header *)STREAM_PNT(ibuf); ospfh = (struct ospf_header *)STREAM_PNT(ibuf);
if (MSG_OK if (MSG_OK
!= ospf_packet_examin(ospfh, stream_get_endp(ibuf) != ospf_packet_examin(
- stream_get_getp(ibuf))) ospfh, stream_get_endp(ibuf) - stream_get_getp(ibuf)))
return -1; return -1;
/* Now it is safe to access all fields of OSPF packet header. */ /* Now it is safe to access all fields of OSPF packet header. */
@ -2935,8 +2935,7 @@ int ospf_read(struct thread *thread)
* or header area is backbone but ospf_interface is not * or header area is backbone but ospf_interface is not
* check for VLINK interface * check for VLINK interface
*/ */
if ((oi == NULL) if ((oi == NULL) || (OSPF_IS_AREA_ID_BACKBONE(ospfh->area_id)
|| (OSPF_IS_AREA_ID_BACKBONE(ospfh->area_id)
&& !OSPF_IS_AREA_ID_BACKBONE(oi->area->area_id))) { && !OSPF_IS_AREA_ID_BACKBONE(oi->area->area_id))) {
if ((oi = ospf_associate_packet_vl(ospf, ifp, iph, ospfh)) if ((oi = ospf_associate_packet_vl(ospf, ifp, iph, ospfh))
== NULL) { == NULL) {

View File

@ -229,16 +229,18 @@ static void ospf_route_delete_uniq(struct route_table *rt,
or->path_type == OSPF_PATH_INTER_AREA) { or->path_type == OSPF_PATH_INTER_AREA) {
if (or->type == OSPF_DESTINATION_NETWORK) { if (or->type == OSPF_DESTINATION_NETWORK) {
if (!ospf_route_exist_new_table( if (!ospf_route_exist_new_table(
cmprt, (struct prefix_ipv4 cmprt,
*)&rn->p)) (struct prefix_ipv4 *)&rn
->p))
ospf_zebra_delete( ospf_zebra_delete(
(struct prefix_ipv4 (struct prefix_ipv4
*)&rn->p, *)&rn->p,
or); or);
} else if (or->type == OSPF_DESTINATION_DISCARD) } else if (or->type == OSPF_DESTINATION_DISCARD)
if (!ospf_route_exist_new_table( if (!ospf_route_exist_new_table(
cmprt, (struct prefix_ipv4 cmprt,
*)&rn->p)) (struct prefix_ipv4 *)&rn
->p))
ospf_zebra_delete_discard( ospf_zebra_delete_discard(
(struct prefix_ipv4 (struct prefix_ipv4
*)&rn->p); *)&rn->p);

View File

@ -332,9 +332,7 @@ static route_map_result_t route_match_tag(void *rule, struct prefix *prefix,
/* Route map commands for tag matching. */ /* Route map commands for tag matching. */
static struct route_map_rule_cmd route_match_tag_cmd = { static struct route_map_rule_cmd route_match_tag_cmd = {
"tag", "tag", route_match_tag, route_map_rule_tag_compile,
route_match_tag,
route_map_rule_tag_compile,
route_map_rule_tag_free, route_map_rule_tag_free,
}; };
@ -392,9 +390,7 @@ static void route_set_metric_free(void *rule)
/* Set metric rule structure. */ /* Set metric rule structure. */
struct route_map_rule_cmd route_set_metric_cmd = { struct route_map_rule_cmd route_set_metric_cmd = {
"metric", "metric", route_set_metric, route_set_metric_compile,
route_set_metric,
route_set_metric_compile,
route_set_metric_free, route_set_metric_free,
}; };
@ -446,9 +442,7 @@ static void route_set_metric_type_free(void *rule)
/* Set metric rule structure. */ /* Set metric rule structure. */
struct route_map_rule_cmd route_set_metric_type_cmd = { struct route_map_rule_cmd route_set_metric_type_cmd = {
"metric-type", "metric-type", route_set_metric_type, route_set_metric_type_compile,
route_set_metric_type,
route_set_metric_type_compile,
route_set_metric_type_free, route_set_metric_type_free,
}; };
@ -471,9 +465,7 @@ static route_map_result_t route_set_tag(void *rule, struct prefix *prefix,
/* Route map commands for tag set. */ /* Route map commands for tag set. */
static struct route_map_rule_cmd route_set_tag_cmd = { static struct route_map_rule_cmd route_set_tag_cmd = {
"tag", "tag", route_set_tag, route_map_rule_tag_compile,
route_set_tag,
route_map_rule_tag_compile,
route_map_rule_tag_free, route_map_rule_tag_free,
}; };

View File

@ -873,8 +873,6 @@ static u_char *ospfStubAreaEntry(struct variable *v, oid *name, size_t *length,
break; break;
case OSPFSTUBMETRICTYPE: /* 5 */ case OSPFSTUBMETRICTYPE: /* 5 */
/* OSPF Metric type. */ /* OSPF Metric type. */
/* $FRR indent$ */
/* clang-format off */
#define OSPF_ospfMetric 1 #define OSPF_ospfMetric 1
#define OSPF_comparableCost 2 #define OSPF_comparableCost 2
#define OSPF_nonComparable 3 #define OSPF_nonComparable 3
@ -2102,8 +2100,7 @@ static struct ospf_neighbor *ospf_snmp_nbr_lookup(struct ospf *ospf,
for (ALL_LIST_ELEMENTS(ospf->oiflist, node, nnode, oi)) { for (ALL_LIST_ELEMENTS(ospf->oiflist, node, nnode, oi)) {
for (rn = route_top(oi->nbrs); rn; rn = route_next(rn)) for (rn = route_top(oi->nbrs); rn; rn = route_next(rn))
if ((nbr = rn->info) != NULL if ((nbr = rn->info) != NULL && nbr != oi->nbr_self
&& nbr != oi->nbr_self
/* If EXACT match is needed, provide ALL entry found /* If EXACT match is needed, provide ALL entry found
&& nbr->state != NSM_Down && nbr->state != NSM_Down
*/ */

View File

@ -290,8 +290,7 @@ static void ospf_passive_interface_default(struct ospf *ospf, u_char newval)
ospf->passive_interface_default = newval; ospf->passive_interface_default = newval;
for (ALL_LIST_ELEMENTS_RO(om->iflist, ln, ifp)) { for (ALL_LIST_ELEMENTS_RO(om->iflist, ln, ifp)) {
if (ifp if (ifp && OSPF_IF_PARAM_CONFIGURED(IF_DEF_PARAMS(ifp),
&& OSPF_IF_PARAM_CONFIGURED(IF_DEF_PARAMS(ifp),
passive_interface)) passive_interface))
UNSET_IF_PARAM(IF_DEF_PARAMS(ifp), passive_interface); UNSET_IF_PARAM(IF_DEF_PARAMS(ifp), passive_interface);
} }
@ -395,8 +394,7 @@ DEFUN (ospf_passive_interface,
for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next(rn)) { for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next(rn)) {
struct ospf_interface *oi = rn->info; struct ospf_interface *oi = rn->info;
if (oi if (oi && (OSPF_IF_PARAM(oi, passive_interface)
&& (OSPF_IF_PARAM(oi, passive_interface)
== OSPF_IF_PASSIVE)) == OSPF_IF_PASSIVE))
ospf_if_set_multicast(oi); ospf_if_set_multicast(oi);
} }
@ -2127,8 +2125,7 @@ ALIAS(ospf_compatible_rfc1583, ospf_rfc1583_flag_cmd,
"Enable the RFC1583Compatibility flag\n") "Enable the RFC1583Compatibility flag\n")
ALIAS(no_ospf_compatible_rfc1583, no_ospf_rfc1583_flag_cmd, ALIAS(no_ospf_compatible_rfc1583, no_ospf_rfc1583_flag_cmd,
"no ospf rfc1583compatibility", "no ospf rfc1583compatibility", NO_STR
NO_STR
"OSPF specific commands\n" "OSPF specific commands\n"
"Disable the RFC1583Compatibility flag\n") "Disable the RFC1583Compatibility flag\n")
@ -2582,8 +2579,7 @@ DEFUN (no_ospf_write_multiplier,
} }
ALIAS(no_ospf_write_multiplier, no_write_multiplier_cmd, ALIAS(no_ospf_write_multiplier, no_write_multiplier_cmd,
"no write-multiplier (1-100)", "no write-multiplier (1-100)", NO_STR
NO_STR
"Write multiplier\n" "Write multiplier\n"
"Maximum number of interface serviced per write\n") "Maximum number of interface serviced per write\n")
@ -3181,8 +3177,7 @@ static int show_ip_ospf_common(struct vty *vty, struct ospf *ospf,
if (use_json) { if (use_json) {
json_object_object_add(json, "areas", json_areas); json_object_object_add(json, "areas", json_areas);
vty_out(vty, "%s\n", vty_out(vty, "%s\n", json_object_to_json_string_ext(
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} else } else
@ -3328,8 +3323,8 @@ static void show_ip_ospf_interface_sub(struct vty *vty, struct ospf *ospf,
/* For Vlinks, showing the peer address is /* For Vlinks, showing the peer address is
* probably more * probably more
* * * * * informative than * * * * * informative than the local
* the local interface that is being used * interface that is being used
* * * * */ * * * * */
if (oi->type == OSPF_IFTYPE_VIRTUALLINK) if (oi->type == OSPF_IFTYPE_VIRTUALLINK)
dest = &oi->vl_data->peer_addr; dest = &oi->vl_data->peer_addr;
@ -3611,8 +3606,7 @@ static int show_ip_ospf_interface_common(struct vty *vty, struct ospf *ospf,
} }
if (use_json) { if (use_json) {
vty_out(vty, "%s\n", vty_out(vty, "%s\n", json_object_to_json_string_ext(
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} else } else
@ -3823,8 +3817,7 @@ static int show_ip_ospf_neighbor_common(struct vty *vty, struct ospf *ospf,
show_ip_ospf_neighbor_sub(vty, oi, json, use_json); show_ip_ospf_neighbor_sub(vty, oi, json, use_json);
if (use_json) { if (use_json) {
vty_out(vty, "%s\n", vty_out(vty, "%s\n", json_object_to_json_string_ext(
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} else } else
@ -3944,8 +3937,7 @@ static int show_ip_ospf_neighbor_all_common(struct vty *vty, struct ospf *ospf,
} }
if (use_json) { if (use_json) {
vty_out(vty, "%s\n", vty_out(vty, "%s\n", json_object_to_json_string_ext(
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} else } else
@ -4038,8 +4030,7 @@ static int show_ip_ospf_neighbor_int_common(struct vty *vty, struct ospf *ospf,
} }
if (use_json) { if (use_json) {
vty_out(vty, "%s\n", vty_out(vty, "%s\n", json_object_to_json_string_ext(
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} else } else
@ -4422,8 +4413,7 @@ static int show_ip_ospf_neighbor_id_common(struct vty *vty, struct ospf *ospf,
} }
if (use_json) { if (use_json) {
vty_out(vty, "%s\n", vty_out(vty, "%s\n", json_object_to_json_string_ext(
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} else } else
@ -4512,8 +4502,7 @@ static int show_ip_ospf_neighbor_detail_common(struct vty *vty,
} }
if (use_json) { if (use_json) {
vty_out(vty, "%s\n", vty_out(vty, "%s\n", json_object_to_json_string_ext(
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} else } else
@ -4611,8 +4600,7 @@ static int show_ip_ospf_neighbor_detail_all_common(struct vty *vty,
} }
if (use_json) { if (use_json) {
vty_out(vty, "%s\n", vty_out(vty, "%s\n", json_object_to_json_string_ext(
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} else { } else {
@ -4714,8 +4702,7 @@ static int show_ip_ospf_neighbor_int_detail_common(struct vty *vty,
} }
if (use_json) { if (use_json) {
vty_out(vty, "%s\n", vty_out(vty, "%s\n", json_object_to_json_string_ext(
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} else } else

View File

@ -404,8 +404,8 @@ int pim_assert_build_msg(uint8_t *pim_msg, int buf_size, struct interface *ifp,
} }
/* Metric preference */ /* Metric preference */
pim_write_uint32(pim_msg_curr, rpt_bit_flag pim_write_uint32(pim_msg_curr,
? metric_preference | 0x80000000 rpt_bit_flag ? metric_preference | 0x80000000
: metric_preference); : metric_preference);
pim_msg_curr += 4; pim_msg_curr += 4;

View File

@ -423,8 +423,7 @@ static void pim_show_membership(struct vty *vty, u_char uj)
} /* scan interface channels */ } /* scan interface channels */
if (uj) { if (uj) {
vty_out(vty, "%s\n", vty_out(vty, "%s\n", json_object_to_json_string_ext(
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
} else { } else {
vty_out(vty, vty_out(vty,
@ -589,8 +588,7 @@ static void igmp_show_interfaces(struct vty *vty, u_char uj)
} }
if (uj) { if (uj) {
vty_out(vty, "%s\n", vty_out(vty, "%s\n", json_object_to_json_string_ext(
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} }
@ -786,8 +784,7 @@ static void igmp_show_interfaces_single(struct vty *vty, const char *ifname,
} }
if (uj) { if (uj) {
vty_out(vty, "%s\n", vty_out(vty, "%s\n", json_object_to_json_string_ext(
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} else { } else {
@ -1168,7 +1165,8 @@ static void pim_show_interfaces_single(struct vty *vty, const char *ifname,
print_header = 1; print_header = 1;
for (ALL_LIST_ELEMENTS_RO(pim_upstream_list, upnode, for (ALL_LIST_ELEMENTS_RO(pim_upstream_list, upnode,
up)) { up)) {
if (strcmp(ifp->name, up->rpf.source_nexthop if (strcmp(ifp->name,
up->rpf.source_nexthop
.interface->name) .interface->name)
== 0) { == 0) {
if (up->flags if (up->flags
@ -1256,8 +1254,7 @@ static void pim_show_interfaces_single(struct vty *vty, const char *ifname,
} }
if (uj) { if (uj) {
vty_out(vty, "%s\n", vty_out(vty, "%s\n", json_object_to_json_string_ext(
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} else { } else {
@ -1317,8 +1314,7 @@ static void pim_show_interfaces(struct vty *vty, u_char uj)
} }
if (uj) { if (uj) {
vty_out(vty, "%s\n", vty_out(vty, "%s\n", json_object_to_json_string_ext(
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
} else { } else {
vty_out(vty, vty_out(vty,
@ -1436,8 +1432,7 @@ static void pim_show_interface_traffic(struct vty *vty, u_char uj)
} }
} }
if (uj) { if (uj) {
vty_out(vty, "%s\n", vty_out(vty, "%s\n", json_object_to_json_string_ext(
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} }
@ -1523,8 +1518,7 @@ static void pim_show_interface_traffic_single(struct vty *vty,
} }
} }
if (uj) { if (uj) {
vty_out(vty, "%s\n", vty_out(vty, "%s\n", json_object_to_json_string_ext(
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} else { } else {
@ -1628,8 +1622,7 @@ static void pim_show_join(struct vty *vty, u_char uj)
} /* scan interface channels */ } /* scan interface channels */
if (uj) { if (uj) {
vty_out(vty, "%s\n", vty_out(vty, "%s\n", json_object_to_json_string_ext(
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} }
@ -1833,8 +1826,7 @@ static void pim_show_neighbors_single(struct vty *vty, const char *neighbor,
} }
if (uj) { if (uj) {
vty_out(vty, "%s\n", vty_out(vty, "%s\n", json_object_to_json_string_ext(
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} else { } else {
@ -2039,8 +2031,7 @@ static void pim_show_state(struct vty *vty, const char *src_or_group,
if (uj) { if (uj) {
vty_out(vty, "%s\n", vty_out(vty, "%s\n", json_object_to_json_string_ext(
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} else { } else {
@ -2124,8 +2115,7 @@ static void pim_show_neighbors(struct vty *vty, u_char uj)
} }
if (uj) { if (uj) {
vty_out(vty, "%s\n", vty_out(vty, "%s\n", json_object_to_json_string_ext(
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} }
@ -2356,8 +2346,7 @@ static void pim_show_upstream(struct vty *vty, u_char uj)
} }
if (uj) { if (uj) {
vty_out(vty, "%s\n", vty_out(vty, "%s\n", json_object_to_json_string_ext(
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} }
@ -2442,8 +2431,7 @@ static void pim_show_join_desired(struct vty *vty, u_char uj)
} }
if (uj) { if (uj) {
vty_out(vty, "%s\n", vty_out(vty, "%s\n", json_object_to_json_string_ext(
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} }
@ -2481,10 +2469,7 @@ static void pim_show_upstream_rpf(struct vty *vty, u_char uj)
pim_addr_dump("<rpf?>", &rpf->rpf_addr, rpf_addr_str, pim_addr_dump("<rpf?>", &rpf->rpf_addr, rpf_addr_str,
sizeof(rpf_addr_str)); sizeof(rpf_addr_str));
rpf_ifname = rpf_ifname = rpf->source_nexthop.interface ? rpf->source_nexthop.interface->name : "<ifname?>";
rpf->source_nexthop.interface ? rpf->source_nexthop
.interface->name
: "<ifname?>";
if (uj) { if (uj) {
json_object_object_get_ex(json, grp_str, &json_group); json_object_object_get_ex(json, grp_str, &json_group);
@ -2514,8 +2499,7 @@ static void pim_show_upstream_rpf(struct vty *vty, u_char uj)
} }
if (uj) { if (uj) {
vty_out(vty, "%s\n", vty_out(vty, "%s\n", json_object_to_json_string_ext(
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} }
@ -2620,10 +2604,7 @@ static void pim_show_rpf(struct vty *vty, u_char uj)
&rpf->source_nexthop.mrib_nexthop_addr, &rpf->source_nexthop.mrib_nexthop_addr,
rib_nexthop_str, sizeof(rib_nexthop_str)); rib_nexthop_str, sizeof(rib_nexthop_str));
rpf_ifname = rpf_ifname = rpf->source_nexthop.interface ? rpf->source_nexthop.interface->name : "<ifname?>";
rpf->source_nexthop.interface ? rpf->source_nexthop
.interface->name
: "<ifname?>";
if (uj) { if (uj) {
json_object_object_get_ex(json, grp_str, &json_group); json_object_object_get_ex(json, grp_str, &json_group);
@ -2661,8 +2642,7 @@ static void pim_show_rpf(struct vty *vty, u_char uj)
} }
if (uj) { if (uj) {
vty_out(vty, "%s\n", vty_out(vty, "%s\n", json_object_to_json_string_ext(
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} }
@ -2822,8 +2802,7 @@ static void igmp_show_groups(struct vty *vty, u_char uj)
} /* scan interfaces */ } /* scan interfaces */
if (uj) { if (uj) {
vty_out(vty, "%s\n", vty_out(vty, "%s\n", json_object_to_json_string_ext(
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} }
@ -4060,8 +4039,7 @@ static void show_mroute(struct vty *vty, u_char uj)
} }
if (uj) { if (uj) {
vty_out(vty, "%s\n", vty_out(vty, "%s\n", json_object_to_json_string_ext(
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} }
@ -4655,8 +4633,7 @@ static void ip_pim_ssm_show_group_range(struct vty *vty, u_char uj)
json_object *json; json_object *json;
json = json_object_new_object(); json = json_object_new_object();
json_object_string_add(json, "ssmGroups", range_str); json_object_string_add(json, "ssmGroups", range_str);
vty_out(vty, "%s\n", vty_out(vty, "%s\n", json_object_to_json_string_ext(
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} else } else
@ -4699,8 +4676,7 @@ static void ip_pim_ssm_show_group_type(struct vty *vty, u_char uj,
json_object *json; json_object *json;
json = json_object_new_object(); json = json_object_new_object();
json_object_string_add(json, "groupType", type_str); json_object_string_add(json, "groupType", type_str);
vty_out(vty, "%s\n", vty_out(vty, "%s\n", json_object_to_json_string_ext(
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} else } else
@ -6453,8 +6429,7 @@ DEFUN (ip_pim_bfd_param,
} }
ALIAS(no_ip_pim_bfd, no_ip_pim_bfd_param_cmd, ALIAS(no_ip_pim_bfd, no_ip_pim_bfd_param_cmd,
"no ip pim bfd (2-255) (50-60000) (50-60000)", "no ip pim bfd (2-255) (50-60000) (50-60000)", NO_STR IP_STR PIM_STR
NO_STR IP_STR PIM_STR
"Enables BFD support\n" "Enables BFD support\n"
"Detect Multiplier\n" "Detect Multiplier\n"
"Required min receive interval\n" "Required min receive interval\n"
@ -6815,8 +6790,7 @@ static void ip_msdp_show_mesh_group(struct vty *vty, u_char uj)
if (uj) { if (uj) {
json_object_object_add(json, mg->mesh_group_name, json_mg_row); json_object_object_add(json, mg->mesh_group_name, json_mg_row);
vty_out(vty, "%s\n", vty_out(vty, "%s\n", json_object_to_json_string_ext(
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} }
@ -6884,8 +6858,7 @@ static void ip_msdp_show_peers(struct vty *vty, u_char uj)
} }
if (uj) { if (uj) {
vty_out(vty, "%s\n", vty_out(vty, "%s\n", json_object_to_json_string_ext(
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} }
@ -6990,8 +6963,7 @@ static void ip_msdp_show_peers_detail(struct vty *vty, const char *peer,
} }
if (uj) { if (uj) {
vty_out(vty, "%s\n", vty_out(vty, "%s\n", json_object_to_json_string_ext(
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} }
@ -7089,8 +7061,7 @@ static void ip_msdp_show_sa(struct vty *vty, u_char uj)
if (uj) { if (uj) {
vty_out(vty, "%s\n", vty_out(vty, "%s\n", json_object_to_json_string_ext(
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} }
@ -7182,8 +7153,7 @@ static void ip_msdp_show_sa_detail(struct vty *vty, u_char uj)
} }
if (uj) { if (uj) {
vty_out(vty, "%s\n", vty_out(vty, "%s\n", json_object_to_json_string_ext(
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} }
@ -7227,8 +7197,7 @@ static void ip_msdp_show_sa_addr(struct vty *vty, const char *addr, u_char uj)
} }
if (uj) { if (uj) {
vty_out(vty, "%s\n", vty_out(vty, "%s\n", json_object_to_json_string_ext(
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} }
@ -7257,8 +7226,7 @@ static void ip_msdp_show_sa_sg(struct vty *vty, const char *src,
} }
if (uj) { if (uj) {
vty_out(vty, "%s\n", vty_out(vty, "%s\n", json_object_to_json_string_ext(
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} }

View File

@ -80,7 +80,8 @@ struct pim_interface {
int igmp_version; /* IGMP version */ int igmp_version; /* IGMP version */
int igmp_default_robustness_variable; /* IGMPv3 QRV */ int igmp_default_robustness_variable; /* IGMPv3 QRV */
int igmp_default_query_interval; /* IGMPv3 secs between general int
igmp_default_query_interval; /* IGMPv3 secs between general
queries */ queries */
int igmp_query_max_response_time_dsec; /* IGMPv3 Max Response Time in int igmp_query_max_response_time_dsec; /* IGMPv3 Max Response Time in
dsecs for general queries */ dsecs for general queries */

View File

@ -814,8 +814,7 @@ void pim_ifchannel_join_add(struct interface *ifp, struct in_addr neigh_addr,
/* /*
* If we are going to be a LHR, we need to note it * If we are going to be a LHR, we need to note it
*/ */
if (ch->upstream->parent if (ch->upstream->parent && (ch->upstream->parent->flags
&& (ch->upstream->parent->flags
& PIM_UPSTREAM_FLAG_MASK_SRC_IGMP) & PIM_UPSTREAM_FLAG_MASK_SRC_IGMP)
&& !(ch->upstream->flags && !(ch->upstream->flags
& PIM_UPSTREAM_FLAG_MASK_SRC_LHR)) { & PIM_UPSTREAM_FLAG_MASK_SRC_LHR)) {

View File

@ -53,10 +53,7 @@ struct option longopts[] = {{0}};
/* pimd privileges */ /* pimd privileges */
zebra_capabilities_t _caps_p[] = { zebra_capabilities_t _caps_p[] = {
ZCAP_NET_ADMIN, ZCAP_NET_ADMIN, ZCAP_SYS_ADMIN, ZCAP_NET_RAW, ZCAP_BIND,
ZCAP_SYS_ADMIN,
ZCAP_NET_RAW,
ZCAP_BIND,
}; };
/* pimd privileges to run with */ /* pimd privileges to run with */

View File

@ -330,8 +330,7 @@ int pim_register_recv(struct interface *ifp, struct in_addr dest_addr,
pim_str_sg_dump(&sg), src_str, ifp->name, i_am_rp); pim_str_sg_dump(&sg), src_str, ifp->name, i_am_rp);
} }
if (i_am_rp if (i_am_rp && (dest_addr.s_addr
&& (dest_addr.s_addr
== ((RP(sg.grp))->rpf_addr.u.prefix4.s_addr))) { == ((RP(sg.grp))->rpf_addr.u.prefix4.s_addr))) {
sentRegisterStop = 0; sentRegisterStop = 0;

View File

@ -948,8 +948,7 @@ void pim_rp_show_information(struct vty *vty, u_char uj)
inet_ntoa(prev_rp_info->rp.rpf_addr.u.prefix4), inet_ntoa(prev_rp_info->rp.rpf_addr.u.prefix4),
json_rp_rows); json_rp_rows);
vty_out(vty, "%s\n", vty_out(vty, "%s\n", json_object_to_json_string_ext(
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json, JSON_C_TO_STRING_PRETTY));
json_object_free(json); json_object_free(json);
} }

View File

@ -435,7 +435,8 @@ int zclient_lookup_nexthop(struct pim_zlookup_nexthop nexthop_tab[],
nexthop_tab[0].route_metric); nexthop_tab[0].route_metric);
} }
addr = nexthop_addr.u.prefix4; /* use nexthop addr for addr =
nexthop_addr.u.prefix4; /* use nexthop addr for
recursive lookup */ recursive lookup */
} /* for (max_lookup) */ } /* for (max_lookup) */

View File

@ -74,6 +74,7 @@ static inline void qpb_free(qpb_allocator_t *allocator, void *ptr)
*/ */
#define QPB_ALLOC(allocator, type) (type *)qpb_alloc(allocator, sizeof(type)) #define QPB_ALLOC(allocator, type) (type *)qpb_alloc(allocator, sizeof(type))
/* /*
* Externs. * Externs.
*/ */

View File

@ -1855,9 +1855,7 @@ int config_write_rip_network(struct vty *vty, int config_mode)
} }
static struct cmd_node interface_node = { static struct cmd_node interface_node = {
INTERFACE_NODE, INTERFACE_NODE, "%s(config-if)# ", 1,
"%s(config-if)# ",
1,
}; };
/* Called when interface structure allocated. */ /* Called when interface structure allocated. */

View File

@ -347,9 +347,7 @@ static route_map_result_t route_match_tag(void *rule, struct prefix *prefix,
/* Route map commands for tag matching. */ /* Route map commands for tag matching. */
static struct route_map_rule_cmd route_match_tag_cmd = { static struct route_map_rule_cmd route_match_tag_cmd = {
"tag", "tag", route_match_tag, route_map_rule_tag_compile,
route_match_tag,
route_map_rule_tag_compile,
route_map_rule_tag_free, route_map_rule_tag_free,
}; };
@ -438,9 +436,7 @@ static void route_set_metric_free(void *rule)
/* Set metric rule structure. */ /* Set metric rule structure. */
static struct route_map_rule_cmd route_set_metric_cmd = { static struct route_map_rule_cmd route_set_metric_cmd = {
"metric", "metric", route_set_metric, route_set_metric_compile,
route_set_metric,
route_set_metric_compile,
route_set_metric_free, route_set_metric_free,
}; };

View File

@ -661,8 +661,7 @@ int config_write_rip_redistribute(struct vty *vty, int config_mode)
/* Zebra node structure. */ /* Zebra node structure. */
static struct cmd_node zebra_node = { static struct cmd_node zebra_node = {
ZEBRA_NODE, ZEBRA_NODE, "%s(config-router)# ",
"%s(config-router)# ",
}; };
static void rip_zebra_connected(struct zclient *zclient) static void rip_zebra_connected(struct zclient *zclient)

View File

@ -454,7 +454,8 @@ static void rip_rte_process(struct rte *rte, struct sockaddr_in *from,
/* Get back the object */ /* Get back the object */
rte->nexthop = newinfo.nexthop_out; rte->nexthop = newinfo.nexthop_out;
rte->tag = htons(newinfo.tag_out); /* XXX */ rte->tag = htons(newinfo.tag_out); /* XXX */
rte->metric = newinfo.metric_out; /* XXX: the routemap uses the rte->metric =
newinfo.metric_out; /* XXX: the routemap uses the
metric_out field */ metric_out field */
} }

View File

@ -150,9 +150,7 @@ static route_map_result_t route_match_tag(void *rule, struct prefix *prefix,
} }
static struct route_map_rule_cmd route_match_tag_cmd = { static struct route_map_rule_cmd route_match_tag_cmd = {
"tag", "tag", route_match_tag, route_map_rule_tag_compile,
route_match_tag,
route_map_rule_tag_compile,
route_map_rule_tag_free, route_map_rule_tag_free,
}; };
@ -242,9 +240,7 @@ static void route_set_metric_free(void *rule)
} }
static struct route_map_rule_cmd route_set_metric_cmd = { static struct route_map_rule_cmd route_set_metric_cmd = {
"metric", "metric", route_set_metric, route_set_metric_compile,
route_set_metric,
route_set_metric_compile,
route_set_metric_free, route_set_metric_free,
}; };

View File

@ -507,8 +507,7 @@ static int zebra_config_write(struct vty *vty)
/* Zebra node structure. */ /* Zebra node structure. */
static struct cmd_node zebra_node = { static struct cmd_node zebra_node = {
ZEBRA_NODE, ZEBRA_NODE, "%s(config-router)# ",
"%s(config-router)# ",
}; };
static void ripng_zebra_connected(struct zclient *zclient) static void ripng_zebra_connected(struct zclient *zclient)

View File

@ -742,7 +742,8 @@ static void ripng_route_process(struct rte *rte, struct sockaddr_in6 *from,
} }
} }
rte->tag = htons(newinfo.tag_out); /* XXX */ rte->tag = htons(newinfo.tag_out); /* XXX */
rte->metric = newinfo.metric_out; /* XXX: the routemap uses the rte->metric =
newinfo.metric_out; /* XXX: the routemap uses the
metric_out field */ metric_out field */
} }
@ -2717,9 +2718,7 @@ static int ripng_config_write(struct vty *vty)
/* RIPng node structure. */ /* RIPng node structure. */
static struct cmd_node cmd_ripng_node = { static struct cmd_node cmd_ripng_node = {
RIPNG_NODE, RIPNG_NODE, "%s(config-router)# ", 1,
"%s(config-router)# ",
1,
}; };
static void ripng_distribute_update(struct distribute *dist) static void ripng_distribute_update(struct distribute *dist)

View File

@ -52,8 +52,6 @@ struct test_spec {
const unsigned int confeds; /* aspath_count_confeds */ const unsigned int confeds; /* aspath_count_confeds */
const int private_as; /* whether the private_as check should pass or const int private_as; /* whether the private_as check should pass or
fail */ fail */
/* $FRR indent$ */
/* clang-format off */
#define NOT_ALL_PRIVATE 0 #define NOT_ALL_PRIVATE 0
#define ALL_PRIVATE 1 #define ALL_PRIVATE 1
const as_t does_loop; /* an ASN which should trigger loop-check */ const as_t does_loop; /* an ASN which should trigger loop-check */
@ -87,14 +85,7 @@ static struct test_segment {
{0x2, 0x1, 0x22, 0x12, 0x2, 0x1, 0x00, 0x04}, {0x2, 0x1, 0x22, 0x12, 0x2, 0x1, 0x00, 0x04},
8, 8,
{ {
"8722 4", "8722 4", "8722 4", 2, 0, NOT_ALL_PRIVATE, 4, 5, 8722,
"8722 4",
2,
0,
NOT_ALL_PRIVATE,
4,
5,
8722,
}, },
}, },
{ {
@ -407,22 +398,8 @@ static struct test_segment {
"reconcile_start_trans", "reconcile_start_trans",
"seq(23456,23456,23456) seq(6435,59408,21665)", "seq(23456,23456,23456) seq(6435,59408,21665)",
{ {
0x2, 0x2, 0x3, 0x5b, 0xa0, 0x5b, 0xa0, 0x5b, 0xa0, 0x2, 0x3,
0x3, 0x19, 0x23, 0xe8, 0x10, 0x54, 0xa1,
0x5b,
0xa0,
0x5b,
0xa0,
0x5b,
0xa0,
0x2,
0x3,
0x19,
0x23,
0xe8,
0x10,
0x54,
0xa1,
}, },
16, 16,
{"23456 23456 23456 6435 59408 21665", {"23456 23456 23456 6435 59408 21665",
@ -434,22 +411,8 @@ static struct test_segment {
"reconcile_start_trans4", "reconcile_start_trans4",
"seq(1842,41591,51793) seq(6435,59408,21665)", "seq(1842,41591,51793) seq(6435,59408,21665)",
{ {
0x2, 0x2, 0x3, 0x07, 0x32, 0xa2, 0x77, 0xca, 0x51, 0x2, 0x3,
0x3, 0x19, 0x23, 0xe8, 0x10, 0x54, 0xa1,
0x07,
0x32,
0xa2,
0x77,
0xca,
0x51,
0x2,
0x3,
0x19,
0x23,
0xe8,
0x10,
0x54,
0xa1,
}, },
16, 16,
{"1842 41591 51793 6435 59408 21665", {"1842 41591 51793 6435 59408 21665",
@ -461,20 +424,8 @@ static struct test_segment {
"reconcile_start_trans_error", "reconcile_start_trans_error",
"seq(23456,23456,23456) seq(6435,59408)", "seq(23456,23456,23456) seq(6435,59408)",
{ {
0x2, 0x2, 0x3, 0x5b, 0xa0, 0x5b, 0xa0, 0x5b, 0xa0, 0x2, 0x2,
0x3, 0x19, 0x23, 0xe8, 0x10,
0x5b,
0xa0,
0x5b,
0xa0,
0x5b,
0xa0,
0x2,
0x2,
0x19,
0x23,
0xe8,
0x10,
}, },
14, 14,
{"23456 23456 23456 6435 59408", "23456 23456 23456 6435 59408", {"23456 23456 23456 6435 59408", "23456 23456 23456 6435 59408",
@ -552,10 +503,7 @@ static struct aspath_tests {
0, 0,
0, 0,
{ {
COMMON_ATTRS, COMMON_ATTRS, BGP_ATTR_FLAG_TRANS, BGP_ATTR_AS_PATH, 10,
BGP_ATTR_FLAG_TRANS,
BGP_ATTR_AS_PATH,
10,
}, },
COMMON_ATTR_SIZE + 3, COMMON_ATTR_SIZE + 3,
}, },
@ -568,10 +516,7 @@ static struct aspath_tests {
-1, -1,
0, 0,
{ {
COMMON_ATTRS, COMMON_ATTRS, BGP_ATTR_FLAG_TRANS, BGP_ATTR_AS_PATH, 8,
BGP_ATTR_FLAG_TRANS,
BGP_ATTR_AS_PATH,
8,
}, },
COMMON_ATTR_SIZE + 3, COMMON_ATTR_SIZE + 3,
}, },
@ -584,10 +529,7 @@ static struct aspath_tests {
-1, -1,
0, 0,
{ {
COMMON_ATTRS, COMMON_ATTRS, BGP_ATTR_FLAG_TRANS, BGP_ATTR_AS_PATH, 12,
BGP_ATTR_FLAG_TRANS,
BGP_ATTR_AS_PATH,
12,
}, },
COMMON_ATTR_SIZE + 3, COMMON_ATTR_SIZE + 3,
}, },
@ -602,8 +544,7 @@ static struct aspath_tests {
{ {
COMMON_ATTRS, COMMON_ATTRS,
BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL, BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL,
BGP_ATTR_AS_PATH, BGP_ATTR_AS_PATH, 10,
10,
}, },
COMMON_ATTR_SIZE + 3, COMMON_ATTR_SIZE + 3,
}, },
@ -618,8 +559,7 @@ static struct aspath_tests {
{ {
COMMON_ATTRS, COMMON_ATTRS,
BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL, BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL,
BGP_ATTR_AS4_PATH, BGP_ATTR_AS4_PATH, 10,
10,
}, },
COMMON_ATTR_SIZE + 3, COMMON_ATTR_SIZE + 3,
}, },
@ -634,8 +574,7 @@ static struct aspath_tests {
{ {
COMMON_ATTRS, COMMON_ATTRS,
BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL, BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL,
BGP_ATTR_AS4_PATH, BGP_ATTR_AS4_PATH, 10,
10,
}, },
COMMON_ATTR_SIZE + 3, COMMON_ATTR_SIZE + 3,
}, },
@ -648,10 +587,7 @@ static struct aspath_tests {
0, 0,
PEER_CAP_AS4_RCV | PEER_CAP_AS4_ADV, PEER_CAP_AS4_RCV | PEER_CAP_AS4_ADV,
{ {
COMMON_ATTRS, COMMON_ATTRS, BGP_ATTR_FLAG_TRANS, BGP_ATTR_AS_PATH, 18,
BGP_ATTR_FLAG_TRANS,
BGP_ATTR_AS_PATH,
18,
}, },
COMMON_ATTR_SIZE + 3, COMMON_ATTR_SIZE + 3,
}, },
@ -664,10 +600,7 @@ static struct aspath_tests {
-1, -1,
PEER_CAP_AS4_RCV | PEER_CAP_AS4_ADV, PEER_CAP_AS4_RCV | PEER_CAP_AS4_ADV,
{ {
COMMON_ATTRS, COMMON_ATTRS, BGP_ATTR_FLAG_TRANS, BGP_ATTR_AS_PATH, 16,
BGP_ATTR_FLAG_TRANS,
BGP_ATTR_AS_PATH,
16,
}, },
COMMON_ATTR_SIZE + 3, COMMON_ATTR_SIZE + 3,
}, },
@ -680,10 +613,7 @@ static struct aspath_tests {
-1, -1,
PEER_CAP_AS4_RCV | PEER_CAP_AS4_ADV, PEER_CAP_AS4_RCV | PEER_CAP_AS4_ADV,
{ {
COMMON_ATTRS, COMMON_ATTRS, BGP_ATTR_FLAG_TRANS, BGP_ATTR_AS_PATH, 20,
BGP_ATTR_FLAG_TRANS,
BGP_ATTR_AS_PATH,
20,
}, },
COMMON_ATTR_SIZE + 3, COMMON_ATTR_SIZE + 3,
}, },
@ -696,10 +626,7 @@ static struct aspath_tests {
-1, -1,
PEER_CAP_AS4_RCV | PEER_CAP_AS4_ADV, PEER_CAP_AS4_RCV | PEER_CAP_AS4_ADV,
{ {
COMMON_ATTRS, COMMON_ATTRS, BGP_ATTR_FLAG_TRANS, BGP_ATTR_AS_PATH, 22,
BGP_ATTR_FLAG_TRANS,
BGP_ATTR_AS_PATH,
22,
}, },
COMMON_ATTR_SIZE + 3, COMMON_ATTR_SIZE + 3,
}, },
@ -714,8 +641,7 @@ static struct aspath_tests {
{ {
COMMON_ATTRS, COMMON_ATTRS,
BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL, BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL,
BGP_ATTR_AS_PATH, BGP_ATTR_AS_PATH, 18,
18,
}, },
COMMON_ATTR_SIZE + 3, COMMON_ATTR_SIZE + 3,
}, },
@ -730,8 +656,7 @@ static struct aspath_tests {
{ {
COMMON_ATTRS, COMMON_ATTRS,
BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL, BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL,
BGP_ATTR_AS4_PATH, BGP_ATTR_AS4_PATH, 14,
14,
}, },
COMMON_ATTR_SIZE + 3, COMMON_ATTR_SIZE + 3,
}, },
@ -746,8 +671,7 @@ static struct aspath_tests {
{ {
COMMON_ATTRS, COMMON_ATTRS,
BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL, BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL,
BGP_ATTR_AS4_PATH, BGP_ATTR_AS4_PATH, 14,
14,
}, },
COMMON_ATTR_SIZE + 3, COMMON_ATTR_SIZE + 3,
&test_segments[0], &test_segments[0],
@ -880,13 +804,7 @@ static struct tests {
{NULL, {NULL,
NULL, NULL,
{ {
NULL, NULL, 0, 0, 0, 0, 0, 0,
0,
0,
0,
0,
0,
0,
}}, }},
}; };
@ -934,13 +852,7 @@ struct tests reconcile_tests[] = {
{NULL, {NULL,
NULL, NULL,
{ {
NULL, NULL, 0, 0, 0, 0, 0, 0,
0,
0,
0,
0,
0,
0,
}}, }},
}; };

View File

@ -216,7 +216,8 @@ static struct test_segment mp_segments[] = {
}, },
{NULL, NULL, {0}, 0, 0}}; {NULL, NULL, {0}, 0, 0}};
static struct test_segment misc_segments[] = { static struct test_segment misc_segments[] =
{
/* 13 */ /* 13 */
{ {
"ORF", "ORF",
@ -321,16 +322,41 @@ static struct test_segment misc_segments[] = {
{"ORFlu", {"ORFlu",
"ORF, multi entry/tuple, length too long", "ORF, multi entry/tuple, length too long",
{ {
/* hdr */ 0x3, 0x22, /* hdr */ 0x3,
/* mpc */ 0x0, 0x1, 0x0, 0x1, 0x22,
/* mpc */ 0x0,
0x1,
0x0,
0x1,
/* num */ 0x3, /* num */ 0x3,
/* tuples */ 0x40, 0x3, 0x80, 0x1, 0x80, 0x2, /* tuples */ 0x40,
/* mpc */ 0x0, 0x2, 0x0, 0x1, 0x3,
0x80,
0x1,
0x80,
0x2,
/* mpc */ 0x0,
0x2,
0x0,
0x1,
/* num */ 0x3, /* num */ 0x3,
/* tuples */ 0x40, 0x3, 0x80, 0x1, 0x80, 0x2, /* tuples */ 0x40,
/* mpc */ 0x0, 0x2, 0x0, 0x2, 0x3,
0x80,
0x1,
0x80,
0x2,
/* mpc */ 0x0,
0x2,
0x0,
0x2,
/* num */ 0x3, /* num */ 0x3,
/* tuples */ 0x40, 0x3, 0x80, 0x1, 0x80, 0x2, /* tuples */ 0x40,
0x3,
0x80,
0x1,
0x80,
0x2,
}, },
35, 35,
SHOULD_ERR}, SHOULD_ERR},
@ -339,16 +365,41 @@ static struct test_segment misc_segments[] = {
"ORFnu", "ORFnu",
"ORF, multi entry/tuple, entry number too long", "ORF, multi entry/tuple, entry number too long",
{ {
/* hdr */ 0x3, 0x21, /* hdr */ 0x3,
/* mpc */ 0x0, 0x1, 0x0, 0x1, 0x21,
/* mpc */ 0x0,
0x1,
0x0,
0x1,
/* num */ 0x3, /* num */ 0x3,
/* tuples */ 0x40, 0x3, 0x80, 0x1, 0x80, 0x2, /* tuples */ 0x40,
/* mpc */ 0x0, 0x2, 0x0, 0x1, 0x3,
0x80,
0x1,
0x80,
0x2,
/* mpc */ 0x0,
0x2,
0x0,
0x1,
/* num */ 0x4, /* num */ 0x4,
/* tuples */ 0x40, 0x3, 0x80, 0x1, 0x80, 0x2, /* tuples */ 0x40,
/* mpc */ 0x0, 0x2, 0x0, 0x2, 0x3,
0x80,
0x1,
0x80,
0x2,
/* mpc */ 0x0,
0x2,
0x0,
0x2,
/* num */ 0x3, /* num */ 0x3,
/* tuples */ 0x40, 0x3, 0x80, 0x1, 0x80, 0x2, /* tuples */ 0x40,
0x3,
0x80,
0x1,
0x80,
0x2,
}, },
35, 35,
SHOULD_PARSE, /* parses, but last few tuples should be SHOULD_PARSE, /* parses, but last few tuples should be
@ -359,16 +410,41 @@ static struct test_segment misc_segments[] = {
"ORFno", "ORFno",
"ORF, multi entry/tuple, entry number too short", "ORF, multi entry/tuple, entry number too short",
{ {
/* hdr */ 0x3, 0x21, /* hdr */ 0x3,
/* mpc */ 0x0, 0x1, 0x0, 0x1, 0x21,
/* mpc */ 0x0,
0x1,
0x0,
0x1,
/* num */ 0x3, /* num */ 0x3,
/* tuples */ 0x40, 0x3, 0x80, 0x1, 0x80, 0x2, /* tuples */ 0x40,
/* mpc */ 0x0, 0x2, 0x0, 0x1, 0x3,
0x80,
0x1,
0x80,
0x2,
/* mpc */ 0x0,
0x2,
0x0,
0x1,
/* num */ 0x1, /* num */ 0x1,
/* tuples */ 0x40, 0x3, 0x80, 0x1, 0x80, 0x2, /* tuples */ 0x40,
/* mpc */ 0x0, 0x2, 0x0, 0x2, 0x3,
0x80,
0x1,
0x80,
0x2,
/* mpc */ 0x0,
0x2,
0x0,
0x2,
/* num */ 0x3, /* num */ 0x3,
/* tuples */ 0x40, 0x3, 0x80, 0x1, 0x80, 0x2, /* tuples */ 0x40,
0x3,
0x80,
0x1,
0x80,
0x2,
}, },
35, 35,
SHOULD_PARSE, /* Parses, but should get gibberish SHOULD_PARSE, /* Parses, but should get gibberish
@ -423,7 +499,8 @@ static struct test_segment misc_segments[] = {
{ {
"AS4", "AS4",
"AS4 capability", "AS4 capability",
{0x41, 0x4, 0xab, 0xcd, 0xef, 0x12}, /* AS: 2882400018 */ {0x41, 0x4, 0xab, 0xcd, 0xef,
0x12}, /* AS: 2882400018 */
6, 6,
SHOULD_PARSE, SHOULD_PARSE,
2882400018, 2882400018,
@ -447,20 +524,15 @@ static struct test_segment misc_segments[] = {
"GR", "GR",
"GR capability", "GR capability",
{ {
/* hdr */ CAPABILITY_CODE_RESTART, /* hdr */ CAPABILITY_CODE_RESTART, 0xe,
0xe, /* R-bit, time */ 0xf1, 0x12,
/* R-bit, time */ 0xf1, /* afi */ 0x0, 0x1,
0x12,
/* afi */ 0x0,
0x1,
/* safi */ 0x1, /* safi */ 0x1,
/* flags */ 0xf, /* flags */ 0xf,
/* afi */ 0x0, /* afi */ 0x0, 0x2,
0x2,
/* safi */ 0x1, /* safi */ 0x1,
/* flags */ 0x0, /* flags */ 0x0,
/* afi */ 0x0, /* afi */ 0x0, 0x2,
0x2,
/* safi */ 0x2, /* safi */ 0x2,
/* flags */ 0x1, /* flags */ 0x1,
}, },
@ -471,20 +543,15 @@ static struct test_segment misc_segments[] = {
"GR-short", "GR-short",
"GR capability, but header length too short", "GR capability, but header length too short",
{ {
/* hdr */ 0x40, /* hdr */ 0x40, 0xa,
0xa, /* R-bit, time */ 0xf1, 0x12,
/* R-bit, time */ 0xf1, /* afi */ 0x0, 0x1,
0x12,
/* afi */ 0x0,
0x1,
/* safi */ 0x1, /* safi */ 0x1,
/* flags */ 0xf, /* flags */ 0xf,
/* afi */ 0x0, /* afi */ 0x0, 0x2,
0x2,
/* safi */ 0x1, /* safi */ 0x1,
/* flags */ 0x0, /* flags */ 0x0,
/* afi */ 0x0, /* afi */ 0x0, 0x2,
0x2,
/* safi */ 0x2, /* safi */ 0x2,
/* flags */ 0x1, /* flags */ 0x1,
}, },
@ -495,20 +562,15 @@ static struct test_segment misc_segments[] = {
"GR-long", "GR-long",
"GR capability, but header length too long", "GR capability, but header length too long",
{ {
/* hdr */ 0x40, /* hdr */ 0x40, 0xf,
0xf, /* R-bit, time */ 0xf1, 0x12,
/* R-bit, time */ 0xf1, /* afi */ 0x0, 0x1,
0x12,
/* afi */ 0x0,
0x1,
/* safi */ 0x1, /* safi */ 0x1,
/* flags */ 0xf, /* flags */ 0xf,
/* afi */ 0x0, /* afi */ 0x0, 0x2,
0x2,
/* safi */ 0x1, /* safi */ 0x1,
/* flags */ 0x0, /* flags */ 0x0,
/* afi */ 0x0, /* afi */ 0x0, 0x2,
0x2,
/* safi */ 0x2, /* safi */ 0x2,
/* flags */ 0x01, /* flags */ 0x01,
}, },
@ -519,20 +581,15 @@ static struct test_segment misc_segments[] = {
"GR-trunc", "GR-trunc",
"GR capability, but truncated", "GR capability, but truncated",
{ {
/* hdr */ 0x40, /* hdr */ 0x40, 0xf,
0xf, /* R-bit, time */ 0xf1, 0x12,
/* R-bit, time */ 0xf1, /* afi */ 0x0, 0x1,
0x12,
/* afi */ 0x0,
0x1,
/* safi */ 0x1, /* safi */ 0x1,
/* flags */ 0xf, /* flags */ 0xf,
/* afi */ 0x0, /* afi */ 0x0, 0x2,
0x2,
/* safi */ 0x1, /* safi */ 0x1,
/* flags */ 0x0, /* flags */ 0x0,
/* afi */ 0x0, /* afi */ 0x0, 0x2,
0x2,
/* safi */ 0x2, /* safi */ 0x2,
/* flags */ 0x1, /* flags */ 0x1,
}, },
@ -543,8 +600,7 @@ static struct test_segment misc_segments[] = {
"GR-empty", "GR-empty",
"GR capability, but empty.", "GR capability, but empty.",
{ {
/* hdr */ 0x40, /* hdr */ 0x40, 0x0,
0x0,
}, },
2, 2,
SHOULD_ERR, SHOULD_ERR,
@ -553,8 +609,7 @@ static struct test_segment misc_segments[] = {
"MP-empty", "MP-empty",
"MP capability, but empty.", "MP capability, but empty.",
{ {
/* hdr */ 0x1, /* hdr */ 0x1, 0x0,
0x0,
}, },
2, 2,
SHOULD_ERR, SHOULD_ERR,
@ -563,8 +618,7 @@ static struct test_segment misc_segments[] = {
"ORF-empty", "ORF-empty",
"ORF capability, but empty.", "ORF capability, but empty.",
{ {
/* hdr */ 0x3, /* hdr */ 0x3, 0x0,
0x0,
}, },
2, 2,
SHOULD_ERR, SHOULD_ERR,
@ -573,8 +627,7 @@ static struct test_segment misc_segments[] = {
"AS4-empty", "AS4-empty",
"AS4 capability, but empty.", "AS4 capability, but empty.",
{ {
/* hdr */ 0x41, /* hdr */ 0x41, 0x0,
0x0,
}, },
2, 2,
SHOULD_ERR, SHOULD_ERR,
@ -583,8 +636,7 @@ static struct test_segment misc_segments[] = {
"dyn-empty", "dyn-empty",
"Dynamic capability, but empty.", "Dynamic capability, but empty.",
{ {
/* hdr */ 0x42, /* hdr */ 0x42, 0x0,
0x0,
}, },
2, 2,
SHOULD_PARSE, SHOULD_PARSE,
@ -819,8 +871,8 @@ static void parse_test(struct peer *peer, struct test_segment *t, int type)
failed++; failed++;
if (tty) if (tty)
printf("%s", (failed > oldfailed) printf("%s",
? VT100_RED "failed!" VT100_RESET (failed > oldfailed) ? VT100_RED "failed!" VT100_RESET
: VT100_GREEN "OK" VT100_RESET); : VT100_GREEN "OK" VT100_RESET);
else else
printf("%s", (failed > oldfailed) ? "failed!" : "OK"); printf("%s", (failed > oldfailed) ? "failed!" : "OK");

View File

@ -901,23 +901,11 @@ static struct test_segment mp_unreach_segments[] = {
"IPv6-unreach2", "IPv6-unreach2",
"IPV6 MP Unreach, 2 NLRIs", "IPV6 MP Unreach, 2 NLRIs",
{ {
/* AFI / SAFI */ 0x0, /* AFI / SAFI */ 0x0, AFI_IP6, SAFI_UNICAST,
AFI_IP6, /* NLRI tuples */ 32, 0xff, 0xfe, 0x1,
SAFI_UNICAST,
/* NLRI tuples */ 32,
0xff,
0xfe,
0x1,
0x2, /* fffe:102::/32 */ 0x2, /* fffe:102::/32 */
64, 64, 0xff, 0xfe, 0x0, 0x1, /* fffe:1:2:3::/64 */
0xff, 0x0, 0x2, 0x0, 0x3,
0xfe,
0x0,
0x1, /* fffe:1:2:3::/64 */
0x0,
0x2,
0x0,
0x3,
}, },
(3 + 5 + 9), (3 + 5 + 9),
SHOULD_PARSE, SHOULD_PARSE,
@ -1029,8 +1017,8 @@ static void handle_result(struct peer *peer, struct test_segment *t,
if (tty) if (tty)
printf("%s", (failed > oldfailed) printf("%s",
? VT100_RED "failed!" VT100_RESET (failed > oldfailed) ? VT100_RED "failed!" VT100_RESET
: VT100_GREEN "OK" VT100_RESET); : VT100_GREEN "OK" VT100_RESET);
else else
printf("%s", (failed > oldfailed) ? "failed!" : "OK"); printf("%s", (failed > oldfailed) ? "failed!" : "OK");

View File

@ -361,8 +361,7 @@ testcase_t test_bgp_info_mpath_update = {
* Set up testcase vector * Set up testcase vector
*/ */
testcase_t *all_tests[] = { testcase_t *all_tests[] = {
&test_bgp_cfg_maximum_paths, &test_bgp_cfg_maximum_paths, &test_bgp_mp_list,
&test_bgp_mp_list,
&test_bgp_info_mpath_update, &test_bgp_info_mpath_update,
}; };

View File

@ -49,23 +49,19 @@ static vector test_cmds;
static char test_buf[32768]; static char test_buf[32768];
static struct cmd_node bgp_node = { static struct cmd_node bgp_node = {
BGP_NODE, BGP_NODE, "%s(config-router)# ",
"%s(config-router)# ",
}; };
static struct cmd_node rip_node = { static struct cmd_node rip_node = {
RIP_NODE, RIP_NODE, "%s(config-router)# ",
"%s(config-router)# ",
}; };
static struct cmd_node isis_node = { static struct cmd_node isis_node = {
ISIS_NODE, ISIS_NODE, "%s(config-router)# ",
"%s(config-router)# ",
}; };
static struct cmd_node interface_node = { static struct cmd_node interface_node = {
INTERFACE_NODE, INTERFACE_NODE, "%s(config-if)# ",
"%s(config-if)# ",
}; };
static struct cmd_node rmap_node = {RMAP_NODE, "%s(config-route-map)# "}; static struct cmd_node rmap_node = {RMAP_NODE, "%s(config-route-map)# "};

View File

@ -27,10 +27,7 @@
#include "memory_vty.h" #include "memory_vty.h"
zebra_capabilities_t _caps_p[] = { zebra_capabilities_t _caps_p[] = {
ZCAP_NET_RAW, ZCAP_NET_RAW, ZCAP_BIND, ZCAP_NET_ADMIN, ZCAP_DAC_OVERRIDE,
ZCAP_BIND,
ZCAP_NET_ADMIN,
ZCAP_DAC_OVERRIDE,
}; };
struct zebra_privs_t test_privs = { struct zebra_privs_t test_privs = {

View File

@ -869,12 +869,11 @@ static int run_stop_schedule(void)
if (ratio < 10) if (ratio < 10)
ratio++; ratio++;
TVCALC(interval, ratio TVCALC(interval,
* (TVELEM(&after) ratio * (TVELEM(&after) - TVELEM(&before)
- TVELEM(&before)
+ TVADJUST)); + TVADJUST));
TVCALC(maxinterval, TVELEM(&stopat) TVCALC(maxinterval,
- TVELEM(&after) TVELEM(&stopat) - TVELEM(&after)
+ TVADJUST); + TVADJUST);
if (timercmp(&interval, &maxinterval, >)) if (timercmp(&interval, &maxinterval, >))

Some files were not shown because too many files have changed in this diff Show More