* The general assumption here is that many things tested will
* never happen. And, in real live, up to now, they have not.
*/
- while (seg && (ASSEGMENT_LEN(seg, use32bit)
- <= STREAM_WRITEABLE(s))) {
+ while (seg
+ && (ASSEGMENT_LEN(seg, use32bit)
+ <= STREAM_WRITEABLE(s))) {
struct assegment *next = seg->next;
int written = 0;
int asns_packed = 0;
return 1;
/* find first non-confed segments for each */
- while (seg1 && ((seg1->type == AS_CONFED_SEQUENCE)
- || (seg1->type == AS_CONFED_SET)))
+ while (seg1
+ && ((seg1->type == AS_CONFED_SEQUENCE)
+ || (seg1->type == AS_CONFED_SET)))
seg1 = seg1->next;
- while (seg2 && ((seg2->type == AS_CONFED_SEQUENCE)
- || (seg2->type == AS_CONFED_SET)))
+ while (seg2
+ && ((seg2->type == AS_CONFED_SEQUENCE)
+ || (seg2->type == AS_CONFED_SET)))
seg2 = seg2->next;
/* Check as1's */
`show [ip] bgp paths' command. */
void aspath_print_all_vty(struct vty *vty)
{
- hash_iterate(ashash, (void (*)(struct hash_backet *,
- void *))aspath_show_all_iterator,
+ hash_iterate(ashash,
+ (void (*)(struct hash_backet *,
+ void *))aspath_show_all_iterator,
vty);
}
{BGP_ATTR_PREFIX_SID, "PREFIX_SID"},
{0}};
-static const struct message attr_flag_str[] =
- {
- {BGP_ATTR_FLAG_OPTIONAL, "Optional"},
- {BGP_ATTR_FLAG_TRANS, "Transitive"},
- {BGP_ATTR_FLAG_PARTIAL, "Partial"},
- /* bgp_attr_flags_diagnose() relies on this bit being last in
- this list */
- {BGP_ATTR_FLAG_EXTLEN, "Extended Length"},
- {0}};
+static const struct message attr_flag_str[] = {
+ {BGP_ATTR_FLAG_OPTIONAL, "Optional"},
+ {BGP_ATTR_FLAG_TRANS, "Transitive"},
+ {BGP_ATTR_FLAG_PARTIAL, "Partial"},
+ /* bgp_attr_flags_diagnose() relies on this bit being last in
+ this list */
+ {BGP_ATTR_FLAG_EXTLEN, "Extended Length"},
+ {0}};
static struct hash *cluster_hash;
void attr_show_all(struct vty *vty)
{
- hash_iterate(attrhash, (void (*)(struct hash_backet *,
- void *))attr_show_all_iterator,
- vty);
+ hash_iterate(
+ attrhash,
+ (void (*)(struct hash_backet *, void *))attr_show_all_iterator,
+ vty);
}
static void *bgp_attr_hash_alloc(void *p)
static void
bgp_attr_flags_diagnose(struct bgp_attr_parser_args *args,
u_int8_t desired_flags /* how RFC says it must be */
- )
+)
{
u_char seen = 0, i;
u_char real_flags = args->flags;
* as will PARTIAL for optional+transitive attributes.
*/
const u_int8_t attr_flags_values[] = {
- [BGP_ATTR_ORIGIN] = BGP_ATTR_FLAG_TRANS,
- [BGP_ATTR_AS_PATH] = BGP_ATTR_FLAG_TRANS,
- [BGP_ATTR_NEXT_HOP] = BGP_ATTR_FLAG_TRANS,
- [BGP_ATTR_MULTI_EXIT_DISC] = BGP_ATTR_FLAG_OPTIONAL,
- [BGP_ATTR_LOCAL_PREF] = 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_COMMUNITIES] =
- BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL,
- [BGP_ATTR_ORIGINATOR_ID] = BGP_ATTR_FLAG_OPTIONAL,
- [BGP_ATTR_CLUSTER_LIST] = BGP_ATTR_FLAG_OPTIONAL,
- [BGP_ATTR_MP_REACH_NLRI] = BGP_ATTR_FLAG_OPTIONAL,
- [BGP_ATTR_MP_UNREACH_NLRI] = BGP_ATTR_FLAG_OPTIONAL,
- [BGP_ATTR_EXT_COMMUNITIES] =
- 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_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS,
- [BGP_ATTR_LARGE_COMMUNITIES] =
- BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS,
- [BGP_ATTR_PREFIX_SID] =
- BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS,
+ [BGP_ATTR_ORIGIN] = BGP_ATTR_FLAG_TRANS,
+ [BGP_ATTR_AS_PATH] = BGP_ATTR_FLAG_TRANS,
+ [BGP_ATTR_NEXT_HOP] = BGP_ATTR_FLAG_TRANS,
+ [BGP_ATTR_MULTI_EXIT_DISC] = BGP_ATTR_FLAG_OPTIONAL,
+ [BGP_ATTR_LOCAL_PREF] = 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_COMMUNITIES] = BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL,
+ [BGP_ATTR_ORIGINATOR_ID] = BGP_ATTR_FLAG_OPTIONAL,
+ [BGP_ATTR_CLUSTER_LIST] = BGP_ATTR_FLAG_OPTIONAL,
+ [BGP_ATTR_MP_REACH_NLRI] = BGP_ATTR_FLAG_OPTIONAL,
+ [BGP_ATTR_MP_UNREACH_NLRI] = BGP_ATTR_FLAG_OPTIONAL,
+ [BGP_ATTR_EXT_COMMUNITIES] =
+ 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_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS,
+ [BGP_ATTR_LARGE_COMMUNITIES] =
+ 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;
struct bgp_attr_encap_subtlv *st;
const char *attrname;
- if (!attr || (attrtype == BGP_ATTR_ENCAP
- && (!attr->encap_tunneltype
- || attr->encap_tunneltype == BGP_ENCAP_TYPE_MPLS)))
+ if (!attr
+ || (attrtype == BGP_ATTR_ENCAP
+ && (!attr->encap_tunneltype
+ || attr->encap_tunneltype == BGP_ENCAP_TYPE_MPLS)))
return;
switch (attrtype) {
if (attrlenfield > 0xff) {
/* 2-octet length field */
- stream_putc(s,
- BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL
- | BGP_ATTR_FLAG_EXTLEN);
+ stream_putc(s, BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL
+ | BGP_ATTR_FLAG_EXTLEN);
stream_putc(s, attrtype);
stream_putw(s, attrlenfield & 0xffff);
} else {
if (CHECK_FLAG(peer->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
&& (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_COMMUNITIES))) {
if (attr->community->size * 4 > 255) {
- stream_putc(s,
- BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS
- | BGP_ATTR_FLAG_EXTLEN);
+ stream_putc(s, BGP_ATTR_FLAG_OPTIONAL
+ | BGP_ATTR_FLAG_TRANS
+ | BGP_ATTR_FLAG_EXTLEN);
stream_putc(s, BGP_ATTR_COMMUNITIES);
stream_putw(s, attr->community->size * 4);
} else {
- stream_putc(s,
- BGP_ATTR_FLAG_OPTIONAL
- | BGP_ATTR_FLAG_TRANS);
+ stream_putc(s, BGP_ATTR_FLAG_OPTIONAL
+ | BGP_ATTR_FLAG_TRANS);
stream_putc(s, BGP_ATTR_COMMUNITIES);
stream_putc(s, attr->community->size * 4);
}
PEER_FLAG_SEND_LARGE_COMMUNITY)
&& (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LARGE_COMMUNITIES))) {
if (attr->lcommunity->size * 12 > 255) {
- stream_putc(s,
- BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS
- | BGP_ATTR_FLAG_EXTLEN);
+ stream_putc(s, BGP_ATTR_FLAG_OPTIONAL
+ | BGP_ATTR_FLAG_TRANS
+ | BGP_ATTR_FLAG_EXTLEN);
stream_putc(s, BGP_ATTR_LARGE_COMMUNITIES);
stream_putw(s, attr->lcommunity->size * 12);
} else {
- stream_putc(s,
- BGP_ATTR_FLAG_OPTIONAL
- | BGP_ATTR_FLAG_TRANS);
+ stream_putc(s, BGP_ATTR_FLAG_OPTIONAL
+ | BGP_ATTR_FLAG_TRANS);
stream_putc(s, BGP_ATTR_LARGE_COMMUNITIES);
stream_putc(s, attr->lcommunity->size * 12);
}
if (peer->sort == BGP_PEER_IBGP
|| peer->sort == BGP_PEER_CONFED) {
if (attr->ecommunity->size * 8 > 255) {
- stream_putc(s,
- BGP_ATTR_FLAG_OPTIONAL
- | BGP_ATTR_FLAG_TRANS
- | BGP_ATTR_FLAG_EXTLEN);
+ stream_putc(s, BGP_ATTR_FLAG_OPTIONAL
+ | BGP_ATTR_FLAG_TRANS
+ | BGP_ATTR_FLAG_EXTLEN);
stream_putc(s, BGP_ATTR_EXT_COMMUNITIES);
stream_putw(s, attr->ecommunity->size * 8);
} else {
- stream_putc(s,
- BGP_ATTR_FLAG_OPTIONAL
- | BGP_ATTR_FLAG_TRANS);
+ stream_putc(s, BGP_ATTR_FLAG_OPTIONAL
+ | BGP_ATTR_FLAG_TRANS);
stream_putc(s, BGP_ATTR_EXT_COMMUNITIES);
stream_putc(s, attr->ecommunity->size * 8);
}
label_index = attr->label_index;
if (label_index != BGP_INVALID_LABEL_INDEX) {
- stream_putc(s,
- BGP_ATTR_FLAG_OPTIONAL
- | BGP_ATTR_FLAG_TRANS);
+ stream_putc(s, BGP_ATTR_FLAG_OPTIONAL
+ | BGP_ATTR_FLAG_TRANS);
stream_putc(s, BGP_ATTR_PREFIX_SID);
stream_putc(s, 10);
stream_putc(s, BGP_PREFIX_SID_LABEL_INDEX);
*/
aspath = aspath_delete_confed_seq(aspath);
- stream_putc(s,
- BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL
- | BGP_ATTR_FLAG_EXTLEN);
+ stream_putc(s, BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL
+ | BGP_ATTR_FLAG_EXTLEN);
stream_putc(s, BGP_ATTR_AS4_PATH);
aspath_sizep = stream_get_endp(s);
stream_putw(s, 0);
/* Community attribute. */
if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_COMMUNITIES)) {
if (attr->community->size * 4 > 255) {
- stream_putc(s,
- BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS
- | BGP_ATTR_FLAG_EXTLEN);
+ stream_putc(s, BGP_ATTR_FLAG_OPTIONAL
+ | BGP_ATTR_FLAG_TRANS
+ | BGP_ATTR_FLAG_EXTLEN);
stream_putc(s, BGP_ATTR_COMMUNITIES);
stream_putw(s, attr->community->size * 4);
} else {
- stream_putc(s,
- BGP_ATTR_FLAG_OPTIONAL
- | BGP_ATTR_FLAG_TRANS);
+ stream_putc(s, BGP_ATTR_FLAG_OPTIONAL
+ | BGP_ATTR_FLAG_TRANS);
stream_putc(s, BGP_ATTR_COMMUNITIES);
stream_putc(s, attr->community->size * 4);
}
/* Large Community attribute. */
if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LARGE_COMMUNITIES)) {
if (attr->lcommunity->size * 12 > 255) {
- stream_putc(s,
- BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS
- | BGP_ATTR_FLAG_EXTLEN);
+ stream_putc(s, BGP_ATTR_FLAG_OPTIONAL
+ | BGP_ATTR_FLAG_TRANS
+ | BGP_ATTR_FLAG_EXTLEN);
stream_putc(s, BGP_ATTR_LARGE_COMMUNITIES);
stream_putw(s, attr->lcommunity->size * 12);
} else {
- stream_putc(s,
- BGP_ATTR_FLAG_OPTIONAL
- | BGP_ATTR_FLAG_TRANS);
+ stream_putc(s, BGP_ATTR_FLAG_OPTIONAL
+ | BGP_ATTR_FLAG_TRANS);
stream_putc(s, BGP_ATTR_LARGE_COMMUNITIES);
stream_putc(s, attr->lcommunity->size * 12);
}
/* Prefix SID */
if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_PREFIX_SID)) {
if (attr->label_index != BGP_INVALID_LABEL_INDEX) {
- stream_putc(s,
- BGP_ATTR_FLAG_OPTIONAL
- | BGP_ATTR_FLAG_TRANS);
+ stream_putc(s, BGP_ATTR_FLAG_OPTIONAL
+ | BGP_ATTR_FLAG_TRANS);
stream_putc(s, BGP_ATTR_PREFIX_SID);
stream_putc(s, 10);
stream_putc(s, BGP_PREFIX_SID_LABEL_INDEX);
BGP_ATTR_PARSE_WITHDRAW = -2,
/* only used internally, send notify + convert to BGP_ATTR_PARSE_ERROR
- */
+ */
BGP_ATTR_PARSE_ERROR_NOTIFYPLS = -3,
} bgp_attr_parse_ret_t;
if ((multihop
&& !CHECK_FLAG(bfd_info->flags,
BFD_FLAG_BFD_TYPE_MULTIHOP))
- || (!multihop && CHECK_FLAG(bfd_info->flags,
- BFD_FLAG_BFD_TYPE_MULTIHOP))) {
+ || (!multihop
+ && CHECK_FLAG(bfd_info->flags,
+ BFD_FLAG_BFD_TYPE_MULTIHOP))) {
bgp_bfd_peer_sendmsg(peer, ZEBRA_BFD_DEST_DEREGISTER);
bgp_bfd_peer_sendmsg(peer, ZEBRA_BFD_DEST_REGISTER);
}
/* privileges */
static zebra_capabilities_t _caps_p[] = {
- ZCAP_BIND, ZCAP_NET_RAW, ZCAP_NET_ADMIN,
+ ZCAP_BIND,
+ ZCAP_NET_RAW,
+ ZCAP_NET_ADMIN,
};
struct zebra_privs_t bgpd_privs = {
/* Initialize params per bgp_damp_config. */
damp->reuse_index_size = REUSE_ARRAY_SIZE;
- damp->ceiling =
- (int)(damp->reuse_limit * (pow(2,
- (double)damp->max_suppress_time
- / damp->half_life)));
+ damp->ceiling = (int)(damp->reuse_limit
+ * (pow(2, (double)damp->max_suppress_time
+ / damp->half_life)));
/* Decay-array computations */
damp->decay_array_size =
for (i = 0; i < damp->reuse_index_size; i++) {
damp->reuse_index[i] =
(int)(((double)damp->half_life / DELTA_REUSE)
- * log10(1.0 / (damp->reuse_limit
- * (1.0 + ((double)i
- / damp->scale_factor))))
+ * log10(1.0
+ / (damp->reuse_limit
+ * (1.0
+ + ((double)i
+ / damp->scale_factor))))
/ log10(0.5));
}
}
/* Populate fake peer at index 0, for locally originated routes */
/* Peer type (IPv4) */
- stream_putc(obuf,
- TABLE_DUMP_V2_PEER_INDEX_TABLE_AS4
- + TABLE_DUMP_V2_PEER_INDEX_TABLE_IP);
+ stream_putc(obuf, TABLE_DUMP_V2_PEER_INDEX_TABLE_AS4
+ + TABLE_DUMP_V2_PEER_INDEX_TABLE_IP);
/* Peer BGP ID (0.0.0.0) */
stream_putl(obuf, 0);
/* Peer IP address (0.0.0.0) */
*/
void bgp_evpn_cleanup_on_disable(struct bgp *bgp)
{
- hash_iterate(bgp->vnihash, (void (*)(struct hash_backet *,
- void *))cleanup_vni_on_disable,
- bgp);
+ hash_iterate(
+ bgp->vnihash,
+ (void (*)(struct hash_backet *, void *))cleanup_vni_on_disable,
+ bgp);
}
/*
void bgp_evpn_cleanup(struct bgp *bgp)
{
if (bgp->vnihash)
- hash_iterate(bgp->vnihash, (void (*)(struct hash_backet *,
- void *))free_vni_entry,
- bgp);
+ hash_iterate(
+ bgp->vnihash,
+ (void (*)(struct hash_backet *, void *))free_vni_entry,
+ bgp);
if (bgp->import_rt_hash)
hash_free(bgp->import_rt_hash);
bgp->import_rt_hash = NULL;
wctx.bgp = bgp;
wctx.vty = vty;
wctx.vtep_ip = vtep_ip;
- hash_iterate(bgp->vnihash, (void (*)(struct hash_backet *,
- void *))show_vni_routes_hash,
- &wctx);
+ hash_iterate(
+ bgp->vnihash,
+ (void (*)(struct hash_backet *, void *))show_vni_routes_hash,
+ &wctx);
}
/*
}
if (other == peer)
- ret =
- 1; /* bgp_establish specific code when xfer_conn
- happens. */
+ ret = 1; /* bgp_establish specific code when xfer_conn
+ happens. */
/* Reset capability open status flag. */
if (!CHECK_FLAG(peer->sflags, PEER_STATUS_CAPABILITY_OPEN))
* an error SHOULD
* be logged locally, and the prefix SHOULD be
* ignored.
- */
+ */
zlog_err(
"%s: IPv4 labeled-unicast NLRI is multicast address %s, ignoring",
peer->host, inet_ntoa(p.u.prefix4));
/* privileges */
static zebra_capabilities_t _caps_p[] = {
- ZCAP_BIND, ZCAP_NET_RAW, ZCAP_NET_ADMIN,
+ ZCAP_BIND,
+ ZCAP_NET_RAW,
+ ZCAP_NET_ADMIN,
};
struct zebra_privs_t bgpd_privs = {
bgp_attr_dup(&attr, new_best->attr);
- if (new_best->peer && bgp_flag_check(new_best->peer->bgp,
- BGP_FLAG_MULTIPATH_RELAX_AS_SET)) {
+ if (new_best->peer
+ && bgp_flag_check(new_best->peer->bgp,
+ BGP_FLAG_MULTIPATH_RELAX_AS_SET)) {
/* aggregate attribute from multipath constituents */
aspath = aspath_dup(attr.aspath);
if (use_json) {
json_object_object_add(json, "routes", json_nroute);
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
} else {
if (output_count == 0)
if (ret) {
zlog_err(
"%s: Can't set TxTTL on peer (rtrid %s) socket, err = %d",
- __func__, inet_ntop(AF_INET, &peer->remote_id,
- buf, sizeof(buf)),
+ __func__,
+ inet_ntop(AF_INET, &peer->remote_id, buf,
+ sizeof(buf)),
errno);
return ret;
}
if (ret) {
zlog_err(
"%s: Can't set TxTTL on peer (rtrid %s) socket, err = %d",
- __func__, inet_ntop(AF_INET, &peer->remote_id,
- buf, sizeof(buf)),
+ __func__,
+ inet_ntop(AF_INET, &peer->remote_id, buf,
+ sizeof(buf)),
errno);
return ret;
}
if (ret) {
zlog_err(
"%s: Can't set MinTTL on peer (rtrid %s) socket, err = %d",
- __func__, inet_ntop(AF_INET, &peer->remote_id,
- buf, sizeof(buf)),
+ __func__,
+ inet_ntop(AF_INET, &peer->remote_id, buf,
+ sizeof(buf)),
errno);
return ret;
}
/* Minimum sizes for length field of each cap (so not inc. the header) */
static const size_t cap_minsizes[] = {
- [CAPABILITY_CODE_MP] = CAPABILITY_CODE_MP_LEN,
- [CAPABILITY_CODE_REFRESH] = CAPABILITY_CODE_REFRESH_LEN,
- [CAPABILITY_CODE_ORF] = CAPABILITY_CODE_ORF_LEN,
- [CAPABILITY_CODE_RESTART] = CAPABILITY_CODE_RESTART_LEN,
- [CAPABILITY_CODE_AS4] = CAPABILITY_CODE_AS4_LEN,
- [CAPABILITY_CODE_ADDPATH] = CAPABILITY_CODE_ADDPATH_LEN,
- [CAPABILITY_CODE_DYNAMIC] = CAPABILITY_CODE_DYNAMIC_LEN,
- [CAPABILITY_CODE_DYNAMIC_OLD] = CAPABILITY_CODE_DYNAMIC_LEN,
- [CAPABILITY_CODE_ENHE] = CAPABILITY_CODE_ENHE_LEN,
- [CAPABILITY_CODE_REFRESH_OLD] = CAPABILITY_CODE_REFRESH_LEN,
- [CAPABILITY_CODE_ORF_OLD] = CAPABILITY_CODE_ORF_LEN,
- [CAPABILITY_CODE_FQDN] = CAPABILITY_CODE_MIN_FQDN_LEN,
+ [CAPABILITY_CODE_MP] = CAPABILITY_CODE_MP_LEN,
+ [CAPABILITY_CODE_REFRESH] = CAPABILITY_CODE_REFRESH_LEN,
+ [CAPABILITY_CODE_ORF] = CAPABILITY_CODE_ORF_LEN,
+ [CAPABILITY_CODE_RESTART] = CAPABILITY_CODE_RESTART_LEN,
+ [CAPABILITY_CODE_AS4] = CAPABILITY_CODE_AS4_LEN,
+ [CAPABILITY_CODE_ADDPATH] = CAPABILITY_CODE_ADDPATH_LEN,
+ [CAPABILITY_CODE_DYNAMIC] = CAPABILITY_CODE_DYNAMIC_LEN,
+ [CAPABILITY_CODE_DYNAMIC_OLD] = CAPABILITY_CODE_DYNAMIC_LEN,
+ [CAPABILITY_CODE_ENHE] = CAPABILITY_CODE_ENHE_LEN,
+ [CAPABILITY_CODE_REFRESH_OLD] = CAPABILITY_CODE_REFRESH_LEN,
+ [CAPABILITY_CODE_ORF_OLD] = CAPABILITY_CODE_ORF_LEN,
+ [CAPABILITY_CODE_FQDN] = CAPABILITY_CODE_MIN_FQDN_LEN,
};
/* value the capability must be a multiple of.
* table should be set to 1.
*/
static const size_t cap_modsizes[] = {
- [CAPABILITY_CODE_MP] = 4,
- [CAPABILITY_CODE_REFRESH] = 1,
- [CAPABILITY_CODE_ORF] = 1,
- [CAPABILITY_CODE_RESTART] = 1,
- [CAPABILITY_CODE_AS4] = 4,
- [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,
+ [CAPABILITY_CODE_MP] = 4, [CAPABILITY_CODE_REFRESH] = 1,
+ [CAPABILITY_CODE_ORF] = 1, [CAPABILITY_CODE_RESTART] = 1,
+ [CAPABILITY_CODE_AS4] = 4, [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,
};
/**
*/
SET_FLAG(peer->cap, PEER_CAP_ENHE_ADV);
stream_putc(s, BGP_OPEN_OPT_CAP);
- stream_putc(s,
- CAPABILITY_CODE_ENHE_LEN
- + 2);
+ stream_putc(s, CAPABILITY_CODE_ENHE_LEN
+ + 2);
stream_putc(s, CAPABILITY_CODE_ENHE);
stream_putc(s,
CAPABILITY_CODE_ENHE_LEN);
/* Set open packet values. */
stream_putc(s, BGP_VERSION_4); /* BGP version */
- stream_putw(s,
- (local_as <= BGP_AS_MAX) ? (u_int16_t)local_as
- : BGP_AS_TRANS);
+ stream_putw(s, (local_as <= BGP_AS_MAX) ? (u_int16_t)local_as
+ : BGP_AS_TRANS);
stream_putw(s, send_holdtime); /* Hold Time */
stream_put_in_addr(s, &peer->local_id); /* BGP Identifier */
: NULL);
/* First update is deferred until ORF or ROUTE-REFRESH is received */
- if (onlypeer && CHECK_FLAG(onlypeer->af_sflags[afi][safi],
- PEER_STATUS_ORF_WAIT_REFRESH))
+ if (onlypeer
+ && CHECK_FLAG(onlypeer->af_sflags[afi][safi],
+ PEER_STATUS_ORF_WAIT_REFRESH))
return 0;
memset(&attr, 0, sizeof(struct attr));
* an error SHOULD
* be logged locally, and the prefix SHOULD be
* ignored.
- */
+ */
zlog_err(
"%s: IPv4 unicast NLRI is multicast address %s, ignoring",
peer->host, inet_ntoa(p.u.prefix4));
}
ALIAS(no_bgp_network, no_bgp_network_label_index_cmd,
- "no network A.B.C.D/M label-index (0-1048560)", NO_STR
+ "no network A.B.C.D/M label-index (0-1048560)",
+ NO_STR
"Specify a network to announce via BGP\n"
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
"Label index to associate with the prefix\n"
"Label index value\n")
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_STR
+ "no network A.B.C.D/M label-index (0-1048560) route-map WORD",
+ NO_STR
"Specify a network to announce via BGP\n"
"IP prefix\n"
"Label index to associate with the prefix\n"
}
ALIAS(no_ipv6_bgp_network, no_ipv6_bgp_network_label_index_cmd,
- "no network X:X::X:X/M label-index (0-1048560)", NO_STR
+ "no network X:X::X:X/M label-index (0-1048560)",
+ NO_STR
"Specify a network to announce via BGP\n"
"IPv6 prefix <network>/<length>\n"
"Label index to associate with the prefix\n"
"Label index value\n")
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_STR
+ "no network X:X::X:X/M label-index (0-1048560) route-map WORD",
+ NO_STR
"Specify a network to announce via BGP\n"
"IPv6 prefix\n"
"Label index to associate with the prefix\n"
len = vty_out(
vty, "%s",
binfo->peer->conf_if);
- len =
- 7 - len; /* len of IPv6
- addr + max
- len of def
- ifname */
+ len = 7 - len; /* len of IPv6
+ addr + max
+ len of def
+ ifname */
if (len < 1)
vty_out(vty, "\n%*s",
bgp_damp_reuse_time_vty(vty, binfo, timebuf, BGP_UPTIME_LEN,
use_json, json);
else
- vty_out(vty, "%s ", bgp_damp_reuse_time_vty(vty, binfo, timebuf,
- BGP_UPTIME_LEN,
- use_json, json));
+ vty_out(vty, "%s ",
+ bgp_damp_reuse_time_vty(vty, binfo, timebuf,
+ BGP_UPTIME_LEN, use_json,
+ json));
/* Print attribute */
attr = binfo->attr;
peer_uptime(bdi->start_time, timebuf, BGP_UPTIME_LEN, use_json,
json);
else
- vty_out(vty, "%s ", peer_uptime(bdi->start_time, timebuf,
- BGP_UPTIME_LEN, 0, NULL));
+ vty_out(vty, "%s ",
+ peer_uptime(bdi->start_time, timebuf, BGP_UPTIME_LEN, 0,
+ NULL));
if (CHECK_FLAG(binfo->flags, BGP_INFO_DAMPED)
&& !CHECK_FLAG(binfo->flags, BGP_INFO_HISTORY)) {
if (display)
json_object_object_add(json, "paths", json_paths);
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
} else {
if (!display) {
};
static const char *table_stats_strs[] = {
- [BGP_STATS_PREFIXES] = "Total Prefixes",
- [BGP_STATS_TOTPLEN] = "Average prefix length",
- [BGP_STATS_RIB] = "Total Advertisements",
- [BGP_STATS_UNAGGREGATEABLE] = "Unaggregateable prefixes",
- [BGP_STATS_MAX_AGGREGATEABLE] =
- "Maximum aggregateable prefixes",
- [BGP_STATS_AGGREGATES] = "BGP Aggregate advertisements",
- [BGP_STATS_SPACE] = "Address space advertised",
- [BGP_STATS_ASPATH_COUNT] = "Advertisements with paths",
- [BGP_STATS_ASPATH_MAXHOPS] = "Longest AS-Path (hops)",
- [BGP_STATS_ASPATH_MAXSIZE] = "Largest AS-Path (bytes)",
- [BGP_STATS_ASPATH_TOTHOPS] = "Average AS-Path length (hops)",
- [BGP_STATS_ASPATH_TOTSIZE] = "Average AS-Path size (bytes)",
- [BGP_STATS_ASN_HIGHEST] = "Highest public ASN",
- [BGP_STATS_MAX] = NULL,
+ [BGP_STATS_PREFIXES] = "Total Prefixes",
+ [BGP_STATS_TOTPLEN] = "Average prefix length",
+ [BGP_STATS_RIB] = "Total Advertisements",
+ [BGP_STATS_UNAGGREGATEABLE] = "Unaggregateable prefixes",
+ [BGP_STATS_MAX_AGGREGATEABLE] = "Maximum aggregateable prefixes",
+ [BGP_STATS_AGGREGATES] = "BGP Aggregate advertisements",
+ [BGP_STATS_SPACE] = "Address space advertised",
+ [BGP_STATS_ASPATH_COUNT] = "Advertisements with paths",
+ [BGP_STATS_ASPATH_MAXHOPS] = "Longest AS-Path (hops)",
+ [BGP_STATS_ASPATH_MAXSIZE] = "Largest AS-Path (bytes)",
+ [BGP_STATS_ASPATH_TOTHOPS] = "Average AS-Path length (hops)",
+ [BGP_STATS_ASPATH_TOTSIZE] = "Average AS-Path size (bytes)",
+ [BGP_STATS_ASN_HIGHEST] = "Highest public ASN",
+ [BGP_STATS_MAX] = NULL,
};
struct bgp_table_stats {
};
static const char *pcount_strs[] = {
- [PCOUNT_ADJ_IN] = "Adj-in",
- [PCOUNT_DAMPED] = "Damped",
- [PCOUNT_REMOVED] = "Removed",
- [PCOUNT_HISTORY] = "History",
- [PCOUNT_STALE] = "Stale",
- [PCOUNT_VALID] = "Valid",
- [PCOUNT_ALL] = "All RIB",
- [PCOUNT_COUNTED] = "PfxCt counted",
- [PCOUNT_PFCNT] = "Useable",
- [PCOUNT_MAX] = NULL,
+ [PCOUNT_ADJ_IN] = "Adj-in", [PCOUNT_DAMPED] = "Damped",
+ [PCOUNT_REMOVED] = "Removed", [PCOUNT_HISTORY] = "History",
+ [PCOUNT_STALE] = "Stale", [PCOUNT_VALID] = "Valid",
+ [PCOUNT_ALL] = "All RIB", [PCOUNT_COUNTED] = "PfxCt counted",
+ [PCOUNT_PFCNT] = "Useable", [PCOUNT_MAX] = NULL,
};
struct peer_pcounts {
pcounts.table = peer->bgp->rib[afi][safi];
/* in-place call via thread subsystem so as to record execution time
- * * stats for the thread-walk (i.e. ensure this can't be blamed on
- * * on just vty_read()).
- * */
+ * * stats for the thread-walk (i.e. ensure this can't be blamed on
+ * * on just vty_read()).
+ * */
thread_execute(bm->master, bgp_peer_count_walker, &pcounts, 0);
if (use_json) {
"bgpOriginatingDefaultNetwork",
"0.0.0.0");
} else {
- vty_out(vty, "BGP table version is %" PRIu64
- ", local router ID is %s\n",
+ vty_out(vty,
+ "BGP table version is %" PRIu64
+ ", local router ID is %s\n",
table->version, inet_ntoa(bgp->router_id));
vty_out(vty, BGP_SHOW_SCODE_HEADER);
vty_out(vty, BGP_SHOW_OCODE_HEADER);
struct in6_addr addr6;
} un; /* cached un address */
time_t create_time;
- struct
- prefix
- aux_prefix; /* AFI_L2VPN: the IP addr,
- if family set */
+ struct prefix aux_prefix; /* AFI_L2VPN: the IP addr,
+ if family set */
} import;
} vnc;
/* Route map commands for metric matching. */
struct route_map_rule_cmd route_match_metric_cmd = {
- "metric", route_match_metric, route_value_compile, route_value_free,
+ "metric",
+ route_match_metric,
+ route_value_compile,
+ route_value_free,
};
/* `match as-path ASPATH' */
/* Route map commands for tag matching. */
static struct route_map_rule_cmd route_match_tag_cmd = {
- "tag", route_match_tag, route_map_rule_tag_compile,
+ "tag",
+ route_match_tag,
+ route_map_rule_tag_compile,
route_map_rule_tag_free,
};
/* Set local preference rule structure. */
struct route_map_rule_cmd route_set_local_pref_cmd = {
- "local-preference", route_set_local_pref, route_value_compile,
+ "local-preference",
+ route_set_local_pref,
+ route_value_compile,
route_value_free,
};
/* Set local preference rule structure. */
struct route_map_rule_cmd route_set_weight_cmd = {
- "weight", route_set_weight, route_value_compile, route_value_free,
+ "weight",
+ route_set_weight,
+ route_value_compile,
+ route_value_free,
};
/* `set metric METRIC' */
/* Set metric rule structure. */
struct route_map_rule_cmd route_set_metric_cmd = {
- "metric", route_set_metric, route_value_compile, route_value_free,
+ "metric",
+ route_set_metric,
+ route_value_compile,
+ route_value_free,
};
/* `set as-path prepend ASPATH' */
/* Set as-path prepend rule structure. */
struct route_map_rule_cmd route_set_aspath_prepend_cmd = {
- "as-path prepend", route_set_aspath_prepend,
- route_set_aspath_prepend_compile, route_set_aspath_prepend_free,
+ "as-path prepend",
+ route_set_aspath_prepend,
+ route_set_aspath_prepend_compile,
+ route_set_aspath_prepend_free,
};
/* `set as-path exclude ASn' */
/* Set ASn exlude rule structure. */
struct route_map_rule_cmd route_set_aspath_exclude_cmd = {
- "as-path exclude", route_set_aspath_exclude, route_aspath_compile,
+ "as-path exclude",
+ route_set_aspath_exclude,
+ route_aspath_compile,
route_aspath_free,
};
/* Set community rule structure. */
struct route_map_rule_cmd route_set_community_cmd = {
- "community", route_set_community, route_set_community_compile,
+ "community",
+ route_set_community,
+ route_set_community_compile,
route_set_community_free,
};
/* Set community rule structure. */
struct route_map_rule_cmd route_set_lcommunity_cmd = {
- "large-community", route_set_lcommunity, route_set_lcommunity_compile,
+ "large-community",
+ route_set_lcommunity,
+ route_set_lcommunity_compile,
route_set_lcommunity_free,
};
/* Set lcommunity rule structure. */
struct route_map_rule_cmd route_set_lcommunity_delete_cmd = {
- "large-comm-list", route_set_lcommunity_delete,
- route_set_lcommunity_delete_compile, route_set_lcommunity_delete_free,
+ "large-comm-list",
+ route_set_lcommunity_delete,
+ route_set_lcommunity_delete_compile,
+ route_set_lcommunity_delete_free,
};
/* Set community rule structure. */
struct route_map_rule_cmd route_set_community_delete_cmd = {
- "comm-list", route_set_community_delete,
- route_set_community_delete_compile, route_set_community_delete_free,
+ "comm-list",
+ route_set_community_delete,
+ route_set_community_delete_compile,
+ route_set_community_delete_free,
};
/* `set extcommunity rt COMMUNITY' */
/* Set community rule structure. */
struct route_map_rule_cmd route_set_ecommunity_rt_cmd = {
- "extcommunity rt", route_set_ecommunity,
- route_set_ecommunity_rt_compile, route_set_ecommunity_free,
+ "extcommunity rt",
+ route_set_ecommunity,
+ route_set_ecommunity_rt_compile,
+ route_set_ecommunity_free,
};
/* `set extcommunity soo COMMUNITY' */
/* Set community rule structure. */
struct route_map_rule_cmd route_set_ecommunity_soo_cmd = {
- "extcommunity soo", route_set_ecommunity,
- route_set_ecommunity_soo_compile, route_set_ecommunity_free,
+ "extcommunity soo",
+ route_set_ecommunity,
+ route_set_ecommunity_soo_compile,
+ route_set_ecommunity_free,
};
/* `set origin ORIGIN' */
/* Set origin rule structure. */
struct route_map_rule_cmd route_set_origin_cmd = {
- "origin", route_set_origin, route_set_origin_compile,
+ "origin",
+ route_set_origin,
+ route_set_origin_compile,
route_set_origin_free,
};
/* Set atomic aggregate rule structure. */
struct route_map_rule_cmd route_set_atomic_aggregate_cmd = {
- "atomic-aggregate", route_set_atomic_aggregate,
- route_set_atomic_aggregate_compile, route_set_atomic_aggregate_free,
+ "atomic-aggregate",
+ route_set_atomic_aggregate,
+ route_set_atomic_aggregate_compile,
+ route_set_atomic_aggregate_free,
};
/* `set aggregator as AS A.B.C.D' */
}
struct route_map_rule_cmd route_set_aggregator_as_cmd = {
- "aggregator as", route_set_aggregator_as,
- route_set_aggregator_as_compile, route_set_aggregator_as_free,
+ "aggregator as",
+ route_set_aggregator_as,
+ route_set_aggregator_as_compile,
+ route_set_aggregator_as_free,
};
/* Set tag to object. object must be pointer to struct bgp_info */
/* Route map commands for tag set. */
static struct route_map_rule_cmd route_set_tag_cmd = {
- "tag", route_set_tag, route_map_rule_tag_compile,
+ "tag",
+ route_set_tag,
+ route_map_rule_tag_compile,
route_map_rule_tag_free,
};
/* Route map commands for label-index set. */
static struct route_map_rule_cmd route_set_label_index_cmd = {
- "label-index", route_set_label_index, route_value_compile,
+ "label-index",
+ route_set_label_index,
+ route_value_compile,
route_value_free,
};
/* Set originator-id rule structure. */
struct route_map_rule_cmd route_set_originator_id_cmd = {
- "originator-id", route_set_originator_id,
- route_set_originator_id_compile, route_set_originator_id_free,
+ "originator-id",
+ route_set_originator_id,
+ route_set_originator_id_compile,
+ route_set_originator_id_free,
};
/* Add bgp route map rule. */
return SNMP_INTEGER(-1);
break;
case BGP4PATHATTRBEST: /* 13 */
- /* $FRR indent$ */
- /* clang-format off */
#define BGP4_PathAttrBest_false 1
#define BGP4_PathAttrBest_true 2
if (CHECK_FLAG(binfo->flags, BGP_INFO_SELECTED))
}
/*
-* update_subgroup_merge_check_thread_cb
-*/
+ * update_subgroup_merge_check_thread_cb
+ */
static int update_subgroup_merge_check_thread_cb(struct thread *thread)
{
struct update_subgroup *subgrp;
*/
#define SUBGRP_DECR_STAT(subgrp, stat) SUBGRP_INCR_STAT_BY(subgrp, stat, -1)
-
typedef int (*updgrp_walkcb)(struct update_group *updgrp, void *ctx);
/* really a private structure */
*/
onlypeer = ((SUBGRP_PCOUNT(subgrp) == 1) ? (SUBGRP_PFIRST(subgrp))->peer
: NULL);
- if (onlypeer && CHECK_FLAG(onlypeer->af_sflags[SUBGRP_AFI(subgrp)]
- [SUBGRP_SAFI(subgrp)],
- PEER_STATUS_ORF_WAIT_REFRESH))
+ if (onlypeer
+ && CHECK_FLAG(onlypeer->af_sflags[SUBGRP_AFI(subgrp)]
+ [SUBGRP_SAFI(subgrp)],
+ PEER_STATUS_ORF_WAIT_REFRESH))
return;
if (SUBGRP_SAFI(subgrp) != SAFI_MPLS_VPN
space_remaining = STREAM_CONCAT_REMAIN(s, snlri, STREAM_SIZE(s))
- BGP_MAX_PACKET_SIZE_OVERFLOW;
- space_needed = BGP_NLRI_LENGTH + bgp_packet_mpattr_prefix_size(
- afi, safi, &rn->p);
+ space_needed =
+ BGP_NLRI_LENGTH
+ + bgp_packet_mpattr_prefix_size(afi, safi, &rn->p);
/* When remaining space can't include NLRI and it's length. */
if (space_remaining < space_needed)
space_remaining =
STREAM_CONCAT_REMAIN(s, snlri, STREAM_SIZE(s))
- BGP_MAX_PACKET_SIZE_OVERFLOW;
- space_needed =
- BGP_NLRI_LENGTH + bgp_packet_mpattr_prefix_size(
- afi, safi, &rn->p);
+ space_needed = BGP_NLRI_LENGTH
+ + bgp_packet_mpattr_prefix_size(
+ afi, safi, &rn->p);
/* If the attributes alone do not leave any room for
* NLRI then
}
if (use_json) {
json_object_object_add(json, "routes", json_routes);
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
}
return CMD_SUCCESS;
}
ALIAS_HIDDEN(no_bgp_maxpaths, no_bgp_maxpaths_hidden_cmd,
- "no maximum-paths [" CMD_RANGE_STR(1, MULTIPATH_NUM) "]", NO_STR
+ "no maximum-paths [" CMD_RANGE_STR(1, MULTIPATH_NUM) "]",
+ NO_STR
"Forward packets over multiple paths\n"
"Number of paths\n")
json_object_int_add(json, "totalVrfs", count);
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
} else {
if (count)
/* Other attributes */
if ((count = community_count()))
vty_out(vty, "%ld BGP community entries, using %s of memory\n",
- count, mtype_memstr(memstrbuf, sizeof(memstrbuf),
- count * sizeof(struct community)));
+ count,
+ mtype_memstr(memstrbuf, sizeof(memstrbuf),
+ count * sizeof(struct community)));
if ((count = mtype_stats_alloc(MTYPE_ECOMMUNITY)))
vty_out(vty, "%ld BGP community entries, using %s of memory\n",
- count, mtype_memstr(memstrbuf, sizeof(memstrbuf),
- count * sizeof(struct ecommunity)));
+ count,
+ mtype_memstr(memstrbuf, sizeof(memstrbuf),
+ count * sizeof(struct ecommunity)));
if ((count = mtype_stats_alloc(MTYPE_LCOMMUNITY)))
vty_out(vty,
"%ld BGP large-community entries, using %s of memory\n",
- count, mtype_memstr(memstrbuf, sizeof(memstrbuf),
- count * sizeof(struct lcommunity)));
+ count,
+ mtype_memstr(memstrbuf, sizeof(memstrbuf),
+ count * sizeof(struct lcommunity)));
if ((count = mtype_stats_alloc(MTYPE_CLUSTER)))
vty_out(vty, "%ld Cluster lists, using %s of memory\n", count,
count * sizeof(struct hash_backet)));
if ((count = mtype_stats_alloc(MTYPE_BGP_REGEXP)))
vty_out(vty, "%ld compiled regexes, using %s of memory\n",
- count, mtype_memstr(memstrbuf, sizeof(memstrbuf),
- count * sizeof(regex_t)));
+ count,
+ mtype_memstr(memstrbuf, sizeof(memstrbuf),
+ count * sizeof(regex_t)));
return CMD_SUCCESS;
}
ents);
json_object_int_add(
json, "peerGroupMemory",
- ents * sizeof(struct
- peer_group));
+ ents
+ * sizeof(struct
+ peer_group));
}
if (CHECK_FLAG(bgp->af_flags[afi][safi],
mtype_memstr(
memstrbuf,
sizeof(memstrbuf),
- ents * sizeof(struct
- bgp_node)));
+ ents
+ * sizeof(struct
+ bgp_node)));
/* Peer related usage */
ents = listcount(bgp->peer);
mtype_memstr(
memstrbuf,
sizeof(memstrbuf),
- ents * sizeof(struct
- peer)));
+ ents
+ * sizeof(struct
+ peer)));
if ((ents = listcount(bgp->group)))
vty_out(vty,
mtype_memstr(
memstrbuf,
sizeof(memstrbuf),
- ents * sizeof(struct
- peer_group)));
+ ents
+ * sizeof(struct
+ peer_group)));
if (CHECK_FLAG(bgp->af_flags[afi][safi],
BGP_CONFIG_DAMPENING))
vty_out(vty, "%*s",
max_neighbor_width - len, " ");
- vty_out(vty, "4 %10u %7d %7d %8" PRIu64
- " %4d %4zd %8s",
+ vty_out(vty,
+ "4 %10u %7d %7d %8" PRIu64
+ " %4d %4zd %8s",
peer->as,
peer->open_in + peer->update_in
+ peer->keepalive_in
json_object_int_add(json, "totalPeers", count);
json_object_int_add(json, "dynamicPeers", dn_count);
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
} else {
if (count)
}
safi++;
if (safi == SAFI_RESERVED_4
- || safi
- == SAFI_RESERVED_5) /* handle special
- cases to match
- zebra.h */
+ || safi == SAFI_RESERVED_5) /* handle special
+ cases to match
+ zebra.h */
safi++;
if (!safi_wildcard)
safi = SAFI_MAX;
paf = peer_af_find(p, afi, safi);
if (paf && PAF_SUBGRP(paf)) {
- vty_out(vty, " Update group %" PRIu64
- ", subgroup %" PRIu64 "\n",
+ vty_out(vty,
+ " Update group %" PRIu64 ", subgroup %" PRIu64
+ "\n",
PAF_UPDGRP(paf)->id, PAF_SUBGRP(paf)->id);
vty_out(vty, " Packet Queue length %d\n",
bpacket_queue_virtual_length(paf));
} else
vty_out(vty,
" Reduce the no. of prefix from %s, will restart in %ld seconds\n",
- p->host, thread_timer_remain_second(
- p->t_pmax_restart));
+ p->host,
+ thread_timer_remain_second(
+ p->t_pmax_restart));
} else {
if (use_json)
json_object_boolean_true_add(
}
if (use_json) {
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
} else {
vty_out(vty, "\n");
/* BGP node structure. */
static struct cmd_node bgp_node = {
- BGP_NODE, "%s(config-router)# ", 1,
+ BGP_NODE,
+ "%s(config-router)# ",
+ 1,
};
static struct cmd_node bgp_ipv4_unicast_node = {
- BGP_IPV4_NODE, "%s(config-router-af)# ", 1,
+ BGP_IPV4_NODE,
+ "%s(config-router-af)# ",
+ 1,
};
static struct cmd_node bgp_ipv4_multicast_node = {
- BGP_IPV4M_NODE, "%s(config-router-af)# ", 1,
+ BGP_IPV4M_NODE,
+ "%s(config-router-af)# ",
+ 1,
};
static struct cmd_node bgp_ipv4_labeled_unicast_node = {
- BGP_IPV4L_NODE, "%s(config-router-af)# ", 1,
+ BGP_IPV4L_NODE,
+ "%s(config-router-af)# ",
+ 1,
};
static struct cmd_node bgp_ipv6_unicast_node = {
- BGP_IPV6_NODE, "%s(config-router-af)# ", 1,
+ BGP_IPV6_NODE,
+ "%s(config-router-af)# ",
+ 1,
};
static struct cmd_node bgp_ipv6_multicast_node = {
- BGP_IPV6M_NODE, "%s(config-router-af)# ", 1,
+ BGP_IPV6M_NODE,
+ "%s(config-router-af)# ",
+ 1,
};
static struct cmd_node bgp_ipv6_labeled_unicast_node = {
- BGP_IPV6L_NODE, "%s(config-router-af)# ", 1,
+ BGP_IPV6L_NODE,
+ "%s(config-router-af)# ",
+ 1,
};
static struct cmd_node bgp_vpnv4_node = {BGP_VPNV4_NODE,
zlog_debug(
"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),
- api.instance, inet_ntop(AF_INET, &p.prefix,
- buf[0], sizeof(buf[0])),
- p.prefixlen, inet_ntop(AF_INET, &nexthop,
- buf[1], sizeof(buf[1])),
+ api.instance,
+ inet_ntop(AF_INET, &p.prefix, buf[0],
+ sizeof(buf[0])),
+ p.prefixlen,
+ inet_ntop(AF_INET, &nexthop, buf[1],
+ sizeof(buf[1])),
api.metric, api.tag);
}
"Rx IPv4 route delete VRF %u %s[%d] %s/%d "
"nexthop %s metric %u tag %" ROUTE_TAG_PRI,
vrf_id, zebra_route_string(api.type),
- api.instance, inet_ntop(AF_INET, &p.prefix,
- buf[0], sizeof(buf[0])),
- p.prefixlen, inet_ntop(AF_INET, &nexthop,
- buf[1], sizeof(buf[1])),
+ api.instance,
+ inet_ntop(AF_INET, &p.prefix, buf[0],
+ sizeof(buf[0])),
+ p.prefixlen,
+ inet_ntop(AF_INET, &nexthop, buf[1],
+ sizeof(buf[1])),
api.metric, api.tag);
}
bgp_redistribute_delete(bgp, (struct prefix *)&p, api.type,
zlog_debug(
"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),
- api.instance, inet_ntop(AF_INET6, &p.prefix,
- buf[0], sizeof(buf[0])),
- p.prefixlen, inet_ntop(AF_INET, &nexthop,
- buf[1], sizeof(buf[1])),
+ api.instance,
+ inet_ntop(AF_INET6, &p.prefix, buf[0],
+ sizeof(buf[0])),
+ p.prefixlen,
+ inet_ntop(AF_INET, &nexthop, buf[1],
+ sizeof(buf[1])),
api.metric, api.tag);
}
"Rx IPv6 route delete VRF %u %s[%d] %s/%d "
"nexthop %s metric %u tag %" ROUTE_TAG_PRI,
vrf_id, zebra_route_string(api.type),
- api.instance, inet_ntop(AF_INET6, &p.prefix,
- buf[0], sizeof(buf[0])),
- p.prefixlen, inet_ntop(AF_INET6, &nexthop,
- buf[1], sizeof(buf[1])),
+ api.instance,
+ inet_ntop(AF_INET6, &p.prefix, buf[0],
+ sizeof(buf[0])),
+ p.prefixlen,
+ inet_ntop(AF_INET6, &nexthop, buf[1],
+ sizeof(buf[1])),
api.metric, api.tag);
}
bgp_redistribute_delete(bgp, (struct prefix *)&p, api.type,
"Tx IPv4 route %s VRF %u %s/%d metric %u tag %" ROUTE_TAG_PRI
" count %d",
(valid_nh_count ? "add" : "delete"),
- bgp->vrf_id, inet_ntop(AF_INET, &p->u.prefix4,
- buf[0], sizeof(buf[0])),
+ bgp->vrf_id,
+ inet_ntop(AF_INET, &p->u.prefix4, buf[0],
+ sizeof(buf[0])),
p->prefixlen, api.metric, api.tag,
api.nexthop_num);
for (i = 0; i < api.nexthop_num; i++) {
}
/* Track if addpath TX is in use */
- if (flag & (PEER_FLAG_ADDPATH_TX_ALL_PATHS
- | PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS)) {
+ if (flag
+ & (PEER_FLAG_ADDPATH_TX_ALL_PATHS
+ | PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS)) {
bgp = peer->bgp;
addpath_tx_used = 0;
} else {
if (!peer_af_flag_check(peer, afi, safi,
PEER_FLAG_SEND_COMMUNITY)
- && (!g_peer || peer_af_flag_check(g_peer, afi, safi,
- PEER_FLAG_SEND_COMMUNITY))
+ && (!g_peer
+ || peer_af_flag_check(g_peer, afi, safi,
+ PEER_FLAG_SEND_COMMUNITY))
&& !peer_af_flag_check(peer, afi, safi,
PEER_FLAG_SEND_EXT_COMMUNITY)
&& (!g_peer
PEER_FLAG_SEND_EXT_COMMUNITY))
&& !peer_af_flag_check(peer, afi, safi,
PEER_FLAG_SEND_LARGE_COMMUNITY)
- && (!g_peer || peer_af_flag_check(
- g_peer, afi, safi,
- PEER_FLAG_SEND_LARGE_COMMUNITY))) {
+ && (!g_peer
+ || peer_af_flag_check(
+ g_peer, afi, safi,
+ PEER_FLAG_SEND_LARGE_COMMUNITY))) {
afi_header_vty_out(
vty, afi, safi, write,
" no neighbor %s send-community all\n", addr);
if (!peer_af_flag_check(peer, afi, safi,
PEER_FLAG_SEND_COMMUNITY)
- && (!g_peer || peer_af_flag_check(
- g_peer, afi, safi,
- PEER_FLAG_SEND_COMMUNITY))) {
+ && (!g_peer
+ || peer_af_flag_check(
+ g_peer, afi, safi,
+ PEER_FLAG_SEND_COMMUNITY))) {
afi_header_vty_out(
vty, afi, safi, write,
" no neighbor %s send-community\n",
/* $FRR indent$ */
/* clang-format off */
#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 */
- u_char maxmed_active; /* 1/0 if max-med is active or not */
- u_int32_t maxmed_value; /* Max-med value when its active */
+ u_char maxmed_active; /* 1/0 if max-med is active or not */
+ u_int32_t maxmed_value; /* Max-med value when its active */
/* BGP update delay on startup */
struct thread *t_update_delay;
} else {
rspint = strtoul(argv[1]->arg, NULL, 10);
if (rspint > INT32_MAX)
- rspint =
- INT32_MAX; /* is really an int, not an unsigned
- int */
+ rspint = INT32_MAX; /* is really an int, not an unsigned
+ int */
}
bgp->rfapi_cfg->default_response_lifetime = rspint;
}
if (argv[2]->arg[0] == 'b') {
- if (((argc > 5) && strmatch(argv[5]->text,
- rfg->plist_export_bgp_name[afi]))
+ if (((argc > 5)
+ && strmatch(argv[5]->text,
+ rfg->plist_export_bgp_name[afi]))
|| (argc <= 5)) {
if (rfg->plist_export_bgp_name[afi])
vnc_direct_bgp_reexport_group_afi(bgp, rfg, afi);
}
} else {
- if (((argc > 5) && strmatch(argv[5]->text,
- rfg->plist_export_zebra_name[afi]))
+ if (((argc > 5)
+ && strmatch(argv[5]->text,
+ rfg->plist_export_zebra_name[afi]))
|| (argc <= 5)) {
if (rfg->plist_export_zebra_name[afi])
free(rfg->plist_export_zebra_name[afi]);
vnc_direct_bgp_reexport_group_afi(bgp, rfg, AFI_IP6);
}
} else {
- if (((argc > 4) && strmatch(argv[4]->text,
- rfg->routemap_export_zebra_name))
+ if (((argc > 4)
+ && strmatch(argv[4]->text,
+ rfg->routemap_export_zebra_name))
|| (argc <= 4)) {
if (rfg->routemap_export_zebra_name)
free(rfg->routemap_export_zebra_name);
*/
for (ALL_LIST_ELEMENTS_RO(bgp->rfapi_cfg->rfg_export_direct_bgp_l, node,
rfgn)) {
- if (rfg_name == NULL || (type == RFAPI_GROUP_CFG_NVE
- && !strcmp(rfgn->name, rfg_name))) {
+ if (rfg_name == NULL
+ || (type == RFAPI_GROUP_CFG_NVE
+ && !strcmp(rfgn->name, rfg_name))) {
rfgn->rfg = NULL;
/* remove exported routes from this group */
vnc_direct_bgp_del_group(bgp, rfg);
for (ALL_LIST_ELEMENTS_RO(bgp->rfapi_cfg->rfg_export_zebra_l, node,
rfgn)) {
- if (rfg_name == NULL || (type == RFAPI_GROUP_CFG_NVE
- && !strcmp(rfgn->name, rfg_name))) {
+ if (rfg_name == NULL
+ || (type == RFAPI_GROUP_CFG_NVE
+ && !strcmp(rfgn->name, rfg_name))) {
rfgn->rfg = NULL;
/* remove exported routes from this group */
vnc_zebra_del_group(bgp, rfg);
ZEBRA_ROUTE_BGP, BGP_ROUTE_RFP, NULL,
action == RFAPI_REGISTER_KILL);
- if (0 == rfapiApDelete(bgp, rfd, &p, pfx_mac, &prd,
- &adv_tunnel)) {
+ if (0
+ == rfapiApDelete(bgp, rfd, &p, pfx_mac, &prd,
+ &adv_tunnel)) {
if (adv_tunnel)
rfapiTunnelRouteAnnounce(
bgp, rfd, &rfd->max_prefix_lifetime);
/*
-*
-* Copyright 2009-2016, LabN Consulting, L.L.C.
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License
-* as published by the Free Software Foundation; either version 2
-* of the License, or (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License along
-* with this program; see the file COPYING; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
+ *
+ * Copyright 2009-2016, LabN Consulting, L.L.C.
+ *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; see the file COPYING; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
/*
* File: rfapi_import.c
} else if (encode == ECOMMUNITY_ENCODE_AS) {
as = (*p++ << 8);
as |= (*p++);
- p +=
- 2; /* skip next two, tag/vid
- always in lowest bytes */
+ p += 2; /* skip next two, tag/vid
+ always in lowest bytes */
}
if (as == bgp->as) {
*tag_id = *p++ << 8;
for (prev = NULL, next = rn->info; next;
prev = next, next = next->next) {
- if (!bgp || (!CHECK_FLAG(info_new->flags, BGP_INFO_REMOVED)
- && CHECK_FLAG(next->flags, BGP_INFO_REMOVED))
+ if (!bgp
+ || (!CHECK_FLAG(info_new->flags, BGP_INFO_REMOVED)
+ && CHECK_FLAG(next->flags, BGP_INFO_REMOVED))
|| bgp_info_cmp_compatible(bgp, info_new, next, pfx_buf,
afi, safi)
== -1) { /* -1 if 1st is better */
vnc_zlog_debug_verbose(
"%s: withdrawing at prefix %s/%d%s",
- __func__, rfapi_ntop(rn->p.family,
- &rn->p.u.prefix,
- buf, BUFSIZ),
+ __func__,
+ rfapi_ntop(rn->p.family,
+ &rn->p.u.prefix, buf,
+ BUFSIZ),
rn->p.prefixlen,
(washolddown
? " (already being withdrawn)"
p, /* aux_prefix: IP */
AFI_L2VPN, prd, attr, type, 0,
NULL); /* sub_type & label unused for withdraw
- */
+ */
}
}
void *cursor;
int rc;
- for (cursor = NULL,
- rc = skiplist_next(h->import_mac, NULL, (void **)&it,
- &cursor);
+ for (cursor = NULL, rc = skiplist_next(h->import_mac, NULL,
+ (void **)&it, &cursor);
!rc; rc = skiplist_next(h->import_mac, NULL, (void **)&it,
&cursor)) {
void *cursor = NULL;
int rc;
- for (cursor = NULL,
- rc = skiplist_next(h->import_mac, NULL, (void **)&it,
- &cursor);
+ for (cursor = NULL, rc = skiplist_next(h->import_mac, NULL,
+ (void **)&it, &cursor);
!rc; rc = skiplist_next(h->import_mac, NULL, (void **)&it,
&cursor)) {
int rc;
if (h->import_mac) {
- for (cursor = NULL,
- rc = skiplist_next(h->import_mac, NULL, (void **)&it,
- &cursor);
+ for (cursor = NULL, rc = skiplist_next(h->import_mac, NULL,
+ (void **)&it, &cursor);
!rc; rc = skiplist_next(h->import_mac, NULL, (void **)&it,
&cursor)) {
{
char buf[BUFSIZ];
- vnc_zlog_debug_verbose(
- "%s: LNI=%d: rfd=%p, pfx=%s", __func__, logical_net_id,
- rfd, rfapi_ntop(pfx_mac_buf.family, pfx_mac_buf.u.val,
- buf, BUFSIZ));
+ vnc_zlog_debug_verbose("%s: LNI=%d: rfd=%p, pfx=%s", __func__,
+ logical_net_id, rfd,
+ rfapi_ntop(pfx_mac_buf.family,
+ pfx_mac_buf.u.val, buf,
+ BUFSIZ));
}
struct rfapi_info *ri;
- while (0 == skiplist_first(
- (struct skiplist *)
- rn->info,
- NULL,
- (void **)&ri)) {
+ while (0
+ == skiplist_first(
+ (struct skiplist *)
+ rn->info,
+ NULL, (void **)&ri)) {
rfapi_info_free(ri);
skiplist_delete_first(
#else
"Remaining"
#endif
- );
+ );
}
if (!printednve) {
char str_vn[BUFSIZ];
bgp_info_unlock(info);
route_unlock_node(
rn); /* sl entry
- */
+ */
}
if (skiplist_empty(
RFAPI_MONITOR_EXTERIOR(
__func__, zebra_route_string(api.type),
inet_ntop(AF_INET, &p.prefix, buf[0],
sizeof(buf[0])),
- p.prefixlen, inet_ntop(AF_INET, &nexthop,
- buf[1], sizeof(buf[1])),
+ p.prefixlen,
+ inet_ntop(AF_INET, &nexthop, buf[1],
+ sizeof(buf[1])),
api.metric);
}
vnc_redistribute_add((struct prefix *)&p, &nexthop, api.metric,
__func__, zebra_route_string(api.type),
inet_ntop(AF_INET, &p.prefix, buf[0],
sizeof(buf[0])),
- p.prefixlen, inet_ntop(AF_INET, &nexthop,
- buf[1], sizeof(buf[1])),
+ p.prefixlen,
+ inet_ntop(AF_INET, &nexthop, buf[1],
+ sizeof(buf[1])),
api.metric);
}
vnc_redistribute_delete((struct prefix *)&p, api.type);
if (prefix_match(CONNECTED_PREFIX(ei->connected),
(struct prefix *)&addr)) {
- if ((match == NULL) || (match->address->prefixlen
- < ei->address->prefixlen))
+ if ((match == NULL)
+ || (match->address->prefixlen
+ < ei->address->prefixlen))
match = ei;
}
}
/* eigprd privileges */
zebra_capabilities_t _caps_p[] = {
- ZCAP_NET_RAW, ZCAP_BIND, ZCAP_NET_ADMIN,
+ ZCAP_NET_RAW,
+ ZCAP_BIND,
+ ZCAP_NET_ADMIN,
};
struct zebra_privs_t eigrpd_privs = {
MD5Update(&ctx, zeropad, 16 - strlen(key->string));
if (backup_end > (EIGRP_HEADER_LEN + EIGRP_AUTH_MD5_TLV_SIZE)) {
MD5Update(&ctx,
- ibuf + (EIGRP_HEADER_LEN
- + EIGRP_AUTH_MD5_TLV_SIZE),
+ ibuf
+ + (EIGRP_HEADER_LEN
+ + EIGRP_AUTH_MD5_TLV_SIZE),
backup_end - 20
- (EIGRP_HEADER_LEN
+ EIGRP_AUTH_MD5_TLV_SIZE));
MD5Update(&ctx, zeropad, 16 - strlen(key->string));
if (backup_end > (EIGRP_HEADER_LEN + EIGRP_AUTH_MD5_TLV_SIZE)) {
MD5Update(&ctx,
- ibuf + (EIGRP_HEADER_LEN
- + EIGRP_AUTH_MD5_TLV_SIZE),
+ ibuf
+ + (EIGRP_HEADER_LEN
+ + EIGRP_AUTH_MD5_TLV_SIZE),
backup_end - 20
- (EIGRP_HEADER_LEN
+ EIGRP_AUTH_MD5_TLV_SIZE));
struct listnode *node;
#ifdef WANT_EIGRP_WRITE_FRAGMENT
static u_int16_t ipid = 0;
-#endif /* WANT_EIGRP_WRITE_FRAGMENT */
- /* $FRR indent$ */
-/* clang-format off */
+#endif /* WANT_EIGRP_WRITE_FRAGMENT */
+ /* $FRR indent$ */
+ /* clang-format off */
#define EIGRP_WRITE_IPHL_SHIFT 2
eigrp->t_write = NULL;
/* Set metric rule structure. */
static struct route_map_rule_cmd route_set_metric_cmd = {
- "metric", route_set_metric, route_set_metric_compile,
+ "metric",
+ route_set_metric,
+ route_set_metric_compile,
route_set_metric_free,
};
}
ALIAS(no_match_metric, no_match_metric_val_cmd,
- "no match metric <0-4294967295>", NO_STR MATCH_STR
+ "no match metric <0-4294967295>",
+ NO_STR MATCH_STR
"Match metric of route\n"
"Metric value\n")
}
ALIAS(no_match_ip_next_hop, no_match_ip_next_hop_val_cmd,
- "no match ip next-hop (<1-199>|<1300-2699>|WORD)", NO_STR MATCH_STR IP_STR
+ "no match ip next-hop (<1-199>|<1300-2699>|WORD)",
+ NO_STR MATCH_STR IP_STR
"Match next-hop address of route\n"
"IP access-list number\n"
"IP access-list number (expanded range)\n"
ALIAS(no_match_ip_next_hop_prefix_list,
no_match_ip_next_hop_prefix_list_val_cmd,
- "no match ip next-hop prefix-list WORD", NO_STR MATCH_STR IP_STR
+ "no match ip next-hop prefix-list WORD",
+ NO_STR MATCH_STR IP_STR
"Match next-hop address of route\n"
"Match entries of prefix-lists\n"
"IP prefix-list name\n")
}
ALIAS(no_match_ip_address, no_match_ip_address_val_cmd,
- "no match ip address (<1-199>|<1300-2699>|WORD)", NO_STR MATCH_STR IP_STR
+ "no match ip address (<1-199>|<1300-2699>|WORD)",
+ NO_STR MATCH_STR IP_STR
"Match address of route\n"
"IP access-list number\n"
"IP access-list number (expanded range)\n"
}
ALIAS(no_match_ip_address_prefix_list, no_match_ip_address_prefix_list_val_cmd,
- "no match ip address prefix-list WORD", NO_STR MATCH_STR IP_STR
+ "no match ip address prefix-list WORD",
+ NO_STR MATCH_STR IP_STR
"Match address of route\n"
"Match entries of prefix-lists\n"
"IP prefix-list name\n")
return eigrp_route_set_add(vty, vty->index, "metric", argv[0]);
}
-ALIAS(set_metric, set_metric_addsub_cmd, "set metric <+/-metric>", SET_STR
+ALIAS(set_metric, set_metric_addsub_cmd, "set metric <+/-metric>",
+ SET_STR
"Metric value for destination routing protocol\n"
"Add or subtract metric\n")
}
ALIAS(no_set_metric, no_set_metric_val_cmd,
- "no set metric (<0-4294967295>|<+/-metric>)", NO_STR SET_STR
+ "no set metric (<0-4294967295>|<+/-metric>)",
+ NO_STR SET_STR
"Metric value for destination routing protocol\n"
"Metric value\n"
"Add or subtract metric\n")
}
ALIAS(no_set_ip_nexthop, no_set_ip_nexthop_val_cmd,
- "no set ip next-hop A.B.C.D", NO_STR SET_STR IP_STR
+ "no set ip next-hop A.B.C.D",
+ NO_STR SET_STR IP_STR
"Next hop address\n"
"IP address of next hop\n")
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>", NO_STR SET_STR
+ALIAS(no_set_tag, no_set_tag_val_cmd, "no set tag <0-65535>",
+ NO_STR SET_STR
"Tag value for routing protocol\n"
"Tag value\n")
uint64_t serno; /* Global serial number counter for topology entry
changes*/
- uint64_t
- serno_last_update; /* Highest serial number of information send
- by last update*/
+ uint64_t serno_last_update; /* Highest serial number of information send
+ by last update*/
struct list *topology_changes_internalIPV4;
struct list *topology_changes_externalIPV4;
/**
* @fn eigrp_update_send_GR_part
*
- * @param[in] nbr contains neighbor who would receive Graceful
- * restart
+ * @param[in] nbr contains neighbor who would receive
+ * Graceful restart
*
* @return void
*
/**
* @fn eigrp_update_send_GR
*
- * @param[in] nbr Neighbor who would receive Graceful
- * restart
+ * @param[in] nbr Neighbor who would receive
+ * Graceful restart
* @param[in] gr_type Who executed Graceful restart
* @param[in] vty Virtual terminal for log output
*
/**
* @fn eigrp_update_send_interface_GR
*
- * @param[in] ei Interface to neighbors of which the GR
- * is sent
+ * @param[in] ei Interface to neighbors of which the
+ * GR is sent
* @param[in] gr_type Who executed Graceful restart
* @param[in] vty Virtual terminal for log output
*
root = root->right;
else {
if (!dict->dupes) { /* no duplicates, return match
- */
+ */
return root;
} else { /* could be dupes, find leftmost one */
do {
adj->dis_record[ISIS_LEVELS + level - 1]
.dis),
adj->dischanges[level - 1],
- time2string(now - (adj->dis_record[ISIS_LEVELS
- + level - 1]
- .last_dis_change)));
+ time2string(now
+ - (adj->dis_record[ISIS_LEVELS
+ + level - 1]
+ .last_dis_change)));
}
vty_out(vty, "\n");
passwd);
}
struct cmd_node interface_node = {
- INTERFACE_NODE, "%s(config-if)# ", 1,
+ INTERFACE_NODE,
+ "%s(config-if)# ",
+ 1,
};
int isis_circuit_circ_type_set(struct isis_circuit *circuit, int circ_type)
if (mtid == ISIS_MT_IPV4_UNICAST) {
if ((ipv6_reach->control_info & CTRL_INFO_DISTRIBUTION)
== DISTRIBUTION_INTERNAL)
- vty_out(vty, " Metric : %-8" PRIu32
- " IPv6-Internal : %s/%d\n",
+ vty_out(vty,
+ " Metric : %-8" PRIu32
+ " IPv6-Internal : %s/%d\n",
ntohl(ipv6_reach->metric), buff,
ipv6_reach->prefix_len);
else
- vty_out(vty, " Metric : %-8" PRIu32
- " IPv6-External : %s/%d\n",
+ vty_out(vty,
+ " Metric : %-8" PRIu32
+ " IPv6-External : %s/%d\n",
ntohl(ipv6_reach->metric), buff,
ipv6_reach->prefix_len);
} else {
if ((ipv6_reach->control_info & CTRL_INFO_DISTRIBUTION)
== DISTRIBUTION_INTERNAL)
- vty_out(vty, " Metric : %-8" PRIu32
- " IPv6-MT-Int : %s/%d %s\n",
+ vty_out(vty,
+ " Metric : %-8" PRIu32
+ " IPv6-MT-Int : %s/%d %s\n",
ntohl(ipv6_reach->metric), buff,
ipv6_reach->prefix_len,
isis_mtid2str(mtid));
else
- vty_out(vty, " Metric : %-8" PRIu32
- " IPv6-MT-Ext : %s/%d %s\n",
+ vty_out(vty,
+ " Metric : %-8" PRIu32
+ " IPv6-MT-Ext : %s/%d %s\n",
ntohl(ipv6_reach->metric), buff,
ipv6_reach->prefix_len,
isis_mtid2str(mtid));
if (mtid == ISIS_MT_IPV4_UNICAST) {
/* FIXME: There should be better way to output this
* stuff. */
- vty_out(vty, " Metric : %-8" PRIu32
- " IPv4-Extended : %s/%d\n",
+ vty_out(vty,
+ " Metric : %-8" PRIu32
+ " IPv4-Extended : %s/%d\n",
ntohl(te_ipv4_reach->te_metric),
inet_ntoa(newprefix2inaddr(
&te_ipv4_reach->prefix_start,
} else {
/* FIXME: There should be better way to output this
* stuff. */
- vty_out(vty, " Metric : %-8" PRIu32
- " IPv4-MT : %s/%d %s\n",
+ vty_out(vty,
+ " Metric : %-8" PRIu32
+ " IPv4-MT : %s/%d %s\n",
ntohl(te_ipv4_reach->te_metric),
inet_ntoa(newprefix2inaddr(
&te_ipv4_reach->prefix_start,
for (ALL_LIST_ELEMENTS_RO(lsp->tlv_data.is_neighs, lnode,
is_neigh)) {
lspid_print(is_neigh->neigh_id, LSPid, dynhost, 0);
- vty_out(vty, " Metric : %-8" PRIu8
- " IS : %s\n",
+ vty_out(vty,
+ " Metric : %-8" PRIu8
+ " IS : %s\n",
is_neigh->metrics.metric_default, LSPid);
}
sizeof(ipv4_reach_prefix));
memcpy(ipv4_reach_mask, inet_ntoa(ipv4_reach->mask),
sizeof(ipv4_reach_mask));
- vty_out(vty, " Metric : %-8" PRIu8
- " IPv4-Internal : %s %s\n",
+ vty_out(vty,
+ " Metric : %-8" PRIu8
+ " IPv4-Internal : %s %s\n",
ipv4_reach->metrics.metric_default,
ipv4_reach_prefix, ipv4_reach_mask);
}
sizeof(ipv4_reach_prefix));
memcpy(ipv4_reach_mask, inet_ntoa(ipv4_reach->mask),
sizeof(ipv4_reach_mask));
- vty_out(vty, " Metric : %-8" PRIu8
- " IPv4-External : %s %s\n",
+ vty_out(vty,
+ " Metric : %-8" PRIu8
+ " IPv4-External : %s %s\n",
ipv4_reach->metrics.metric_default,
ipv4_reach_prefix, ipv4_reach_mask);
}
THREAD_TIMER_OFF(circuit->u.bc.t_refresh_pseudo_lsp[lvl - 1]);
diff = now - lsp->last_generated;
if (diff < circuit->area->lsp_gen_interval[lvl - 1]) {
- timeout =
- 1000 * (circuit->area->lsp_gen_interval[lvl - 1]
- - diff);
+ timeout = 1000
+ * (circuit->area->lsp_gen_interval[lvl - 1]
+ - diff);
sched_debug(
"ISIS (%s): Sechduling in %ld ms to match configured lsp_gen_interval",
area->area_tag, timeout);
lsp->level = level;
lsp->pdu = stream_new(LLC_LEN + area->lsp_mtu);
lsp->isis_header = (struct isis_fixed_hdr *)STREAM_DATA(lsp->pdu);
- fill_fixed_hdr(lsp->isis_header,
- (lsp->level == IS_LEVEL_1) ? L1_LINK_STATE
- : L2_LINK_STATE);
+ fill_fixed_hdr(lsp->isis_header, (lsp->level == IS_LEVEL_1)
+ ? L1_LINK_STATE
+ : L2_LINK_STATE);
lsp->lsp_header = (struct isis_link_state_hdr *)(STREAM_DATA(lsp->pdu)
+ ISIS_FIXED_HDR_LEN);
memcpy(lsp->lsp_header, lsp_hdr, ISIS_LSP_HDR_LEN);
lsp_set_all_srmflags(lsp);
/* v */
ISIS_FLAGS_CLEAR_ALL(
- lsp
- ->SSNflags); /* FIXME:
- OTHER
- than c
- */
+ lsp->SSNflags); /* FIXME:
+ OTHER
+ than c
+ */
/* For the case of lsp confusion, flood
* the purge back to its
extern struct zebra_privs_t isisd_privs;
/* tcpdump -i eth0 'isis' -dd */
-static struct sock_filter isisfilter[] =
- {
- /* NB: we're in SOCK_DGRAM, so src/dst mac + length are stripped
- * off!
- * (OTOH it's a bit more lower-layer agnostic and might work
- * over GRE?) */
- /* { 0x28, 0, 0, 0x0000000c - 14 }, */
- /* { 0x25, 5, 0, 0x000005dc }, */
- {0x28, 0, 0, 0x0000000e - 14}, {0x15, 0, 3, 0x0000fefe},
- {0x30, 0, 0, 0x00000011 - 14}, {0x15, 0, 1, 0x00000083},
- {0x6, 0, 0, 0x00040000}, {0x6, 0, 0, 0x00000000},
+static struct sock_filter isisfilter[] = {
+ /* NB: we're in SOCK_DGRAM, so src/dst mac + length are stripped
+ * off!
+ * (OTOH it's a bit more lower-layer agnostic and might work
+ * over GRE?) */
+ /* { 0x28, 0, 0, 0x0000000c - 14 }, */
+ /* { 0x25, 5, 0, 0x000005dc }, */
+ {0x28, 0, 0, 0x0000000e - 14}, {0x15, 0, 3, 0x0000fefe},
+ {0x30, 0, 0, 0x00000011 - 14}, {0x15, 0, 1, 0x00000083},
+ {0x6, 0, 0, 0x00040000}, {0x6, 0, 0, 0x00000000},
};
static struct sock_fprog bpf = {
for (protocol = 0; protocol < REDIST_PROTOCOL_COUNT; protocol++)
for (type = 0; type < ZEBRA_ROUTE_MAX + 1; type++)
for (level = 0; level < ISIS_LEVELS; level++)
- if (area->redist_settings[protocol]
- [type]
- [level].redist)
+ if (area->redist_settings
+ [protocol][type][level]
+ .redist)
do_subscribe[protocol][type] =
1;
zlog_warn("ISIS-Spf: could not find own l%d LSP!",
spftree->level);
- vertex = isis_vertex_new(id,
- spftree->area->oldmetric
- ? VTYPE_NONPSEUDO_IS
- : VTYPE_NONPSEUDO_TE_IS);
+ vertex = isis_vertex_new(id, spftree->area->oldmetric
+ ? VTYPE_NONPSEUDO_IS
+ : VTYPE_NONPSEUDO_TE_IS);
listnode_add(spftree->paths, vertex);
#ifdef EXTREME_DEBUG
/* d) */
if (listcount(vertex->Adj_N) > ISIS_MAX_PATH_SPLITS)
remove_excess_adjs(vertex->Adj_N);
- if (parent && (listnode_lookup(vertex->parents, parent)
- == NULL))
+ if (parent
+ && (listnode_lookup(vertex->parents, parent)
+ == NULL))
listnode_add(vertex->parents, parent);
- if (parent && (listnode_lookup(parent->children, vertex)
- == NULL))
+ if (parent
+ && (listnode_lookup(parent->children, vertex)
+ == NULL))
listnode_add(parent->children, vertex);
return;
} else if (vertex->d_N < cost) {
mt_router_info = tlvs_lookup_mt_router_info(&lsp->tlv_data,
spftree->mtid);
- if (!pseudo_lsp && (spftree->mtid == ISIS_MT_IPV4_UNICAST
- && !speaks(lsp->tlv_data.nlpids, spftree->family))
+ if (!pseudo_lsp
+ && (spftree->mtid == ISIS_MT_IPV4_UNICAST
+ && !speaks(lsp->tlv_data.nlpids, spftree->family))
&& !mt_router_info)
return ISIS_OK;
#endif /* EXTREME_DEBUG */
/* RFC3787 section 4 SHOULD ignore overload bit in pseudo LSPs */
- if (pseudo_lsp || (spftree->mtid == ISIS_MT_IPV4_UNICAST
- && !ISIS_MASK_LSP_OL_BIT(lsp->lsp_header->lsp_bits))
+ if (pseudo_lsp
+ || (spftree->mtid == ISIS_MT_IPV4_UNICAST
+ && !ISIS_MASK_LSP_OL_BIT(lsp->lsp_header->lsp_bits))
|| (mt_router_info && !mt_router_info->overload))
{
u_int32_t te_metric;
u_char control;
u_char prefix_start; /* since this is variable length by nature it only
- */
+ */
}; /* points to an approximate location */
#define TE_IPV4_HAS_SUBTLV (0x40)
struct isis_spftree *spftree6[ISIS_LEVELS]; /* The v6 SPTs */
struct route_table *route_table6[ISIS_LEVELS]; /* IPv6 routes */
/* $FRR indent$ */
-/* clang-format off */
+ /* clang-format off */
#define DEFAULT_LSP_MTU 1497
unsigned int lsp_mtu; /* Size of LSPs to generate */
struct list *circuit_list; /* IS-IS circuits */
#include "checksum.h"
int /* return checksum in low-order 16 bits */
- in_cksum(void *parg, int nbytes)
+in_cksum(void *parg, int nbytes)
{
u_short *ptr = parg;
register long sum; /* assumes long == 32 bits */
/* Standard command node structures. */
static struct cmd_node auth_node = {
- AUTH_NODE, "Password: ",
+ AUTH_NODE,
+ "Password: ",
};
static struct cmd_node view_node = {
- VIEW_NODE, "%s> ",
+ VIEW_NODE,
+ "%s> ",
};
static struct cmd_node auth_enable_node = {
- AUTH_ENABLE_NODE, "Password: ",
+ AUTH_ENABLE_NODE,
+ "Password: ",
};
static struct cmd_node enable_node = {
- ENABLE_NODE, "%s# ",
+ ENABLE_NODE,
+ "%s# ",
};
static struct cmd_node config_node = {CONFIG_NODE, "%s(config)# ", 1};
for (ALL_LIST_ELEMENTS_RO(varhandlers, ln, cvh)) {
if (cvh->tokenname && strcmp(cvh->tokenname, token->text))
continue;
- if (cvh->varname && (!token->varname
- || strcmp(cvh->varname, token->varname)))
+ if (cvh->varname
+ && (!token->varname
+ || strcmp(cvh->varname, token->varname)))
continue;
cvh->completions(tmpcomps, token);
break;
struct stat conf_stat;
// if command was 'write terminal' or 'show running-config'
- if (argc == 2 && (strmatch(argv[idx_type]->text, "terminal")
- || strmatch(argv[0]->text, "show"))) {
+ if (argc == 2
+ && (strmatch(argv[idx_type]->text, "terminal")
+ || strmatch(argv[0]->text, "show"))) {
vty_write_config(vty);
return CMD_SUCCESS;
}
/* plumbing types */
item(FORK_TKN) item(JOIN_TKN) item(START_TKN)
item(END_TKN) default
- : wrap->type = "???";
+ : wrap->type = "???";
}
wrap->deprecated = (tok->attr == CMD_ATTR_DEPRECATED);
if (longopts != NULL
&& (argv[optind][1] == '-'
- || (long_only && (argv[optind][2]
- || !my_index(optstring, argv[optind][1]))))) {
+ || (long_only
+ && (argv[optind][2]
+ || !my_index(optstring, argv[optind][1]))))) {
char *nameend;
const struct option *p;
const struct option *pfound = NULL;
*/
#define DEFINE_HOOK(hookname, arglist, passlist) \
struct hook _hook_##hookname = { \
- .name = #hookname, .entries = NULL, \
+ .name = #hookname, \
+ .entries = NULL, \
}; \
static int hook_call_##hookname arglist \
{ \
unsigned int mtu; /* IPv4 MTU */
unsigned int
mtu6; /* IPv6 MTU - probably, but not neccessarily same as mtu
- */
+ */
/* Link-layer information and hardware address */
enum zebra_link_type ll_type;
,
siginfo_t *siginfo, void *program_counter
#endif
- )
+)
{
time_t now;
char buf[sizeof("DEFAULT: Received signal S at T (si_addr 0xP, PC 0xP); aborting...")
#else
NULL
#endif
- );
+ );
s = buf;
struct thread *tc;
printing */
s += sprintf(s, " ");
- else if (
- isprint((int)((const char *)mem)
- [j])) /* printable char
- */
+ else if (isprint((int)((const char *)mem)
+ [j])) /* printable char
+ */
s += sprintf(
s, "%c",
0xFF & ((const char *)mem)[j]);
,
siginfo_t *siginfo, void *program_counter
#endif
- );
+);
/* Log a backtrace. */
extern void zlog_backtrace(int priority);
int precision; /* configuration parameter */
int already_rendered; /* should be initialized to 0 */
char buf[QUAGGA_TIMESTAMP_LEN]; /* will contain the rendered timestamp
- */
+ */
};
/* Defines for use in command construction: */
{
MD5_CTX context;
unsigned char k_ipad[65]; /* inner padding -
- * key XORd with ipad
- */
+ * key XORd with ipad
+ */
unsigned char k_opad[65]; /* outer padding -
- * key XORd with opad
- */
+ * key XORd with opad
+ */
unsigned char tk[16];
int i;
/* if key is longer than 64 bytes reset it to key=MD5(key) */
#define MPLS_LABEL_RTALERT 1 /* Router Alert Label */
#define MPLS_LABEL_IPV6NULL 2 /* IPv6 Explicit NULL Label */
#define MPLS_LABEL_IMPLNULL 3 /* Implicit NULL Label */
- /* MPLS_LABEL_RESERVED 4-15 */ /* Values 4-15 are reserved */
+/* MPLS_LABEL_RESERVED 4-15 */ /* Values 4-15 are reserved */
#define MPLS_LABEL_RESERVED_MAX 15
#define MPLS_LABEL_MAX ((1 << 20) - 1)
return _cmp(l, r); \
} \
static const struct rb_type _name##_RB_INFO = { \
- _name##_RB_COMPARE, _aug, offsetof(struct _type, _field), \
+ _name##_RB_COMPARE, \
+ _aug, \
+ offsetof(struct _type, _field), \
}; \
const struct rb_type *const _name##_RB_TYPE = &_name##_RB_INFO;
json_object_object_add(json, "ipv6PrefixList",
json_prefix);
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
} else {
vty_out(vty, "ip%s prefix-list %s: %d entries\n",
switch (p->family) {
case AF_INET:
case AF_INET6:
- snprintf(str, size, "%s/%d", inet_ntop(p->family, &p->u.prefix,
- buf, PREFIX2STR_BUFFER),
+ snprintf(str, size, "%s/%d",
+ inet_ntop(p->family, &p->u.prefix, buf,
+ PREFIX2STR_BUFFER),
p->prefixlen);
break;
/* length is the number of valuable bits of prefix structure
-* 18 bytes is current length in structure, if address is ipv4
-* 30 bytes is in case of ipv6
-*/
+ * 18 bytes is current length in structure, if address is ipv4
+ * 30 bytes is in case of ipv6
+ */
#define PREFIX_LEN_ROUTE_TYPE_5_IPV4 (18*8)
#define PREFIX_LEN_ROUTE_TYPE_5_IPV6 (30*8)
pvalue_t *system_caps;
} cap_map[ZCAP_MAX] = {
#ifdef HAVE_LCAPS /* Quagga -> Linux capabilities mappings */
- [ZCAP_SETID] =
- {
- 2, (pvalue_t[]){CAP_SETGID, CAP_SETUID},
- },
- [ZCAP_BIND] =
- {
- 1, (pvalue_t[]){CAP_NET_BIND_SERVICE},
- },
- [ZCAP_NET_ADMIN] =
- {
- 1, (pvalue_t[]){CAP_NET_ADMIN},
- },
- [ZCAP_NET_RAW] =
- {
- 1, (pvalue_t[]){CAP_NET_RAW},
- },
- [ZCAP_CHROOT] =
- {
- 1,
- (pvalue_t[]){
- CAP_SYS_CHROOT,
- },
- },
- [ZCAP_NICE] =
- {
- 1, (pvalue_t[]){CAP_SYS_NICE},
- },
- [ZCAP_PTRACE] =
- {
- 1, (pvalue_t[]){CAP_SYS_PTRACE},
- },
- [ZCAP_DAC_OVERRIDE] =
- {
- 1, (pvalue_t[]){CAP_DAC_OVERRIDE},
- },
- [ZCAP_READ_SEARCH] =
- {
- 1, (pvalue_t[]){CAP_DAC_READ_SEARCH},
- },
- [ZCAP_SYS_ADMIN] =
- {
- 1, (pvalue_t[]){CAP_SYS_ADMIN},
- },
- [ZCAP_FOWNER] =
- {
- 1, (pvalue_t[]){CAP_FOWNER},
+ [ZCAP_SETID] =
+ {
+ 2,
+ (pvalue_t[]){CAP_SETGID, CAP_SETUID},
+ },
+ [ZCAP_BIND] =
+ {
+ 1,
+ (pvalue_t[]){CAP_NET_BIND_SERVICE},
+ },
+ [ZCAP_NET_ADMIN] =
+ {
+ 1,
+ (pvalue_t[]){CAP_NET_ADMIN},
+ },
+ [ZCAP_NET_RAW] =
+ {
+ 1,
+ (pvalue_t[]){CAP_NET_RAW},
+ },
+ [ZCAP_CHROOT] =
+ {
+ 1,
+ (pvalue_t[]){
+ CAP_SYS_CHROOT,
},
+ },
+ [ZCAP_NICE] =
+ {
+ 1,
+ (pvalue_t[]){CAP_SYS_NICE},
+ },
+ [ZCAP_PTRACE] =
+ {
+ 1,
+ (pvalue_t[]){CAP_SYS_PTRACE},
+ },
+ [ZCAP_DAC_OVERRIDE] =
+ {
+ 1,
+ (pvalue_t[]){CAP_DAC_OVERRIDE},
+ },
+ [ZCAP_READ_SEARCH] =
+ {
+ 1,
+ (pvalue_t[]){CAP_DAC_READ_SEARCH},
+ },
+ [ZCAP_SYS_ADMIN] =
+ {
+ 1,
+ (pvalue_t[]){CAP_SYS_ADMIN},
+ },
+ [ZCAP_FOWNER] =
+ {
+ 1,
+ (pvalue_t[]){CAP_FOWNER},
+ },
#elif defined(HAVE_SOLARIS_CAPABILITIES) /* HAVE_LCAPS */
- /* Quagga -> Solaris privilege mappings */
- [ZCAP_SETID] =
- {
- 1, (pvalue_t[]){PRIV_PROC_SETID},
- },
- [ZCAP_BIND] =
- {
- 1, (pvalue_t[]){PRIV_NET_PRIVADDR},
- },
+ /* Quagga -> Solaris privilege mappings */
+ [ZCAP_SETID] =
+ {
+ 1,
+ (pvalue_t[]){PRIV_PROC_SETID},
+ },
+ [ZCAP_BIND] =
+ {
+ 1,
+ (pvalue_t[]){PRIV_NET_PRIVADDR},
+ },
/* IP_CONFIG is a subset of NET_CONFIG and is allowed in zones */
#ifdef PRIV_SYS_IP_CONFIG
- [ZCAP_NET_ADMIN] =
- {
- 1, (pvalue_t[]){PRIV_SYS_IP_CONFIG},
- },
+ [ZCAP_NET_ADMIN] =
+ {
+ 1,
+ (pvalue_t[]){PRIV_SYS_IP_CONFIG},
+ },
#else
- [ZCAP_NET_ADMIN] =
- {
- 1, (pvalue_t[]){PRIV_SYS_NET_CONFIG},
- },
+ [ZCAP_NET_ADMIN] =
+ {
+ 1,
+ (pvalue_t[]){PRIV_SYS_NET_CONFIG},
+ },
#endif
- [ZCAP_NET_RAW] =
- {
- 2, (pvalue_t[]){PRIV_NET_RAWACCESS,
- PRIV_NET_ICMPACCESS},
- },
- [ZCAP_CHROOT] =
- {
- 1, (pvalue_t[]){PRIV_PROC_CHROOT},
- },
- [ZCAP_NICE] =
- {
- 1, (pvalue_t[]){PRIV_PROC_PRIOCNTL},
- },
- [ZCAP_PTRACE] =
- {
- 1, (pvalue_t[]){PRIV_PROC_SESSION},
- },
- [ZCAP_DAC_OVERRIDE] =
- {
- 5, (pvalue_t[]){PRIV_FILE_DAC_EXECUTE,
- PRIV_FILE_DAC_READ,
- PRIV_FILE_DAC_SEARCH,
- PRIV_FILE_DAC_WRITE,
- PRIV_FILE_DAC_SEARCH},
- },
- [ZCAP_READ_SEARCH] =
- {
- 2, (pvalue_t[]){PRIV_FILE_DAC_SEARCH,
- PRIV_FILE_DAC_READ},
- },
- [ZCAP_SYS_ADMIN] =
- {
- 1, (pvalue_t[]){PRIV_SYS_ADMIN},
- },
- [ZCAP_FOWNER] =
- {
- 1, (pvalue_t[]){PRIV_FILE_OWNER},
- },
+ [ZCAP_NET_RAW] =
+ {
+ 2,
+ (pvalue_t[]){PRIV_NET_RAWACCESS, PRIV_NET_ICMPACCESS},
+ },
+ [ZCAP_CHROOT] =
+ {
+ 1,
+ (pvalue_t[]){PRIV_PROC_CHROOT},
+ },
+ [ZCAP_NICE] =
+ {
+ 1,
+ (pvalue_t[]){PRIV_PROC_PRIOCNTL},
+ },
+ [ZCAP_PTRACE] =
+ {
+ 1,
+ (pvalue_t[]){PRIV_PROC_SESSION},
+ },
+ [ZCAP_DAC_OVERRIDE] =
+ {
+ 5,
+ (pvalue_t[]){PRIV_FILE_DAC_EXECUTE, PRIV_FILE_DAC_READ,
+ PRIV_FILE_DAC_SEARCH, PRIV_FILE_DAC_WRITE,
+ PRIV_FILE_DAC_SEARCH},
+ },
+ [ZCAP_READ_SEARCH] =
+ {
+ 2,
+ (pvalue_t[]){PRIV_FILE_DAC_SEARCH, PRIV_FILE_DAC_READ},
+ },
+ [ZCAP_SYS_ADMIN] =
+ {
+ 1,
+ (pvalue_t[]){PRIV_SYS_ADMIN},
+ },
+ [ZCAP_FOWNER] =
+ {
+ 1,
+ (pvalue_t[]){PRIV_FILE_OWNER},
+ },
#endif /* HAVE_SOLARIS_CAPABILITIES */
};
if (zprivs->vty_group)
/* Add the vty_group to the supplementary groups so it can be chowned to
- */
+ */
{
if (zprivs_state.vtygrp == (gid_t)-1) {
fprintf(stderr,
return 1;
for (rule = index->match_list.head; rule; rule = rule->next)
- if (rule->cmd == cmd && (rulecmp(rule->rule_str, match_arg) == 0
- || match_arg == NULL)) {
+ if (rule->cmd == cmd
+ && (rulecmp(rule->rule_str, match_arg) == 0
+ || match_arg == NULL)) {
route_map_rule_delete(&index->match_list, rule);
/* Execute event hook. */
if (route_map_master.event_hook) {
return 1;
for (rule = index->set_list.head; rule; rule = rule->next)
- if ((rule->cmd == cmd) && (rulecmp(rule->rule_str, set_arg) == 0
- || set_arg == NULL)) {
+ if ((rule->cmd == cmd)
+ && (rulecmp(rule->rule_str, set_arg) == 0
+ || set_arg == NULL)) {
route_map_rule_delete(&index->set_list, rule);
/* Execute event hook. */
if (route_map_master.event_hook) {
,
siginfo_t *siginfo, void *context
#endif
- )
+)
{
zlog_signal(signo, "exiting..."
#ifdef SA_SIGINFO
,
siginfo, program_counter(context)
#endif
- );
+ );
_exit(128 + signo);
}
,
siginfo_t *siginfo, void *context
#endif
- )
+)
{
/* make sure we don't hang in here. default for SIGALRM is terminate.
* - if we're in backtrace for more than a second, abort. */
,
siginfo, program_counter(context)
#endif
- );
+ );
/* dump memory stats on core */
log_memstats_stderr("core_handler");
abort();
,
siginfo_t *info, void *context
#endif
- );
+ );
} sigmap[] = {
{core_signals, array_size(core_signals), core_handler},
{exit_signals, array_size(exit_signals), exit_handler},
ptr = asn_build_sequence(ptr, &len, (u_char)SMUX_GETRSP, 0);
h1e = ptr;
- ptr = asn_build_int(ptr, &len, (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE
- | ASN_INTEGER),
- &reqid, sizeof(reqid));
+ ptr = asn_build_int(
+ ptr, &len,
+ (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER), &reqid,
+ sizeof(reqid));
if (debug_smux)
zlog_debug("SMUX GETRSP errstat: %ld", errstat);
- ptr = asn_build_int(ptr, &len, (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE
- | ASN_INTEGER),
- &errstat, sizeof(errstat));
+ ptr = asn_build_int(
+ ptr, &len,
+ (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER), &errstat,
+ sizeof(errstat));
if (debug_smux)
zlog_debug("SMUX GETRSP errindex: %ld", errindex);
- ptr = asn_build_int(ptr, &len, (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE
- | ASN_INTEGER),
- &errindex, sizeof(errindex));
+ ptr = asn_build_int(
+ ptr, &len,
+ (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER),
+ &errindex, sizeof(errindex));
h2 = ptr;
/* Place holder h2 for one variable */
/* SMUX Open. */
version = 0;
- ptr = asn_build_int(ptr, &len, (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE
- | ASN_INTEGER),
- &version, sizeof(version));
+ ptr = asn_build_int(
+ ptr, &len,
+ (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER), &version,
+ sizeof(version));
/* SMUX connection oid. */
- ptr = asn_build_objid(ptr, &len, (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE
- | ASN_OBJECT_ID),
- smux_oid, smux_oid_len);
+ ptr = asn_build_objid(
+ ptr, &len,
+ (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OBJECT_ID),
+ smux_oid, smux_oid_len);
/* SMUX connection description. */
- ptr = asn_build_string(ptr, &len, (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE
- | ASN_OCTET_STR),
- (const u_char *)progname, strlen(progname));
+ ptr = asn_build_string(
+ ptr, &len,
+ (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR),
+ (const u_char *)progname, strlen(progname));
/* SMUX connection password. */
- ptr = asn_build_string(ptr, &len, (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE
- | ASN_OCTET_STR),
- (u_char *)smux_passwd, strlen(smux_passwd));
+ ptr = asn_build_string(
+ ptr, &len,
+ (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR),
+ (u_char *)smux_passwd, strlen(smux_passwd));
/* Fill in real SMUX header. We exclude ASN header size (2). */
len = BUFSIZ;
ptr = asn_build_header(ptr, &len, (u_char)SMUX_TRAP, 0);
/* Sub agent enterprise oid. */
- ptr = asn_build_objid(ptr, &len, (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE
- | ASN_OBJECT_ID),
- smux_oid, smux_oid_len);
+ ptr = asn_build_objid(
+ ptr, &len,
+ (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OBJECT_ID),
+ smux_oid, smux_oid_len);
/* IP address. */
addr.s_addr = 0;
- ptr = asn_build_string(ptr, &len, (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE
- | ASN_IPADDRESS),
- (u_char *)&addr, sizeof(addr));
+ ptr = asn_build_string(
+ ptr, &len,
+ (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_IPADDRESS),
+ (u_char *)&addr, sizeof(addr));
/* Generic trap integer. */
val = SNMP_TRAP_ENTERPRISESPECIFIC;
- ptr = asn_build_int(ptr, &len, (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE
- | ASN_INTEGER),
- (long *)&val, sizeof(val));
+ ptr = asn_build_int(
+ ptr, &len,
+ (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER),
+ (long *)&val, sizeof(val));
/* Specific trap integer. */
val = sptrap;
- ptr = asn_build_int(ptr, &len, (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE
- | ASN_INTEGER),
- (long *)&val, sizeof(val));
+ ptr = asn_build_int(
+ ptr, &len,
+ (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER),
+ (long *)&val, sizeof(val));
/* Timeticks timestamp. */
val = 0;
zlog_info(
"setsockopt_ipv4_multicast attempting to drop and "
"re-add (fd %d, mcast %s, ifindex %u)",
- sock, inet_ntop(AF_INET, &mreqn.imr_multiaddr, buf[0],
- sizeof(buf[0])),
+ sock,
+ inet_ntop(AF_INET, &mreqn.imr_multiaddr, buf[0],
+ sizeof(buf[0])),
ifindex);
setsockopt(sock, IPPROTO_IP, IP_DROP_MEMBERSHIP, (void *)&mreqn,
sizeof(mreqn));
zlog_info(
"setsockopt_ipv4_multicast attempting to drop and "
"re-add (fd %d, mcast %s, ifindex %u)",
- sock, inet_ntop(AF_INET, &mreq.imr_multiaddr, buf[0],
- sizeof(buf[0])),
+ sock,
+ inet_ntop(AF_INET, &mreq.imr_multiaddr, buf[0],
+ sizeof(buf[0])),
ifindex);
setsockopt(sock, IPPROTO_IP, IP_DROP_MEMBERSHIP, (void *)&mreq,
sizeof(mreq));
}
struct cmd_node vty_node = {
- VTY_NODE, "%s(config-line)# ", 1,
+ VTY_NODE,
+ "%s(config-line)# ",
+ 1,
};
/* Reset all VTY status. */
#endif
#define zassert(EX) \
- ((void)((EX) ? 0 : (_zlog_assert_failed(#EX, __FILE__, __LINE__, \
- __ASSERT_FUNCTION), \
- 0)))
+ ((void)((EX) ? 0 \
+ : (_zlog_assert_failed(#EX, __FILE__, __LINE__, \
+ __ASSERT_FUNCTION), \
+ 0)))
#undef assert
#define assert(EX) zassert(EX)
zlog_warn(
"warning: interface %s address %s "
"with peer flag set, but no peer address!",
- ifp->name, prefix2str(ifc->address, buf,
- sizeof buf));
+ ifp->name,
+ prefix2str(ifc->address, buf,
+ sizeof buf));
UNSET_FLAG(ifc->flags, ZEBRA_IFA_PEER);
}
}
}
static struct route_map_rule_cmd ospf6_routemap_rule_match_tag_cmd = {
- "tag", ospf6_routemap_rule_match_tag, route_map_rule_tag_compile,
+ "tag",
+ ospf6_routemap_rule_match_tag,
+ route_map_rule_tag_compile,
route_map_rule_tag_free,
};
}
struct route_map_rule_cmd ospf6_routemap_rule_set_metric_type_cmd = {
- "metric-type", ospf6_routemap_rule_set_metric_type,
+ "metric-type",
+ ospf6_routemap_rule_set_metric_type,
ospf6_routemap_rule_set_metric_type_compile,
ospf6_routemap_rule_set_metric_type_free,
};
}
struct route_map_rule_cmd ospf6_routemap_rule_set_metric_cmd = {
- "metric", ospf6_routemap_rule_set_metric,
+ "metric",
+ ospf6_routemap_rule_set_metric,
ospf6_routemap_rule_set_metric_compile,
ospf6_routemap_rule_set_metric_free,
};
}
struct route_map_rule_cmd ospf6_routemap_rule_set_forwarding_cmd = {
- "forwarding-address", ospf6_routemap_rule_set_forwarding,
+ "forwarding-address",
+ ospf6_routemap_rule_set_forwarding,
ospf6_routemap_rule_set_forwarding_compile,
ospf6_routemap_rule_set_forwarding_free,
};
}
static struct route_map_rule_cmd ospf6_routemap_rule_set_tag_cmd = {
- "tag", ospf6_routemap_rule_set_tag, route_map_rule_tag_compile,
+ "tag",
+ ospf6_routemap_rule_set_tag,
+ route_map_rule_tag_compile,
route_map_rule_tag_free,
};
oi->priority = strtol(argv[idx_number]->arg, NULL, 10);
- if (oi->area && (oi->state == OSPF6_INTERFACE_DROTHER
- || oi->state == OSPF6_INTERFACE_BDR
- || oi->state == OSPF6_INTERFACE_DR))
+ if (oi->area
+ && (oi->state == OSPF6_INTERFACE_DROTHER
+ || oi->state == OSPF6_INTERFACE_BDR
+ || oi->state == OSPF6_INTERFACE_DR))
ospf6_interface_state_change(dr_election(oi), oi);
return CMD_SUCCESS;
lsdesc = (struct ospf6_router_lsdesc
*)(start
- + pos * (sizeof(struct
- ospf6_router_lsdesc)));
+ + pos
+ * (sizeof(struct
+ ospf6_router_lsdesc)));
if ((char *)lsdesc < end) {
if (buf && (buflen > INET_ADDRSTRLEN * 2)) {
inet_ntop(AF_INET,
unsigned length,
const u_int32_t req_num_pfxs /* always compared with the actual number
of prefixes */
- )
+)
{
u_char requested_pfx_bytes;
u_int32_t real_num_pfxs = 0;
lsalen - OSPF6_LSA_HEADER_SIZE
- OSPF6_LINK_LSA_MIN_SIZE,
ntohl(link_lsa->prefix_num) /* 32 bits */
- );
+ );
case OSPF6_LSTYPE_INTRA_PREFIX:
/* RFC5340 A.4.10, LSA header + OSPF6_INTRA_PREFIX_LSA_MIN_SIZE
bytes
lsalen - OSPF6_LSA_HEADER_SIZE
- OSPF6_INTRA_PREFIX_LSA_MIN_SIZE,
ntohs(intra_prefix_lsa->prefix_num) /* 16 bits */
- );
+ );
}
/* No additional validation is possible for unknown LSA types, which are
themselves valid in OPSFv3, hence the default decision is to accept.
+ OSPF6_LS_UPD_MIN_SIZE),
bytesonwire - OSPF6_HEADER_SIZE - OSPF6_LS_UPD_MIN_SIZE,
0, ntohl(lsupd->lsa_number) /* 32 bits */
- );
+ );
break;
case OSPF6_MESSAGE_TYPE_LSACK:
/* RFC5340 A.3.6, packet header + N>=0 header-only LSAs. */
/* Zebra node structure. */
static struct cmd_node zebra_node = {
- ZEBRA_NODE, "%s(config-zebra)# ",
+ ZEBRA_NODE,
+ "%s(config-zebra)# ",
};
#define ADD 0
continue;
}
- if (
- or->path_type == OSPF_PATH_INTRA_AREA
- && !ospf_abr_should_announce(
- ospf, (struct prefix_ipv4 *)&rn->p,
- or)) {
+ if (or->path_type == OSPF_PATH_INTRA_AREA
+ && !ospf_abr_should_announce(
+ ospf, (struct prefix_ipv4 *)&rn->p,
+ or)) {
if (IS_DEBUG_OSPF_EVENT)
zlog_debug(
"ospf_abr_process_network_rt(): denied by export-list");
continue;
}
- if (
- or->path_type == OSPF_PATH_INTRA_AREA
- && !ospf_abr_plist_out_check(
- area, or,
- (struct prefix_ipv4 *)&rn->p)) {
+ if (or->path_type == OSPF_PATH_INTRA_AREA
+ && !ospf_abr_plist_out_check(
+ area, or,
+ (struct prefix_ipv4 *)&rn->p)) {
if (IS_DEBUG_OSPF_EVENT)
zlog_debug(
"ospf_abr_process_network_rt(): denied by prefix-list");
continue;
}
- if (
- or->path_type == OSPF_PATH_INTER_AREA
- && !OSPF_IS_AREA_ID_BACKBONE(
- or->u.std.area_id)) {
+ if (or->path_type == OSPF_PATH_INTER_AREA
+ && !OSPF_IS_AREA_ID_BACKBONE(
+ or->u.std.area_id)) {
if (IS_DEBUG_OSPF_EVENT)
zlog_debug(
"ospf_abr_process_router_rt(): "
{
struct nametab NameTab[] = {
{
- MSG_REGISTER_OPAQUETYPE, "Register opaque-type",
+ MSG_REGISTER_OPAQUETYPE,
+ "Register opaque-type",
},
{
- MSG_UNREGISTER_OPAQUETYPE, "Unregister opaque-type",
+ MSG_UNREGISTER_OPAQUETYPE,
+ "Unregister opaque-type",
},
{
- MSG_REGISTER_EVENT, "Register event",
+ MSG_REGISTER_EVENT,
+ "Register event",
},
{
- MSG_SYNC_LSDB, "Sync LSDB",
+ MSG_SYNC_LSDB,
+ "Sync LSDB",
},
{
- MSG_ORIGINATE_REQUEST, "Originate request",
+ MSG_ORIGINATE_REQUEST,
+ "Originate request",
},
{
- MSG_DELETE_REQUEST, "Delete request",
+ MSG_DELETE_REQUEST,
+ "Delete request",
},
{
- MSG_REPLY, "Reply",
+ MSG_REPLY,
+ "Reply",
},
{
- MSG_READY_NOTIFY, "Ready notify",
+ MSG_READY_NOTIFY,
+ "Ready notify",
},
{
- MSG_LSA_UPDATE_NOTIFY, "LSA update notify",
+ MSG_LSA_UPDATE_NOTIFY,
+ "LSA update notify",
},
{
- MSG_LSA_DELETE_NOTIFY, "LSA delete notify",
+ MSG_LSA_DELETE_NOTIFY,
+ "LSA delete notify",
},
{
- MSG_NEW_IF, "New interface",
+ MSG_NEW_IF,
+ "New interface",
},
{
- MSG_DEL_IF, "Del interface",
+ MSG_DEL_IF,
+ "Del interface",
},
{
- MSG_ISM_CHANGE, "ISM change",
+ MSG_ISM_CHANGE,
+ "ISM change",
},
{
- MSG_NSM_CHANGE, "NSM change",
+ MSG_NSM_CHANGE,
+ "NSM change",
},
};
{
struct nametab NameTab[] = {
{
- OSPF_API_OK, "OK",
+ OSPF_API_OK,
+ "OK",
},
{
- OSPF_API_NOSUCHINTERFACE, "No such interface",
+ OSPF_API_NOSUCHINTERFACE,
+ "No such interface",
},
{
- OSPF_API_NOSUCHAREA, "No such area",
+ OSPF_API_NOSUCHAREA,
+ "No such area",
},
{
- OSPF_API_NOSUCHLSA, "No such LSA",
+ OSPF_API_NOSUCHLSA,
+ "No such LSA",
},
{
- OSPF_API_ILLEGALLSATYPE, "Illegal LSA type",
+ OSPF_API_ILLEGALLSATYPE,
+ "Illegal LSA type",
},
{
- OSPF_API_OPAQUETYPEINUSE, "Opaque type in use",
+ OSPF_API_OPAQUETYPEINUSE,
+ "Opaque type in use",
},
{
OSPF_API_OPAQUETYPENOTREGISTERED,
"Opaque type not registered",
},
{
- OSPF_API_NOTREADY, "Not ready",
+ OSPF_API_NOTREADY,
+ "Not ready",
},
{
- OSPF_API_NOMEMORY, "No memory",
+ OSPF_API_NOMEMORY,
+ "No memory",
},
{
- OSPF_API_ERROR, "Other error",
+ OSPF_API_ERROR,
+ "Other error",
},
{
- OSPF_API_UNDEF, "Undefined",
+ OSPF_API_UNDEF,
+ "Undefined",
},
};
zlog_warn(
"apiserver_sync_callback: new_msg_update failed");
#ifdef NOTYET
- /* Cannot allocate new message. What should we do? */
- /* ospf_apiserver_free (apiserv);*/ /* Do nothing
- here XXX
- */
+/* Cannot allocate new message. What should we do? */
+/* ospf_apiserver_free (apiserv);*/ /* Do nothing
+ here XXX
+ */
#endif
goto out;
}
break;
case OSPF_OPAQUE_AS_LSA:
ospf_opaque_lsa_refresh(new);
- /* Reconsideration may needed. */ /* XXX */
+ /* Reconsideration may needed. */ /* XXX */
break;
default:
break;
"LSA[Flooding]: Got a self-originated LSA, "
"while local one is initial instance.");
; /* Accept this LSA for quick LSDB resynchronization.
- */
+ */
} else if (monotime_since(¤t->tv_recv, NULL)
< ospf->min_ls_arrival * 1000LL) {
if (IS_DEBUG_OSPF_EVENT)
}
if (ospf->abr_type == OSPF_ABR_SHORTCUT) {
- if (
- or->path_type == OSPF_PATH_INTRA_AREA
- && !OSPF_IS_AREA_ID_BACKBONE(
- or->u.std.area_id)) {
+ if (or->path_type == OSPF_PATH_INTRA_AREA
+ && !OSPF_IS_AREA_ID_BACKBONE(or->u.std.area_id)) {
if (IS_DEBUG_OSPF_EVENT)
zlog_debug(
"ospf_update_network_route(): Shortcut: "
OSPF_EXAMINE_TRANSIT_SUMMARIES_ALL(
area, rt, rtrs);
} else { /* No active BB connection--consider all areas
- */
+ */
if (IS_DEBUG_OSPF_EVENT)
zlog_debug(
"ospf_ia_routing(): "
match = oi;
else if (prefix_match(CONNECTED_PREFIX(oi->connected),
(struct prefix *)&addr)) {
- if ((match == NULL) || (match->address->prefixlen
- < oi->address->prefixlen))
+ if ((match == NULL)
+ || (match->address->prefixlen
+ < oi->address->prefixlen))
match = oi;
}
}
*
* Simpler just to subtract OSPF_MAX_LSA_SIZE though.
*/
- ret = stream_resize(
- s, OSPF_MAX_PACKET_SIZE - OSPF_MAX_LSA_SIZE);
+ ret = stream_resize(s, OSPF_MAX_PACKET_SIZE
+ - OSPF_MAX_LSA_SIZE);
}
if (ret == OSPF_MAX_LSA_SIZE) {
dr = ospf_nbr_lookup_by_addr(oi->nbrs, &DR(oi));
/* Describe Type 2 link. */
- if (dr && (dr->state == NSM_Full
- || IPV4_ADDR_SAME(&oi->address->u.prefix4, &DR(oi)))
+ if (dr
+ && (dr->state == NSM_Full
+ || IPV4_ADDR_SAME(&oi->address->u.prefix4, &DR(oi)))
&& ospf_nbr_count(oi, NSM_Full) > 0) {
if (IS_DEBUG_OSPF(lsa, LSA_GENERATE))
zlog_debug(
return id;
}
/* Masklen differs, then apply wildcard mask to Link State ID.
- */
+ */
else {
masklen2ip(p->prefixlen, &mask);
/* ospfd privileges */
zebra_capabilities_t _caps_p[] = {
- ZCAP_NET_RAW, ZCAP_BIND, ZCAP_NET_ADMIN,
+ ZCAP_NET_RAW,
+ ZCAP_BIND,
+ ZCAP_NET_ADMIN,
};
struct zebra_privs_t ospfd_privs = {
if (oi->type == OSPF_IFTYPE_VIRTUALLINK
|| oi->type == OSPF_IFTYPE_POINTOPOINT)
- key.u.prefix4 =
- ospfh->router_id; /* index vlink and ptp nbrs by
- router-id */
+ key.u.prefix4 = ospfh->router_id; /* index vlink and ptp nbrs by
+ router-id */
else
key.u.prefix4 = iph->ip_src;
* list_isempty (oipt->id_list)
* not being empty.
*/
- if (
- oipt->t_opaque_lsa_self
- != NULL /* Waiting for a thread call. */
- || oipt->status == PROC_SUSPEND) /* Cannot
- originate
- now. */
+ if (oipt->t_opaque_lsa_self
+ != NULL /* Waiting for a thread call. */
+ || oipt->status == PROC_SUSPEND) /* Cannot
+ originate
+ now. */
continue;
ospf_opaque_lsa_reoriginate_schedule(
* list_isempty (oipt->id_list)
* not being empty.
*/
- if (
- oipt->t_opaque_lsa_self
- != NULL /* Waiting for a thread call. */
- || oipt->status == PROC_SUSPEND) /* Cannot
- originate
- now. */
+ if (oipt->t_opaque_lsa_self
+ != NULL /* Waiting for a thread call. */
+ || oipt->status == PROC_SUSPEND) /* Cannot
+ originate
+ now. */
continue;
ospf_opaque_lsa_reoriginate_schedule(
* list_isempty (oipt->id_list)
* not being empty.
*/
- if (
- oipt->t_opaque_lsa_self
- != NULL /* Waiting for a thread call. */
- || oipt->status == PROC_SUSPEND) /* Cannot
- originate
- now. */
+ if (oipt->t_opaque_lsa_self
+ != NULL /* Waiting for a thread call. */
+ || oipt->status == PROC_SUSPEND) /* Cannot
+ originate
+ now. */
continue;
ospf_opaque_lsa_reoriginate_schedule((void *)top,
#ifdef WANT_OSPF_WRITE_FRAGMENT
static u_int16_t ipid = 0;
u_int16_t maxdatasize;
-#endif /* WANT_OSPF_WRITE_FRAGMENT */
- /* $FRR indent$ */
- /* clang-format off */
+#endif /* WANT_OSPF_WRITE_FRAGMENT */
+ /* $FRR indent$ */
+ /* clang-format off */
#define OSPF_WRITE_IPHL_SHIFT 2
int pkt_count = 0;
return 0;
}
/* only MD5 crypto method can pass ospf_packet_examin() */
- if (
- NULL == (ck = listgetdata(listtail(
- OSPF_IF_PARAM(oi, auth_crypt))))
- || ospfh->u.crypt.key_id != ck->key_id ||
- /* Condition above uses the last key ID on the list,
- which is
- different from what ospf_crypt_key_lookup() does. A
- bug? */
- !ospf_check_md5_digest(oi, ospfh)) {
+ if (NULL
+ == (ck = listgetdata(listtail(
+ OSPF_IF_PARAM(oi, auth_crypt))))
+ || ospfh->u.crypt.key_id != ck->key_id ||
+ /* Condition above uses the last key ID on the list,
+ which is
+ different from what ospf_crypt_key_lookup() does. A
+ bug? */
+ !ospf_check_md5_digest(oi, ospfh)) {
if (IS_DEBUG_OSPF_PACKET(ospfh->type - 1, RECV))
zlog_warn("interface %s: MD5 auth failed",
IF_NAME(oi));
header, "flags",
0, "# links" */
ntohs(rlsa->links) /* 16 bits */
- );
+ );
break;
case OSPF_AS_EXTERNAL_LSA:
/* RFC2328 A.4.5, LSA header + 4 bytes followed by N>=1 12-bytes long
bytesdeclared - OSPF_HEADER_SIZE - OSPF_LS_UPD_MIN_SIZE,
0, /* full LSAs */
ntohl(lsupd->num_lsas) /* 32 bits */
- );
+ );
break;
case OSPF_MSG_LS_ACK:
/* RFC2328 A.3.6, packet header followed by N>=0 header-only
ospfh = (struct ospf_header *)STREAM_PNT(ibuf);
if (MSG_OK
- != ospf_packet_examin(
- ospfh, stream_get_endp(ibuf) - stream_get_getp(ibuf)))
+ != ospf_packet_examin(ospfh, stream_get_endp(ibuf)
+ - stream_get_getp(ibuf)))
return -1;
/* Now it is safe to access all fields of OSPF packet header. */
* or header area is backbone but ospf_interface is not
* check for VLINK interface
*/
- if ((oi == NULL) || (OSPF_IS_AREA_ID_BACKBONE(ospfh->area_id)
- && !OSPF_IS_AREA_ID_BACKBONE(oi->area->area_id))) {
+ if ((oi == NULL)
+ || (OSPF_IS_AREA_ID_BACKBONE(ospfh->area_id)
+ && !OSPF_IS_AREA_ID_BACKBONE(oi->area->area_id))) {
if ((oi = ospf_associate_packet_vl(ospf, ifp, iph, ospfh))
== NULL) {
if (!ospf->instance && IS_DEBUG_OSPF_EVENT)
or->path_type == OSPF_PATH_INTER_AREA) {
if (or->type == OSPF_DESTINATION_NETWORK) {
if (!ospf_route_exist_new_table(
- cmprt,
- (struct prefix_ipv4 *)&rn
- ->p))
+ cmprt, (struct prefix_ipv4
+ *)&rn->p))
ospf_zebra_delete(
(struct prefix_ipv4
*)&rn->p,
or);
} else if (or->type == OSPF_DESTINATION_DISCARD)
if (!ospf_route_exist_new_table(
- cmprt,
- (struct prefix_ipv4 *)&rn
- ->p))
+ cmprt, (struct prefix_ipv4
+ *)&rn->p))
ospf_zebra_delete_discard(
(struct prefix_ipv4
*)&rn->p);
/* Route map commands for tag matching. */
static struct route_map_rule_cmd route_match_tag_cmd = {
- "tag", route_match_tag, route_map_rule_tag_compile,
+ "tag",
+ route_match_tag,
+ route_map_rule_tag_compile,
route_map_rule_tag_free,
};
/* Set metric rule structure. */
struct route_map_rule_cmd route_set_metric_cmd = {
- "metric", route_set_metric, route_set_metric_compile,
+ "metric",
+ route_set_metric,
+ route_set_metric_compile,
route_set_metric_free,
};
/* Set metric rule structure. */
struct route_map_rule_cmd route_set_metric_type_cmd = {
- "metric-type", route_set_metric_type, route_set_metric_type_compile,
+ "metric-type",
+ route_set_metric_type,
+ route_set_metric_type_compile,
route_set_metric_type_free,
};
/* Route map commands for tag set. */
static struct route_map_rule_cmd route_set_tag_cmd = {
- "tag", route_set_tag, route_map_rule_tag_compile,
+ "tag",
+ route_set_tag,
+ route_map_rule_tag_compile,
route_map_rule_tag_free,
};
return SNMP_INTEGER(SNMP_VALID);
break;
case OSPFSTUBMETRICTYPE: /* 5 */
-/* OSPF Metric type. */
+ /* OSPF Metric type. */
+ /* $FRR indent$ */
+ /* clang-format off */
#define OSPF_ospfMetric 1
#define OSPF_comparableCost 2
#define OSPF_nonComparable 3
for (ALL_LIST_ELEMENTS(ospf->oiflist, node, nnode, oi)) {
for (rn = route_top(oi->nbrs); rn; rn = route_next(rn))
- if ((nbr = rn->info) != NULL && nbr != oi->nbr_self
+ if ((nbr = rn->info) != NULL
+ && nbr != oi->nbr_self
/* If EXACT match is needed, provide ALL entry found
&& nbr->state != NSM_Down
*/
ospf->passive_interface_default = newval;
for (ALL_LIST_ELEMENTS_RO(om->iflist, ln, ifp)) {
- if (ifp && OSPF_IF_PARAM_CONFIGURED(IF_DEF_PARAMS(ifp),
- passive_interface))
+ if (ifp
+ && OSPF_IF_PARAM_CONFIGURED(IF_DEF_PARAMS(ifp),
+ passive_interface))
UNSET_IF_PARAM(IF_DEF_PARAMS(ifp), passive_interface);
}
for (ALL_LIST_ELEMENTS_RO(ospf->oiflist, ln, oi)) {
for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next(rn)) {
struct ospf_interface *oi = rn->info;
- if (oi && (OSPF_IF_PARAM(oi, passive_interface)
- == OSPF_IF_PASSIVE))
+ if (oi
+ && (OSPF_IF_PARAM(oi, passive_interface)
+ == OSPF_IF_PASSIVE))
ospf_if_set_multicast(oi);
}
/*
"Enable the RFC1583Compatibility flag\n")
ALIAS(no_ospf_compatible_rfc1583, no_ospf_rfc1583_flag_cmd,
- "no ospf rfc1583compatibility", NO_STR
+ "no ospf rfc1583compatibility",
+ NO_STR
"OSPF specific commands\n"
"Disable the RFC1583Compatibility flag\n")
}
ALIAS(no_ospf_write_multiplier, no_write_multiplier_cmd,
- "no write-multiplier (1-100)", NO_STR
+ "no write-multiplier (1-100)",
+ NO_STR
"Write multiplier\n"
"Maximum number of interface serviced per write\n")
if (use_json) {
json_object_object_add(json, "areas", json_areas);
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
} else
vty_out(vty, "\n");
dstr = "Broadcast";
/* For Vlinks, showing the peer address is
- * probably more
- * * * * * informative than the local
- * interface that is being used
- * * * * */
+ * probably more
+ * * * * * informative than
+ * the local interface that is being used
+ * * * * */
if (oi->type == OSPF_IFTYPE_VIRTUALLINK)
dest = &oi->vl_data->peer_addr;
else
}
if (use_json) {
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
} else
vty_out(vty, "\n");
show_ip_ospf_neighbor_sub(vty, oi, json, use_json);
if (use_json) {
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
} else
vty_out(vty, "\n");
}
if (use_json) {
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
} else
vty_out(vty, "\n");
}
if (use_json) {
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
} else
vty_out(vty, "\n");
}
if (use_json) {
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
} else
vty_out(vty, "\n");
}
if (use_json) {
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
} else
vty_out(vty, "\n");
}
if (use_json) {
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
} else {
vty_out(vty, "\n");
}
if (use_json) {
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
} else
vty_out(vty, "\n");
}
/* Metric preference */
- pim_write_uint32(pim_msg_curr,
- rpt_bit_flag ? metric_preference | 0x80000000
- : metric_preference);
+ pim_write_uint32(pim_msg_curr, rpt_bit_flag
+ ? metric_preference | 0x80000000
+ : metric_preference);
pim_msg_curr += 4;
/* Route metric */
} /* scan interface channels */
if (uj) {
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
} else {
vty_out(vty,
"Interface Address Source Group Membership\n");
}
if (uj) {
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
}
}
}
if (uj) {
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
} else {
if (!found_ifname)
print_header = 1;
for (ALL_LIST_ELEMENTS_RO(pim_upstream_list, upnode,
up)) {
- if (strcmp(ifp->name,
- up->rpf.source_nexthop
- .interface->name)
+ if (strcmp(ifp->name, up->rpf.source_nexthop
+ .interface->name)
== 0) {
if (up->flags
& PIM_UPSTREAM_FLAG_MASK_FHR) {
}
if (uj) {
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
} else {
if (!found_ifname)
}
if (uj) {
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
} else {
vty_out(vty,
"Interface State Address PIM Nbrs PIM DR FHR IfChannels\n");
}
}
if (uj) {
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
}
}
}
}
if (uj) {
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
} else {
if (!found_ifname)
} /* scan interface channels */
if (uj) {
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
}
}
}
if (uj) {
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
} else {
{
if (uj) {
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
} else {
vty_out(vty, "\n");
}
if (uj) {
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
}
}
}
if (uj) {
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
}
}
}
if (uj) {
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
}
}
pim_addr_dump("<rpf?>", &rpf->rpf_addr, rpf_addr_str,
sizeof(rpf_addr_str));
- rpf_ifname = rpf->source_nexthop.interface ? rpf->source_nexthop.interface->name : "<ifname?>";
+ rpf_ifname =
+ rpf->source_nexthop.interface ? rpf->source_nexthop
+ .interface->name
+ : "<ifname?>";
if (uj) {
json_object_object_get_ex(json, grp_str, &json_group);
}
if (uj) {
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
}
}
&rpf->source_nexthop.mrib_nexthop_addr,
rib_nexthop_str, sizeof(rib_nexthop_str));
- rpf_ifname = rpf->source_nexthop.interface ? rpf->source_nexthop.interface->name : "<ifname?>";
+ rpf_ifname =
+ rpf->source_nexthop.interface ? rpf->source_nexthop
+ .interface->name
+ : "<ifname?>";
if (uj) {
json_object_object_get_ex(json, grp_str, &json_group);
}
if (uj) {
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
}
}
} /* scan interfaces */
if (uj) {
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
}
}
}
if (uj) {
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
}
}
json_object *json;
json = json_object_new_object();
json_object_string_add(json, "ssmGroups", range_str);
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
} else
vty_out(vty, "SSM group range : %s\n", range_str);
json_object *json;
json = json_object_new_object();
json_object_string_add(json, "groupType", type_str);
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
} else
vty_out(vty, "Group type : %s\n", type_str);
}
ALIAS(no_ip_pim_bfd, no_ip_pim_bfd_param_cmd,
- "no ip pim bfd (2-255) (50-60000) (50-60000)", NO_STR IP_STR PIM_STR
+ "no ip pim bfd (2-255) (50-60000) (50-60000)",
+ NO_STR IP_STR PIM_STR
"Enables BFD support\n"
"Detect Multiplier\n"
"Required min receive interval\n"
if (uj) {
json_object_object_add(json, mg->mesh_group_name, json_mg_row);
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
}
}
}
if (uj) {
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
}
}
}
if (uj) {
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
}
}
if (uj) {
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
}
}
}
if (uj) {
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
}
}
}
if (uj) {
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
}
}
}
if (uj) {
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
}
}
struct in_addr update_source; /* user can statically set the primary
* address of the interface */
- int igmp_version; /* IGMP version */
- int igmp_default_robustness_variable; /* IGMPv3 QRV */
- int
- igmp_default_query_interval; /* IGMPv3 secs between general
+ int igmp_version; /* IGMP version */
+ int igmp_default_robustness_variable; /* IGMPv3 QRV */
+ int igmp_default_query_interval; /* IGMPv3 secs between general
queries */
int igmp_query_max_response_time_dsec; /* IGMPv3 Max Response Time in
dsecs for general queries */
/*
* If we are going to be a LHR, we need to note it
*/
- if (ch->upstream->parent && (ch->upstream->parent->flags
- & PIM_UPSTREAM_FLAG_MASK_SRC_IGMP)
+ if (ch->upstream->parent
+ && (ch->upstream->parent->flags
+ & PIM_UPSTREAM_FLAG_MASK_SRC_IGMP)
&& !(ch->upstream->flags
& PIM_UPSTREAM_FLAG_MASK_SRC_LHR)) {
pim_upstream_ref(ch->upstream,
/* pimd privileges */
zebra_capabilities_t _caps_p[] = {
- ZCAP_NET_ADMIN, ZCAP_SYS_ADMIN, ZCAP_NET_RAW, ZCAP_BIND,
+ ZCAP_NET_ADMIN,
+ ZCAP_SYS_ADMIN,
+ ZCAP_NET_RAW,
+ ZCAP_BIND,
};
/* pimd privileges to run with */
}
/* this is interntionally asymmetric i.e. we set up listen-socket when
- * the
- * first listening peer is configured; but don't bother tearing it down
- * when
- * all the peers go down */
+ * the
+ * first listening peer is configured; but don't bother tearing it down
+ * when
+ * all the peers go down */
pim_msdp_sock_listen();
}
PIM_MSDP_SAF_PEER = (1 << 1),
PIM_MSDP_SAF_REF = (PIM_MSDP_SAF_LOCAL | PIM_MSDP_SAF_PEER),
PIM_MSDP_SAF_STALE = (1 << 2), /* local entries can get kicked out on
- * misc pim events such as RP change */
+ * misc pim events such as RP change */
PIM_MSDP_SAF_UP_DEL_IN_PROG = (1 << 3)
};
#define PIM_MSDP_PEER_HOLD_TIME 75
struct thread *hold_timer; // 5.4
/* $FRR indent$ */
-/* clang-format off */
+ /* clang-format off */
#define PIM_MSDP_PEER_KA_TIME 60
- struct thread *ka_timer; // 5.5
- /* $FRR indent$ */
- /* clang-format off */
+ struct thread *ka_timer; // 5.5
+ /* $FRR indent$ */
+ /* clang-format off */
#define PIM_MSDP_PEER_CONNECT_RETRY_TIME 30
- struct thread *cr_timer; // 5.6
+ struct thread *cr_timer; // 5.6
/* packet thread and buffers */
uint32_t packet_size;
pim_str_sg_dump(&sg), src_str, ifp->name, i_am_rp);
}
- if (i_am_rp && (dest_addr.s_addr
- == ((RP(sg.grp))->rpf_addr.u.prefix4.s_addr))) {
+ if (i_am_rp
+ && (dest_addr.s_addr
+ == ((RP(sg.grp))->rpf_addr.u.prefix4.s_addr))) {
sentRegisterStop = 0;
if (*bits & PIM_REGISTER_BORDER_BIT) {
inet_ntoa(prev_rp_info->rp.rpf_addr.u.prefix4),
json_rp_rows);
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
}
}
nexthop_tab[0].route_metric);
}
- addr =
- nexthop_addr.u.prefix4; /* use nexthop addr for
- recursive lookup */
+ addr = nexthop_addr.u.prefix4; /* use nexthop addr for
+ recursive lookup */
} /* for (max_lookup) */
*/
#define QPB_ALLOC(allocator, type) (type *)qpb_alloc(allocator, sizeof(type))
-
/*
* Externs.
*/
}
static struct cmd_node interface_node = {
- INTERFACE_NODE, "%s(config-if)# ", 1,
+ INTERFACE_NODE,
+ "%s(config-if)# ",
+ 1,
};
/* Called when interface structure allocated. */
/* Route map commands for tag matching. */
static struct route_map_rule_cmd route_match_tag_cmd = {
- "tag", route_match_tag, route_map_rule_tag_compile,
+ "tag",
+ route_match_tag,
+ route_map_rule_tag_compile,
route_map_rule_tag_free,
};
/* Set metric rule structure. */
static struct route_map_rule_cmd route_set_metric_cmd = {
- "metric", route_set_metric, route_set_metric_compile,
+ "metric",
+ route_set_metric,
+ route_set_metric_compile,
route_set_metric_free,
};
/* Zebra node structure. */
static struct cmd_node zebra_node = {
- ZEBRA_NODE, "%s(config-router)# ",
+ ZEBRA_NODE,
+ "%s(config-router)# ",
};
static void rip_zebra_connected(struct zclient *zclient)
/* Get back the object */
rte->nexthop = newinfo.nexthop_out;
rte->tag = htons(newinfo.tag_out); /* XXX */
- rte->metric =
- newinfo.metric_out; /* XXX: the routemap uses the
- metric_out field */
+ rte->metric = newinfo.metric_out; /* XXX: the routemap uses the
+ metric_out field */
}
/* Once the entry has been validated, update the metric by
}
static struct route_map_rule_cmd route_match_tag_cmd = {
- "tag", route_match_tag, route_map_rule_tag_compile,
+ "tag",
+ route_match_tag,
+ route_map_rule_tag_compile,
route_map_rule_tag_free,
};
}
static struct route_map_rule_cmd route_set_metric_cmd = {
- "metric", route_set_metric, route_set_metric_compile,
+ "metric",
+ route_set_metric,
+ route_set_metric_compile,
route_set_metric_free,
};
/* Zebra node structure. */
static struct cmd_node zebra_node = {
- ZEBRA_NODE, "%s(config-router)# ",
+ ZEBRA_NODE,
+ "%s(config-router)# ",
};
static void ripng_zebra_connected(struct zclient *zclient)
}
}
rte->tag = htons(newinfo.tag_out); /* XXX */
- rte->metric =
- newinfo.metric_out; /* XXX: the routemap uses the
- metric_out field */
+ rte->metric = newinfo.metric_out; /* XXX: the routemap uses the
+ metric_out field */
}
/* Once the entry has been validated, update the metric by
/* RIPng node structure. */
static struct cmd_node cmd_ripng_node = {
- RIPNG_NODE, "%s(config-router)# ", 1,
+ RIPNG_NODE,
+ "%s(config-router)# ",
+ 1,
};
static void ripng_distribute_update(struct distribute *dist)
deleted */
const unsigned int hops; /* aspath_count_hops result */
const unsigned int confeds; /* aspath_count_confeds */
- const int private_as; /* whether the private_as check should pass or
- fail */
+ const int private_as; /* whether the private_as check should pass or
+ fail */
+ /* $FRR indent$ */
+ /* clang-format off */
#define NOT_ALL_PRIVATE 0
#define ALL_PRIVATE 1
const as_t does_loop; /* an ASN which should trigger loop-check */
{0x2, 0x1, 0x22, 0x12, 0x2, 0x1, 0x00, 0x04},
8,
{
- "8722 4", "8722 4", 2, 0, NOT_ALL_PRIVATE, 4, 5, 8722,
+ "8722 4",
+ "8722 4",
+ 2,
+ 0,
+ NOT_ALL_PRIVATE,
+ 4,
+ 5,
+ 8722,
},
},
{
"reconcile_start_trans",
"seq(23456,23456,23456) seq(6435,59408,21665)",
{
- 0x2, 0x3, 0x5b, 0xa0, 0x5b, 0xa0, 0x5b, 0xa0, 0x2, 0x3,
- 0x19, 0x23, 0xe8, 0x10, 0x54, 0xa1,
+ 0x2,
+ 0x3,
+ 0x5b,
+ 0xa0,
+ 0x5b,
+ 0xa0,
+ 0x5b,
+ 0xa0,
+ 0x2,
+ 0x3,
+ 0x19,
+ 0x23,
+ 0xe8,
+ 0x10,
+ 0x54,
+ 0xa1,
},
16,
{"23456 23456 23456 6435 59408 21665",
"reconcile_start_trans4",
"seq(1842,41591,51793) seq(6435,59408,21665)",
{
- 0x2, 0x3, 0x07, 0x32, 0xa2, 0x77, 0xca, 0x51, 0x2, 0x3,
- 0x19, 0x23, 0xe8, 0x10, 0x54, 0xa1,
+ 0x2,
+ 0x3,
+ 0x07,
+ 0x32,
+ 0xa2,
+ 0x77,
+ 0xca,
+ 0x51,
+ 0x2,
+ 0x3,
+ 0x19,
+ 0x23,
+ 0xe8,
+ 0x10,
+ 0x54,
+ 0xa1,
},
16,
{"1842 41591 51793 6435 59408 21665",
"reconcile_start_trans_error",
"seq(23456,23456,23456) seq(6435,59408)",
{
- 0x2, 0x3, 0x5b, 0xa0, 0x5b, 0xa0, 0x5b, 0xa0, 0x2, 0x2,
- 0x19, 0x23, 0xe8, 0x10,
+ 0x2,
+ 0x3,
+ 0x5b,
+ 0xa0,
+ 0x5b,
+ 0xa0,
+ 0x5b,
+ 0xa0,
+ 0x2,
+ 0x2,
+ 0x19,
+ 0x23,
+ 0xe8,
+ 0x10,
},
14,
{"23456 23456 23456 6435 59408", "23456 23456 23456 6435 59408",
0,
0,
{
- COMMON_ATTRS, BGP_ATTR_FLAG_TRANS, BGP_ATTR_AS_PATH, 10,
+ COMMON_ATTRS,
+ BGP_ATTR_FLAG_TRANS,
+ BGP_ATTR_AS_PATH,
+ 10,
},
COMMON_ATTR_SIZE + 3,
},
-1,
0,
{
- COMMON_ATTRS, BGP_ATTR_FLAG_TRANS, BGP_ATTR_AS_PATH, 8,
+ COMMON_ATTRS,
+ BGP_ATTR_FLAG_TRANS,
+ BGP_ATTR_AS_PATH,
+ 8,
},
COMMON_ATTR_SIZE + 3,
},
-1,
0,
{
- COMMON_ATTRS, BGP_ATTR_FLAG_TRANS, BGP_ATTR_AS_PATH, 12,
+ COMMON_ATTRS,
+ BGP_ATTR_FLAG_TRANS,
+ BGP_ATTR_AS_PATH,
+ 12,
},
COMMON_ATTR_SIZE + 3,
},
{
COMMON_ATTRS,
BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL,
- BGP_ATTR_AS_PATH, 10,
+ BGP_ATTR_AS_PATH,
+ 10,
},
COMMON_ATTR_SIZE + 3,
},
{
COMMON_ATTRS,
BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL,
- BGP_ATTR_AS4_PATH, 10,
+ BGP_ATTR_AS4_PATH,
+ 10,
},
COMMON_ATTR_SIZE + 3,
},
{
COMMON_ATTRS,
BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL,
- BGP_ATTR_AS4_PATH, 10,
+ BGP_ATTR_AS4_PATH,
+ 10,
},
COMMON_ATTR_SIZE + 3,
},
0,
PEER_CAP_AS4_RCV | PEER_CAP_AS4_ADV,
{
- COMMON_ATTRS, BGP_ATTR_FLAG_TRANS, BGP_ATTR_AS_PATH, 18,
+ COMMON_ATTRS,
+ BGP_ATTR_FLAG_TRANS,
+ BGP_ATTR_AS_PATH,
+ 18,
},
COMMON_ATTR_SIZE + 3,
},
-1,
PEER_CAP_AS4_RCV | PEER_CAP_AS4_ADV,
{
- COMMON_ATTRS, BGP_ATTR_FLAG_TRANS, BGP_ATTR_AS_PATH, 16,
+ COMMON_ATTRS,
+ BGP_ATTR_FLAG_TRANS,
+ BGP_ATTR_AS_PATH,
+ 16,
},
COMMON_ATTR_SIZE + 3,
},
-1,
PEER_CAP_AS4_RCV | PEER_CAP_AS4_ADV,
{
- COMMON_ATTRS, BGP_ATTR_FLAG_TRANS, BGP_ATTR_AS_PATH, 20,
+ COMMON_ATTRS,
+ BGP_ATTR_FLAG_TRANS,
+ BGP_ATTR_AS_PATH,
+ 20,
},
COMMON_ATTR_SIZE + 3,
},
-1,
PEER_CAP_AS4_RCV | PEER_CAP_AS4_ADV,
{
- COMMON_ATTRS, BGP_ATTR_FLAG_TRANS, BGP_ATTR_AS_PATH, 22,
+ COMMON_ATTRS,
+ BGP_ATTR_FLAG_TRANS,
+ BGP_ATTR_AS_PATH,
+ 22,
},
COMMON_ATTR_SIZE + 3,
},
{
COMMON_ATTRS,
BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL,
- BGP_ATTR_AS_PATH, 18,
+ BGP_ATTR_AS_PATH,
+ 18,
},
COMMON_ATTR_SIZE + 3,
},
{
COMMON_ATTRS,
BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL,
- BGP_ATTR_AS4_PATH, 14,
+ BGP_ATTR_AS4_PATH,
+ 14,
},
COMMON_ATTR_SIZE + 3,
},
{
COMMON_ATTRS,
BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL,
- BGP_ATTR_AS4_PATH, 14,
+ BGP_ATTR_AS4_PATH,
+ 14,
},
COMMON_ATTR_SIZE + 3,
&test_segments[0],
{NULL,
NULL,
{
- NULL, 0, 0, 0, 0, 0, 0,
+ NULL,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
}},
};
{NULL,
NULL,
{
- NULL, 0, 0, 0, 0, 0, 0,
+ NULL,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
}},
};
},
{NULL, NULL, {0}, 0, 0}};
-static struct test_segment misc_segments[] =
+static struct test_segment misc_segments[] = {
+ /* 13 */
{
- /* 13 */
- {
- "ORF",
- "ORF, simple, single entry, single tuple",
- {/* hdr */ CAPABILITY_CODE_ORF, 0x7,
- /* mpc */ 0x0, 0x1, 0x0, 0x1,
- /* num */ 0x1,
- /* tuples */ 0x40, 0x3},
- 9,
- SHOULD_PARSE,
- },
- /* 14 */
- {
- "ORF-many",
- "ORF, multi entry/tuple",
- {
- /* hdr */ CAPABILITY_CODE_ORF,
- 0x21,
- /* mpc */ 0x0,
- 0x1,
- 0x0,
- 0x1,
- /* num */ 0x3,
- /* tuples */ 0x40,
- ORF_MODE_BOTH,
- 0x80,
- ORF_MODE_RECEIVE,
- 0x80,
- ORF_MODE_SEND,
- /* mpc */ 0x0,
- 0x2,
- 0x0,
- 0x1,
- /* num */ 0x3,
- /* tuples */ 0x40,
- ORF_MODE_BOTH,
- 0x80,
- ORF_MODE_RECEIVE,
- 0x80,
- ORF_MODE_SEND,
- /* mpc */ 0x0,
- 0x2,
- 0x0,
- 0x2,
- /* num */ 0x3,
- /* tuples */ 0x40,
- ORF_MODE_RECEIVE,
- 0x80,
- ORF_MODE_SEND,
- 0x80,
- ORF_MODE_BOTH,
- },
- 35,
- SHOULD_PARSE,
- },
- /* 15 */
- {
- "ORFlo",
- "ORF, multi entry/tuple, hdr length too short",
- {
- /* hdr */ CAPABILITY_CODE_ORF,
- 0x15,
- /* mpc */ 0x0,
- 0x1,
- 0x0,
- 0x1,
- /* num */ 0x3,
- /* tuples */ 0x40,
- 0x3,
- 0x80,
- 0x1,
- 0x80,
- 0x2,
- /* mpc */ 0x0,
- 0x1,
- 0x0,
- 0x1,
- /* num */ 0x3,
- /* tuples */ 0x40,
- 0x3,
- 0x80,
- 0x1,
- 0x80,
- 0x2,
- /* mpc */ 0x0,
- 0x2,
- 0x0,
- 0x2,
- /* num */ 0x3,
- /* tuples */ 0x40,
- 0x3,
- 0x80,
- 0x1,
- 0x80,
- 0x2,
- },
- 35,
- SHOULD_ERR, /* It should error on invalid
- Route-Refresh.. */
- },
- /* 16 */
- {"ORFlu",
- "ORF, multi entry/tuple, length too long",
- {
- /* hdr */ 0x3,
- 0x22,
- /* mpc */ 0x0,
- 0x1,
- 0x0,
- 0x1,
- /* num */ 0x3,
- /* tuples */ 0x40,
- 0x3,
- 0x80,
- 0x1,
- 0x80,
- 0x2,
- /* mpc */ 0x0,
- 0x2,
- 0x0,
- 0x1,
- /* num */ 0x3,
- /* tuples */ 0x40,
- 0x3,
- 0x80,
- 0x1,
- 0x80,
- 0x2,
- /* mpc */ 0x0,
- 0x2,
- 0x0,
- 0x2,
- /* num */ 0x3,
- /* tuples */ 0x40,
- 0x3,
- 0x80,
- 0x1,
- 0x80,
- 0x2,
- },
- 35,
- SHOULD_ERR},
- /* 17 */
- {
- "ORFnu",
- "ORF, multi entry/tuple, entry number too long",
- {
- /* hdr */ 0x3,
- 0x21,
- /* mpc */ 0x0,
- 0x1,
- 0x0,
- 0x1,
- /* num */ 0x3,
- /* tuples */ 0x40,
- 0x3,
- 0x80,
- 0x1,
- 0x80,
- 0x2,
- /* mpc */ 0x0,
- 0x2,
- 0x0,
- 0x1,
- /* num */ 0x4,
- /* tuples */ 0x40,
- 0x3,
- 0x80,
- 0x1,
- 0x80,
- 0x2,
- /* mpc */ 0x0,
- 0x2,
- 0x0,
- 0x2,
- /* num */ 0x3,
- /* tuples */ 0x40,
- 0x3,
- 0x80,
- 0x1,
- 0x80,
- 0x2,
- },
- 35,
- SHOULD_PARSE, /* parses, but last few tuples should be
- gibberish */
- },
- /* 18 */
- {
- "ORFno",
- "ORF, multi entry/tuple, entry number too short",
- {
- /* hdr */ 0x3,
- 0x21,
- /* mpc */ 0x0,
- 0x1,
- 0x0,
- 0x1,
- /* num */ 0x3,
- /* tuples */ 0x40,
- 0x3,
- 0x80,
- 0x1,
- 0x80,
- 0x2,
- /* mpc */ 0x0,
- 0x2,
- 0x0,
- 0x1,
- /* num */ 0x1,
- /* tuples */ 0x40,
- 0x3,
- 0x80,
- 0x1,
- 0x80,
- 0x2,
- /* mpc */ 0x0,
- 0x2,
- 0x0,
- 0x2,
- /* num */ 0x3,
- /* tuples */ 0x40,
- 0x3,
- 0x80,
- 0x1,
- 0x80,
- 0x2,
- },
- 35,
- SHOULD_PARSE, /* Parses, but should get gibberish
- afi/safis */
- },
- /* 17 */
+ "ORF",
+ "ORF, simple, single entry, single tuple",
+ {/* hdr */ CAPABILITY_CODE_ORF, 0x7,
+ /* mpc */ 0x0, 0x1, 0x0, 0x1,
+ /* num */ 0x1,
+ /* tuples */ 0x40, 0x3},
+ 9,
+ SHOULD_PARSE,
+ },
+ /* 14 */
+ {
+ "ORF-many",
+ "ORF, multi entry/tuple",
{
- "ORFpad",
- "ORF, multi entry/tuple, padded to align",
- {
- /* hdr */ 0x3,
- 0x22,
- /* mpc */ 0x0,
- 0x1,
- 0x0,
- 0x1,
- /* num */ 0x3,
- /* tuples */ 0x40,
- 0x3,
- 0x80,
- 0x1,
- 0x80,
- 0x2,
- /* mpc */ 0x0,
- 0x2,
- 0x0,
- 0x1,
- /* num */ 0x3,
- /* tuples */ 0x40,
- 0x3,
- 0x80,
- 0x1,
- 0x80,
- 0x2,
- /* mpc */ 0x0,
- 0x2,
- 0x0,
- 0x2,
- /* num */ 0x3,
- /* tuples */ 0x40,
- 0x3,
- 0x80,
- 0x1,
- 0x80,
- 0x2,
- 0x00,
- },
- 36,
- SHOULD_PARSE,
+ /* hdr */ CAPABILITY_CODE_ORF,
+ 0x21,
+ /* mpc */ 0x0,
+ 0x1,
+ 0x0,
+ 0x1,
+ /* num */ 0x3,
+ /* tuples */ 0x40,
+ ORF_MODE_BOTH,
+ 0x80,
+ ORF_MODE_RECEIVE,
+ 0x80,
+ ORF_MODE_SEND,
+ /* mpc */ 0x0,
+ 0x2,
+ 0x0,
+ 0x1,
+ /* num */ 0x3,
+ /* tuples */ 0x40,
+ ORF_MODE_BOTH,
+ 0x80,
+ ORF_MODE_RECEIVE,
+ 0x80,
+ ORF_MODE_SEND,
+ /* mpc */ 0x0,
+ 0x2,
+ 0x0,
+ 0x2,
+ /* num */ 0x3,
+ /* tuples */ 0x40,
+ ORF_MODE_RECEIVE,
+ 0x80,
+ ORF_MODE_SEND,
+ 0x80,
+ ORF_MODE_BOTH,
},
- /* 19 */
+ 35,
+ SHOULD_PARSE,
+ },
+ /* 15 */
+ {
+ "ORFlo",
+ "ORF, multi entry/tuple, hdr length too short",
{
- "AS4",
- "AS4 capability",
- {0x41, 0x4, 0xab, 0xcd, 0xef,
- 0x12}, /* AS: 2882400018 */
- 6,
- SHOULD_PARSE,
- 2882400018,
+ /* hdr */ CAPABILITY_CODE_ORF,
+ 0x15,
+ /* mpc */ 0x0,
+ 0x1,
+ 0x0,
+ 0x1,
+ /* num */ 0x3,
+ /* tuples */ 0x40,
+ 0x3,
+ 0x80,
+ 0x1,
+ 0x80,
+ 0x2,
+ /* mpc */ 0x0,
+ 0x1,
+ 0x0,
+ 0x1,
+ /* num */ 0x3,
+ /* tuples */ 0x40,
+ 0x3,
+ 0x80,
+ 0x1,
+ 0x80,
+ 0x2,
+ /* mpc */ 0x0,
+ 0x2,
+ 0x0,
+ 0x2,
+ /* num */ 0x3,
+ /* tuples */ 0x40,
+ 0x3,
+ 0x80,
+ 0x1,
+ 0x80,
+ 0x2,
},
+ 35,
+ SHOULD_ERR, /* It should error on invalid
+ Route-Refresh.. */
+ },
+ /* 16 */
+ {"ORFlu",
+ "ORF, multi entry/tuple, length too long",
+ {
+ /* hdr */ 0x3, 0x22,
+ /* mpc */ 0x0, 0x1, 0x0, 0x1,
+ /* num */ 0x3,
+ /* tuples */ 0x40, 0x3, 0x80, 0x1, 0x80, 0x2,
+ /* mpc */ 0x0, 0x2, 0x0, 0x1,
+ /* num */ 0x3,
+ /* tuples */ 0x40, 0x3, 0x80, 0x1, 0x80, 0x2,
+ /* mpc */ 0x0, 0x2, 0x0, 0x2,
+ /* num */ 0x3,
+ /* tuples */ 0x40, 0x3, 0x80, 0x1, 0x80, 0x2,
+ },
+ 35,
+ SHOULD_ERR},
+ /* 17 */
+ {
+ "ORFnu",
+ "ORF, multi entry/tuple, entry number too long",
{
- "AS4",
- "AS4 capability: short",
- {0x41, 0x4, 0xab, 0xcd, 0xef}, /* AS: 2882400018 */
- 5,
- SHOULD_ERR,
+ /* hdr */ 0x3, 0x21,
+ /* mpc */ 0x0, 0x1, 0x0, 0x1,
+ /* num */ 0x3,
+ /* tuples */ 0x40, 0x3, 0x80, 0x1, 0x80, 0x2,
+ /* mpc */ 0x0, 0x2, 0x0, 0x1,
+ /* num */ 0x4,
+ /* tuples */ 0x40, 0x3, 0x80, 0x1, 0x80, 0x2,
+ /* mpc */ 0x0, 0x2, 0x0, 0x2,
+ /* num */ 0x3,
+ /* tuples */ 0x40, 0x3, 0x80, 0x1, 0x80, 0x2,
},
+ 35,
+ SHOULD_PARSE, /* parses, but last few tuples should be
+ gibberish */
+ },
+ /* 18 */
+ {
+ "ORFno",
+ "ORF, multi entry/tuple, entry number too short",
{
- "AS4",
- "AS4 capability: long",
- {0x41, 0x4, 0xab, 0xcd, 0xef, 0x12, 0x12},
- 7,
- SHOULD_ERR,
- 2882400018,
+ /* hdr */ 0x3, 0x21,
+ /* mpc */ 0x0, 0x1, 0x0, 0x1,
+ /* num */ 0x3,
+ /* tuples */ 0x40, 0x3, 0x80, 0x1, 0x80, 0x2,
+ /* mpc */ 0x0, 0x2, 0x0, 0x1,
+ /* num */ 0x1,
+ /* tuples */ 0x40, 0x3, 0x80, 0x1, 0x80, 0x2,
+ /* mpc */ 0x0, 0x2, 0x0, 0x2,
+ /* num */ 0x3,
+ /* tuples */ 0x40, 0x3, 0x80, 0x1, 0x80, 0x2,
},
+ 35,
+ SHOULD_PARSE, /* Parses, but should get gibberish
+ afi/safis */
+ },
+ /* 17 */
+ {
+ "ORFpad",
+ "ORF, multi entry/tuple, padded to align",
{
- "GR",
- "GR capability",
- {
- /* hdr */ CAPABILITY_CODE_RESTART, 0xe,
- /* R-bit, time */ 0xf1, 0x12,
- /* afi */ 0x0, 0x1,
- /* safi */ 0x1,
- /* flags */ 0xf,
- /* afi */ 0x0, 0x2,
- /* safi */ 0x1,
- /* flags */ 0x0,
- /* afi */ 0x0, 0x2,
- /* safi */ 0x2,
- /* flags */ 0x1,
- },
- 16,
- SHOULD_PARSE,
+ /* hdr */ 0x3,
+ 0x22,
+ /* mpc */ 0x0,
+ 0x1,
+ 0x0,
+ 0x1,
+ /* num */ 0x3,
+ /* tuples */ 0x40,
+ 0x3,
+ 0x80,
+ 0x1,
+ 0x80,
+ 0x2,
+ /* mpc */ 0x0,
+ 0x2,
+ 0x0,
+ 0x1,
+ /* num */ 0x3,
+ /* tuples */ 0x40,
+ 0x3,
+ 0x80,
+ 0x1,
+ 0x80,
+ 0x2,
+ /* mpc */ 0x0,
+ 0x2,
+ 0x0,
+ 0x2,
+ /* num */ 0x3,
+ /* tuples */ 0x40,
+ 0x3,
+ 0x80,
+ 0x1,
+ 0x80,
+ 0x2,
+ 0x00,
},
+ 36,
+ SHOULD_PARSE,
+ },
+ /* 19 */
+ {
+ "AS4",
+ "AS4 capability",
+ {0x41, 0x4, 0xab, 0xcd, 0xef, 0x12}, /* AS: 2882400018 */
+ 6,
+ SHOULD_PARSE,
+ 2882400018,
+ },
+ {
+ "AS4",
+ "AS4 capability: short",
+ {0x41, 0x4, 0xab, 0xcd, 0xef}, /* AS: 2882400018 */
+ 5,
+ SHOULD_ERR,
+ },
+ {
+ "AS4",
+ "AS4 capability: long",
+ {0x41, 0x4, 0xab, 0xcd, 0xef, 0x12, 0x12},
+ 7,
+ SHOULD_ERR,
+ 2882400018,
+ },
+ {
+ "GR",
+ "GR capability",
{
- "GR-short",
- "GR capability, but header length too short",
- {
- /* hdr */ 0x40, 0xa,
- /* R-bit, time */ 0xf1, 0x12,
- /* afi */ 0x0, 0x1,
- /* safi */ 0x1,
- /* flags */ 0xf,
- /* afi */ 0x0, 0x2,
- /* safi */ 0x1,
- /* flags */ 0x0,
- /* afi */ 0x0, 0x2,
- /* safi */ 0x2,
- /* flags */ 0x1,
- },
- 15 /* array is 16 though */,
- SHOULD_ERR,
+ /* hdr */ CAPABILITY_CODE_RESTART,
+ 0xe,
+ /* R-bit, time */ 0xf1,
+ 0x12,
+ /* afi */ 0x0,
+ 0x1,
+ /* safi */ 0x1,
+ /* flags */ 0xf,
+ /* afi */ 0x0,
+ 0x2,
+ /* safi */ 0x1,
+ /* flags */ 0x0,
+ /* afi */ 0x0,
+ 0x2,
+ /* safi */ 0x2,
+ /* flags */ 0x1,
},
+ 16,
+ SHOULD_PARSE,
+ },
+ {
+ "GR-short",
+ "GR capability, but header length too short",
{
- "GR-long",
- "GR capability, but header length too long",
- {
- /* hdr */ 0x40, 0xf,
- /* R-bit, time */ 0xf1, 0x12,
- /* afi */ 0x0, 0x1,
- /* safi */ 0x1,
- /* flags */ 0xf,
- /* afi */ 0x0, 0x2,
- /* safi */ 0x1,
- /* flags */ 0x0,
- /* afi */ 0x0, 0x2,
- /* safi */ 0x2,
- /* flags */ 0x01,
- },
- 16,
- SHOULD_ERR,
+ /* hdr */ 0x40,
+ 0xa,
+ /* R-bit, time */ 0xf1,
+ 0x12,
+ /* afi */ 0x0,
+ 0x1,
+ /* safi */ 0x1,
+ /* flags */ 0xf,
+ /* afi */ 0x0,
+ 0x2,
+ /* safi */ 0x1,
+ /* flags */ 0x0,
+ /* afi */ 0x0,
+ 0x2,
+ /* safi */ 0x2,
+ /* flags */ 0x1,
},
+ 15 /* array is 16 though */,
+ SHOULD_ERR,
+ },
+ {
+ "GR-long",
+ "GR capability, but header length too long",
{
- "GR-trunc",
- "GR capability, but truncated",
- {
- /* hdr */ 0x40, 0xf,
- /* R-bit, time */ 0xf1, 0x12,
- /* afi */ 0x0, 0x1,
- /* safi */ 0x1,
- /* flags */ 0xf,
- /* afi */ 0x0, 0x2,
- /* safi */ 0x1,
- /* flags */ 0x0,
- /* afi */ 0x0, 0x2,
- /* safi */ 0x2,
- /* flags */ 0x1,
- },
- 15,
- SHOULD_ERR,
+ /* hdr */ 0x40,
+ 0xf,
+ /* R-bit, time */ 0xf1,
+ 0x12,
+ /* afi */ 0x0,
+ 0x1,
+ /* safi */ 0x1,
+ /* flags */ 0xf,
+ /* afi */ 0x0,
+ 0x2,
+ /* safi */ 0x1,
+ /* flags */ 0x0,
+ /* afi */ 0x0,
+ 0x2,
+ /* safi */ 0x2,
+ /* flags */ 0x01,
},
+ 16,
+ SHOULD_ERR,
+ },
+ {
+ "GR-trunc",
+ "GR capability, but truncated",
{
- "GR-empty",
- "GR capability, but empty.",
- {
- /* hdr */ 0x40, 0x0,
- },
- 2,
- SHOULD_ERR,
+ /* hdr */ 0x40,
+ 0xf,
+ /* R-bit, time */ 0xf1,
+ 0x12,
+ /* afi */ 0x0,
+ 0x1,
+ /* safi */ 0x1,
+ /* flags */ 0xf,
+ /* afi */ 0x0,
+ 0x2,
+ /* safi */ 0x1,
+ /* flags */ 0x0,
+ /* afi */ 0x0,
+ 0x2,
+ /* safi */ 0x2,
+ /* flags */ 0x1,
},
+ 15,
+ SHOULD_ERR,
+ },
+ {
+ "GR-empty",
+ "GR capability, but empty.",
{
- "MP-empty",
- "MP capability, but empty.",
- {
- /* hdr */ 0x1, 0x0,
- },
- 2,
- SHOULD_ERR,
+ /* hdr */ 0x40,
+ 0x0,
},
+ 2,
+ SHOULD_ERR,
+ },
+ {
+ "MP-empty",
+ "MP capability, but empty.",
{
- "ORF-empty",
- "ORF capability, but empty.",
- {
- /* hdr */ 0x3, 0x0,
- },
- 2,
- SHOULD_ERR,
+ /* hdr */ 0x1,
+ 0x0,
},
+ 2,
+ SHOULD_ERR,
+ },
+ {
+ "ORF-empty",
+ "ORF capability, but empty.",
{
- "AS4-empty",
- "AS4 capability, but empty.",
- {
- /* hdr */ 0x41, 0x0,
- },
- 2,
- SHOULD_ERR,
+ /* hdr */ 0x3,
+ 0x0,
},
+ 2,
+ SHOULD_ERR,
+ },
+ {
+ "AS4-empty",
+ "AS4 capability, but empty.",
{
- "dyn-empty",
- "Dynamic capability, but empty.",
- {
- /* hdr */ 0x42, 0x0,
- },
- 2,
- SHOULD_PARSE,
+ /* hdr */ 0x41,
+ 0x0,
},
+ 2,
+ SHOULD_ERR,
+ },
+ {
+ "dyn-empty",
+ "Dynamic capability, but empty.",
{
- "dyn-old",
- "Dynamic capability (deprecated version)",
- {CAPABILITY_CODE_DYNAMIC, 0x0},
- 2,
- SHOULD_PARSE,
+ /* hdr */ 0x42,
+ 0x0,
},
- {NULL, NULL, {0}, 0, 0}};
+ 2,
+ SHOULD_PARSE,
+ },
+ {
+ "dyn-old",
+ "Dynamic capability (deprecated version)",
+ {CAPABILITY_CODE_DYNAMIC, 0x0},
+ 2,
+ SHOULD_PARSE,
+ },
+ {NULL, NULL, {0}, 0, 0}};
/* DYNAMIC message */
struct test_segment dynamic_cap_msgs[] = {
failed++;
if (tty)
- printf("%s",
- (failed > oldfailed) ? VT100_RED "failed!" VT100_RESET
- : VT100_GREEN "OK" VT100_RESET);
+ printf("%s", (failed > oldfailed)
+ ? VT100_RED "failed!" VT100_RESET
+ : VT100_GREEN "OK" VT100_RESET);
else
printf("%s", (failed > oldfailed) ? "failed!" : "OK");
/* Nexthop */ 192, 168, 0, 1,
/* SNPA (defunct, MBZ) */ 0x0,
/* NLRI tuples */ 88 + 16, 0, 1, 2, /* tag */
- /* rd, 8 octets */
- 0, 0, /* RD_TYPE_AS */
- 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */
- 10, 1, /* 10.1/16 */
- 88 + 17, 0xff, 0, 0, /* tag */
- /* rd, 8 octets */
- 0, 0, /* RD_TYPE_IP */
- 192, 168, 0, 1, /* IPv4 */
- 10, 2, 3, /* 10.2.3/17 */
+ /* rd, 8 octets */
+ 0, 0, /* RD_TYPE_AS */
+ 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */
+ 10, 1, /* 10.1/16 */
+ 88 + 17, 0xff, 0, 0, /* tag */
+ /* rd, 8 octets */
+ 0, 0, /* RD_TYPE_IP */
+ 192, 168, 0, 1, /* IPv4 */
+ 10, 2, 3, /* 10.2.3/17 */
},
(4 + 12 + 1 + (1 + 3 + 8 + 2) + (1 + 3 + 8 + 3)),
SHOULD_PARSE,
/* Nexthop */ 192, 168, 0, 1,
/* SNPA (defunct, MBZ) */ 0x0,
/* NLRI tuples */ 88 + 32, 0, 1, 2, /* tag */
- /* rd, 8 octets */
- 0, 0, /* RD_TYPE_AS */
- 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */
- 10, 1, /* 10.1/16 */
- 88 + 17, 0xff, 0, 0, /* tag */
- /* rd, 8 octets */
- 0, 0, /* RD_TYPE_IP */
- 192, 168, 0, 1, /* IPv4 */
- 10, 2, 3, /* 10.2.3/17 */
+ /* rd, 8 octets */
+ 0, 0, /* RD_TYPE_AS */
+ 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */
+ 10, 1, /* 10.1/16 */
+ 88 + 17, 0xff, 0, 0, /* tag */
+ /* rd, 8 octets */
+ 0, 0, /* RD_TYPE_IP */
+ 192, 168, 0, 1, /* IPv4 */
+ 10, 2, 3, /* 10.2.3/17 */
},
(4 + 12 + 1 + (1 + 3 + 8 + 2) + (1 + 3 + 8 + 3)),
SHOULD_ERR,
/* Nexthop */ 192, 168, 0, 1,
/* SNPA (defunct, MBZ) */ 0x0,
/* NLRI tuples */ 88 + 16, 0, 1, 2, /* tag */
- /* rd, 8 octets */
- 0, 0, /* RD_TYPE_AS */
- 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */
- 10, 1, /* 10.1/16 */
- 88 + 17, 0xff, 0, 0, /* tag */
- /* rd, 8 octets */
- 0, 0, /* RD_TYPE_IP */
- 192, 168, 0, 1, /* IPv4 */
- 10, 2, 3, /* 10.2.3/17 */
- 88 + 1, /* bogus */
+ /* rd, 8 octets */
+ 0, 0, /* RD_TYPE_AS */
+ 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */
+ 10, 1, /* 10.1/16 */
+ 88 + 17, 0xff, 0, 0, /* tag */
+ /* rd, 8 octets */
+ 0, 0, /* RD_TYPE_IP */
+ 192, 168, 0, 1, /* IPv4 */
+ 10, 2, 3, /* 10.2.3/17 */
+ 88 + 1, /* bogus */
},
(4 + 12 + 1 + (1 + 3 + 8 + 2) + (1 + 3 + 8 + 3) + 1),
SHOULD_ERR,
/* Nexthop */ 192, 168, 0, 1,
/* SNPA (defunct, MBZ) */ 0x0,
/* NLRI tuples */ 88 + 16, 0, 1, 2, /* tag */
- /* rd, 8 octets */
- 0, 0, /* RD_TYPE_AS */
- 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */
- 10, 1, /* 10.1/16 */
- 88 + 2, 0xff, 0, 0, /* tag */
- /* rd, 8 octets */
- 0, 0, /* RD_TYPE_IP */
- 192, 168, 0, 1, /* IPv4 */
- 10, 2, 3, /* 10.2.3/17 */
+ /* rd, 8 octets */
+ 0, 0, /* RD_TYPE_AS */
+ 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */
+ 10, 1, /* 10.1/16 */
+ 88 + 2, 0xff, 0, 0, /* tag */
+ /* rd, 8 octets */
+ 0, 0, /* RD_TYPE_IP */
+ 192, 168, 0, 1, /* IPv4 */
+ 10, 2, 3, /* 10.2.3/17 */
},
(4 + 12 + 1 + (1 + 3 + 8 + 2) + (1 + 3 + 8 + 3)),
SHOULD_ERR,
/* Nexthop */ 192, 168, 0, 1,
/* SNPA (defunct, MBZ) */ 0x0,
/* NLRI tuples */ 88 + 16, 0, 1, 2, /* tag */
- /* rd, 8 octets */
- 0xff, 0, /* Bogus RD */
- 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */
- 10, 1, /* 10.1/16 */
- 88 + 17, 0xff, 0, 0, /* tag */
- /* rd, 8 octets */
- 0, 0, /* RD_TYPE_IP */
- 192, 168, 0, 1, /* IPv4 */
- 10, 2, 3, /* 10.2.3/17 */
+ /* rd, 8 octets */
+ 0xff, 0, /* Bogus RD */
+ 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */
+ 10, 1, /* 10.1/16 */
+ 88 + 17, 0xff, 0, 0, /* tag */
+ /* rd, 8 octets */
+ 0, 0, /* RD_TYPE_IP */
+ 192, 168, 0, 1, /* IPv4 */
+ 10, 2, 3, /* 10.2.3/17 */
},
(4 + 12 + 1 + (1 + 3 + 8 + 2) + (1 + 3 + 8 + 3)),
SHOULD_PARSE,
/* Nexthop */ 192, 168, 0, 1,
/* SNPA (defunct, MBZ) */ 0x0,
/* NLRI tuples */ 88 + 16, 0, 1, 2, /* tag */
- /* rd, 8 octets */
- 0, 0, /* RD_TYPE_AS */
- 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */
- 10, 1, /* 10.1/16 */
- 88 + 17, 0xff, 0, 0, /* tag */
- /* rd, 8 octets */
- 0, 0, /* RD_TYPE_IP */
- 192, 168, 0, 1, /* IPv4 */
- 10, 2, 3, /* 10.2.3/17 */
- 0 /* 0/0, bogus for vpnv4 ?? */
+ /* rd, 8 octets */
+ 0, 0, /* RD_TYPE_AS */
+ 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */
+ 10, 1, /* 10.1/16 */
+ 88 + 17, 0xff, 0, 0, /* tag */
+ /* rd, 8 octets */
+ 0, 0, /* RD_TYPE_IP */
+ 192, 168, 0, 1, /* IPv4 */
+ 10, 2, 3, /* 10.2.3/17 */
+ 0 /* 0/0, bogus for vpnv4 ?? */
},
(4 + 12 + 1 + (1 + 3 + 8 + 2) + (1 + 3 + 8 + 3) + 1),
SHOULD_ERR,
"IPv6-unreach2",
"IPV6 MP Unreach, 2 NLRIs",
{
- /* AFI / SAFI */ 0x0, AFI_IP6, SAFI_UNICAST,
- /* NLRI tuples */ 32, 0xff, 0xfe, 0x1,
- 0x2, /* fffe:102::/32 */
- 64, 0xff, 0xfe, 0x0, 0x1, /* fffe:1:2:3::/64 */
- 0x0, 0x2, 0x0, 0x3,
+ /* AFI / SAFI */ 0x0,
+ AFI_IP6,
+ SAFI_UNICAST,
+ /* NLRI tuples */ 32,
+ 0xff,
+ 0xfe,
+ 0x1,
+ 0x2, /* fffe:102::/32 */
+ 64,
+ 0xff,
+ 0xfe,
+ 0x0,
+ 0x1, /* fffe:1:2:3::/64 */
+ 0x0,
+ 0x2,
+ 0x0,
+ 0x3,
},
(3 + 5 + 9),
SHOULD_PARSE,
{
/* AFI / SAFI */ 0x0, AFI_IP, IANA_SAFI_MPLS_VPN,
/* NLRI tuples */ 88 + 16, 0, 1, 2, /* tag */
- /* rd, 8 octets */
- 0, 0, /* RD_TYPE_AS */
- 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */
- 10, 1, /* 10.1/16 */
- 88 + 17, 0xff, 0, 0, /* tag */
- /* rd, 8 octets */
- 0, 0, /* RD_TYPE_IP */
- 192, 168, 0, 1, /* IPv4 */
- 10, 2, 3, /* 10.2.3/17 */
+ /* rd, 8 octets */
+ 0, 0, /* RD_TYPE_AS */
+ 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */
+ 10, 1, /* 10.1/16 */
+ 88 + 17, 0xff, 0, 0, /* tag */
+ /* rd, 8 octets */
+ 0, 0, /* RD_TYPE_IP */
+ 192, 168, 0, 1, /* IPv4 */
+ 10, 2, 3, /* 10.2.3/17 */
},
(3 + (1 + 3 + 8 + 2) + (1 + 3 + 8 + 3)),
SHOULD_PARSE,
if (tty)
- printf("%s",
- (failed > oldfailed) ? VT100_RED "failed!" VT100_RESET
- : VT100_GREEN "OK" VT100_RESET);
+ printf("%s", (failed > oldfailed)
+ ? VT100_RED "failed!" VT100_RESET
+ : VT100_GREEN "OK" VT100_RESET);
else
printf("%s", (failed > oldfailed) ? "failed!" : "OK");
* Set up testcase vector
*/
testcase_t *all_tests[] = {
- &test_bgp_cfg_maximum_paths, &test_bgp_mp_list,
+ &test_bgp_cfg_maximum_paths,
+ &test_bgp_mp_list,
&test_bgp_info_mpath_update,
};
static char test_buf[32768];
static struct cmd_node bgp_node = {
- BGP_NODE, "%s(config-router)# ",
+ BGP_NODE,
+ "%s(config-router)# ",
};
static struct cmd_node rip_node = {
- RIP_NODE, "%s(config-router)# ",
+ RIP_NODE,
+ "%s(config-router)# ",
};
static struct cmd_node isis_node = {
- ISIS_NODE, "%s(config-router)# ",
+ ISIS_NODE,
+ "%s(config-router)# ",
};
static struct cmd_node interface_node = {
- INTERFACE_NODE, "%s(config-if)# ",
+ INTERFACE_NODE,
+ "%s(config-if)# ",
};
static struct cmd_node rmap_node = {RMAP_NODE, "%s(config-route-map)# "};
}
static int /* return checksum in low-order 16 bits */
- in_cksum_optimized(void *parg, int nbytes)
+in_cksum_optimized(void *parg, int nbytes)
{
u_short *ptr = parg;
register long sum; /* assumes long == 32 bits */
static int /* return checksum in low-order 16 bits */
- in_cksum_rfc(void *parg, int count)
+in_cksum_rfc(void *parg, int count)
/* from RFC 1071 */
{
u_short *addr = parg;
#include "memory_vty.h"
zebra_capabilities_t _caps_p[] = {
- ZCAP_NET_RAW, ZCAP_BIND, ZCAP_NET_ADMIN, ZCAP_DAC_OVERRIDE,
+ ZCAP_NET_RAW,
+ ZCAP_BIND,
+ ZCAP_NET_ADMIN,
+ ZCAP_DAC_OVERRIDE,
};
struct zebra_privs_t test_privs = {
static int cmp_timeval(const void *a, const void *b)
{
- const struct timeval *ta = *(struct timeval * const *)a;
- const struct timeval *tb = *(struct timeval * const *)b;
+ const struct timeval *ta = *(struct timeval *const *)a;
+ const struct timeval *tb = *(struct timeval *const *)b;
if (timercmp(ta, tb, <))
return -1;
if (ratio < 10)
ratio++;
- TVCALC(interval,
- ratio * (TVELEM(&after) - TVELEM(&before)
- + TVADJUST));
- TVCALC(maxinterval,
- TVELEM(&stopat) - TVELEM(&after)
- + TVADJUST);
+ TVCALC(interval, ratio
+ * (TVELEM(&after)
+ - TVELEM(&before)
+ + TVADJUST));
+ TVCALC(maxinterval, TVELEM(&stopat)
+ - TVELEM(&after)
+ + TVADJUST);
if (timercmp(&interval, &maxinterval, >))
interval = maxinterval;
case CMD_ERR_NO_MATCH:
fprintf(stderr, "line %d: %% Unknown command[%d]: %s",
lineno, vty->node, vty->buf);
- retcode =
- CMD_ERR_NO_MATCH; /* once we have an error, we
- remember & return that */
+ retcode = CMD_ERR_NO_MATCH; /* once we have an error, we
+ remember & return that */
break;
case CMD_ERR_INCOMPLETE:
fprintf(stderr,
/* Vty node structures. */
static struct cmd_node bgp_node = {
- BGP_NODE, "%s(config-router)# ",
+ BGP_NODE,
+ "%s(config-router)# ",
};
static struct cmd_node rip_node = {
- RIP_NODE, "%s(config-router)# ",
+ RIP_NODE,
+ "%s(config-router)# ",
};
static struct cmd_node isis_node = {
- ISIS_NODE, "%s(config-router)# ",
+ ISIS_NODE,
+ "%s(config-router)# ",
};
static struct cmd_node interface_node = {
- INTERFACE_NODE, "%s(config-if)# ",
+ INTERFACE_NODE,
+ "%s(config-if)# ",
};
static struct cmd_node ns_node = {
- NS_NODE, "%s(config-logical-router)# ",
+ NS_NODE,
+ "%s(config-logical-router)# ",
};
static struct cmd_node vrf_node = {
- VRF_NODE, "%s(config-vrf)# ",
+ VRF_NODE,
+ "%s(config-vrf)# ",
};
static struct cmd_node rmap_node = {RMAP_NODE, "%s(config-route-map)# "};
"%s(config-keychain-key)# "};
struct cmd_node link_params_node = {
- LINK_PARAMS_NODE, "%s(config-link-params)# ",
+ LINK_PARAMS_NODE,
+ "%s(config-link-params)# ",
};
/* Defined in lib/vty.c */
/* TODO Implement "no interface command in isisd. */
DEFSH(VTYSH_ZEBRA | VTYSH_RIPD | VTYSH_RIPNGD | VTYSH_OSPFD | VTYSH_OSPF6D
| VTYSH_EIGRPD,
- vtysh_no_interface_cmd, "no interface IFNAME", NO_STR
+ vtysh_no_interface_cmd, "no interface IFNAME",
+ NO_STR
"Delete a pseudo interface's configuration\n"
"Interface's name\n")
return CMD_SUCCESS;
}
-DEFSH(VTYSH_ZEBRA, vtysh_no_vrf_cmd, "no vrf NAME", NO_STR
+DEFSH(VTYSH_ZEBRA, vtysh_no_vrf_cmd, "no vrf NAME",
+ NO_STR
"Delete a pseudo vrf's configuration\n"
"VRF's name\n")
}
DEFUNSH(VTYSH_ALL, no_vtysh_log_stdout, no_vtysh_log_stdout_cmd,
- "no log stdout [LEVEL]", NO_STR
+ "no log stdout [LEVEL]",
+ NO_STR
"Logging control\n"
"Cancel logging to stdout\n"
"Logging level\n")
}
DEFUNSH(VTYSH_ALL, no_vtysh_log_file, no_vtysh_log_file_cmd,
- "no log file [FILENAME [LEVEL]]", NO_STR
+ "no log file [FILENAME [LEVEL]]",
+ NO_STR
"Logging control\n"
"Cancel logging to file\n"
"Logging file name\n"
}
DEFUNSH(VTYSH_ALL, no_vtysh_log_monitor, no_vtysh_log_monitor_cmd,
- "no log monitor [LEVEL]", NO_STR
+ "no log monitor [LEVEL]",
+ NO_STR
"Logging control\n"
"Disable terminal line (monitor) logging\n"
"Logging level\n")
}
DEFUNSH(VTYSH_ALL, no_vtysh_log_syslog, no_vtysh_log_syslog_cmd,
- "no log syslog [LEVEL]", NO_STR
+ "no log syslog [LEVEL]",
+ NO_STR
"Logging control\n"
"Cancel logging to syslog\n"
"Logging level\n")
}
DEFUNSH(VTYSH_ALL, no_vtysh_log_facility, no_vtysh_log_facility_cmd,
- "no log facility [FACILITY]", NO_STR
+ "no log facility [FACILITY]",
+ NO_STR
"Logging control\n"
"Reset syslog facility to default (daemon)\n"
"Syslog facility\n")
}
DEFUNSH_DEPRECATED(VTYSH_ALL, no_vtysh_log_trap, no_vtysh_log_trap_cmd,
- "no log trap [LEVEL]", NO_STR
+ "no log trap [LEVEL]",
+ NO_STR
"Logging control\n"
"Permit all logging information\n"
"Logging level\n")
}
DEFUNSH(VTYSH_ALL, no_vtysh_log_record_priority,
- no_vtysh_log_record_priority_cmd, "no log record-priority", NO_STR
+ no_vtysh_log_record_priority_cmd, "no log record-priority",
+ NO_STR
"Logging control\n"
"Do not log the priority of the message within the message\n")
{
}
DEFUNSH(VTYSH_ALL, no_vtysh_config_enable_password,
- no_vtysh_enable_password_cmd, "no enable password", NO_STR
+ no_vtysh_enable_password_cmd, "no enable password",
+ NO_STR
"Modify enable password parameters\n"
"Assign the privileged level password\n")
{
if (ret < 0) {
if (errno == EINVAL)
goto calculate_lifc_len; /* deliberately hold privileges
- */
+ */
zlog_warn("SIOCGLIFCONF: %s", safe_strerror(errno));
* XXX: RUNNING is not a settable flag
* on any system
* I (paulj) am aware of.
- */
+ */
if_set_flags(ifp, IFF_UP | IFF_RUNNING);
if_refresh(ifp);
}
struct cmd_node link_params_node = {
- LINK_PARAMS_NODE, "%s(config-link-params)# ", 1,
+ LINK_PARAMS_NODE,
+ "%s(config-link-params)# ",
+ 1,
};
static void link_param_cmd_set_uint32(struct interface *ifp, uint32_t *field,
int DefaultPreference;
#define RTADV_PREF_MEDIUM 0x0 /* Per RFC4191. */
- u_char inFastRexmit; /* True if we're rexmits faster than usual */
- u_char configured; /* Has operator configured RA? */
- int
- NumFastReXmitsRemain; /* Loaded first with number of fast
- rexmits to do */
+ u_char inFastRexmit; /* True if we're rexmits faster than usual */
+ u_char configured; /* Has operator configured RA? */
+ int NumFastReXmitsRemain; /* Loaded first with number of fast
+ rexmits to do */
#define RTADV_FAST_REXMIT_PERIOD 1 /* 1 sec */
#define RTADV_NUM_FAST_REXMITS 4 /* Fast Rexmit RA 4 times on certain events */
};
struct sock_fprog prog = {
- .len = array_size(filter), .filter = filter,
+ .len = array_size(filter),
+ .filter = filter,
};
if (setsockopt(sock, SOL_SOCKET, SO_ATTACH_FILTER, &prog, sizeof(prog))
assert((ifp->ifindex == ifan->ifan_index)
|| (ifp->ifindex == IFINDEX_INTERNAL));
- if ((ifp == NULL) || ((ifp->ifindex == IFINDEX_INTERNAL)
- && (ifan->ifan_what == IFAN_ARRIVAL))) {
+ if ((ifp == NULL)
+ || ((ifp->ifindex == IFINDEX_INTERNAL)
+ && (ifan->ifan_what == IFAN_ARRIVAL))) {
if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug(
"%s: creating interface for ifindex %d, name %s",
buf, gate_buf);
break;
case ZEBRA_RIB_FOUND_EXACT: /* RIB RR == FIB RR
- */
+ */
zlog_debug(
"%s: %s %s: done Ok", __func__,
lookup_msg(rtm_type_str,
{0}};
zebra_capabilities_t _caps_p[] = {
- ZCAP_NET_ADMIN, ZCAP_SYS_ADMIN, ZCAP_NET_RAW,
+ ZCAP_NET_ADMIN,
+ ZCAP_SYS_ADMIN,
+ ZCAP_NET_RAW,
};
/* zebra privileges to run with */
#ifdef HAVE_NETLINK
" -s, --nl-bufsize Set netlink receive buffer size\n"
#endif /* HAVE_NETLINK */
- );
+ );
while (1) {
int opt = frr_getopt(argc, argv, NULL);
zebra_ns_init();
/* Process the configuration file. Among other configuration
- * directives we can meet those installing static routes. Such
- * requests will not be executed immediately, but queued in
- * zebra->ribq structure until we enter the main execution loop.
- * The notifications from kernel will show originating PID equal
- * to that after daemon() completes (if ever called).
- */
+ * directives we can meet those installing static routes. Such
+ * requests will not be executed immediately, but queued in
+ * zebra->ribq structure until we enter the main execution loop.
+ * The notifications from kernel will show originating PID equal
+ * to that after daemon() completes (if ever called).
+ */
frr_config_fork();
/* Clean up rib -- before fork (?) */
/* rib_weed_tables (); */
/* After we have successfully acquired the pidfile, we can be sure
- * about being the only copy of zebra process, which is submitting
- * changes to the FIB.
- * Clean up zebra-originated routes. The requests will be sent to OS
- * immediately, so originating PID in notifications from kernel
- * will be equal to the current getpid(). To know about such routes,
- * we have to have route_read() called before.
- */
+ * about being the only copy of zebra process, which is submitting
+ * changes to the FIB.
+ * Clean up zebra-originated routes. The requests will be sent to OS
+ * immediately, so originating PID in notifications from kernel
+ * will be equal to the current getpid(). To know about such routes,
+ * we have to have route_read() called before.
+ */
if (!keep_kernel_mode)
rib_sweep_route();
for RL,
but not
for HAL*/
- );
+ );
len += sizeof(struct nd_opt_homeagent_info);
}
{
/* prelude */
char *prefix = argv[3]->arg;
- int lifetimes = (argc > 4) && (argv[4]->type == RANGE_TKN
- || strmatch(argv[4]->text, "infinite"));
+ int lifetimes = (argc > 4)
+ && (argv[4]->type == RANGE_TKN
+ || strmatch(argv[4]->text, "infinite"));
int routeropts = lifetimes ? argc > 6 : argc > 4;
int idx_routeropts = routeropts ? (lifetimes ? 6 : 4) : 0;
#define IS_ZEBRA_IF_BRIDGE_VLAN_AWARE(zif) ((zif)->l2info.br.vlan_aware == 1)
-
extern void zebra_l2_map_slave_to_bridge(struct zebra_l2info_brslave *br_slave);
extern void
zebra_l2_unmap_slave_from_bridge(struct zebra_l2info_brslave *br_slave);
* Add static FEC to label binding. If there are clients registered for this
* FEC, notify them. If there are labeled routes for this FEC, install the
* label forwarding entry.
-*/
+ */
int zebra_mpls_static_fec_add(struct zebra_vrf *zvrf, struct prefix *p,
mpls_label_t in_label)
{
if (use_json) {
json = lsp_json(lsp);
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
} else
lsp_print(lsp, (void *)vty);
json, label2str(lsp->ile.in_label, buf, BUFSIZ),
lsp_json(lsp));
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
} else {
vty_out(vty, " Inbound Outbound\n");
for (ALL_LIST_ELEMENTS_RO(vrf->iflist, i, ifp))
if (!ifp->ptm_enable) {
if_data = (struct zebra_if *)ifp->info;
- if (if_data && (if_data->ptm_enable
- == ZEBRA_IF_PTM_ENABLE_UNSPEC)) {
+ if (if_data
+ && (if_data->ptm_enable
+ == ZEBRA_IF_PTM_ENABLE_UNSPEC)) {
ifp->ptm_enable = ZEBRA_IF_PTM_ENABLE_ON;
}
/* Assign a default unknown status */
int key;
int distance;
} route_info[ZEBRA_ROUTE_MAX] = {
- [ZEBRA_ROUTE_SYSTEM] = {ZEBRA_ROUTE_SYSTEM, 0},
- [ZEBRA_ROUTE_KERNEL] = {ZEBRA_ROUTE_KERNEL, 0},
- [ZEBRA_ROUTE_CONNECT] = {ZEBRA_ROUTE_CONNECT, 0},
- [ZEBRA_ROUTE_STATIC] = {ZEBRA_ROUTE_STATIC, 1},
- [ZEBRA_ROUTE_RIP] = {ZEBRA_ROUTE_RIP, 120},
- [ZEBRA_ROUTE_RIPNG] = {ZEBRA_ROUTE_RIPNG, 120},
- [ZEBRA_ROUTE_OSPF] = {ZEBRA_ROUTE_OSPF, 110},
- [ZEBRA_ROUTE_OSPF6] = {ZEBRA_ROUTE_OSPF6, 110},
- [ZEBRA_ROUTE_ISIS] = {ZEBRA_ROUTE_ISIS, 115},
- [ZEBRA_ROUTE_BGP] = {ZEBRA_ROUTE_BGP, 20 /* IBGP is 200. */},
- [ZEBRA_ROUTE_NHRP] = {ZEBRA_ROUTE_NHRP, 10},
+ [ZEBRA_ROUTE_SYSTEM] = {ZEBRA_ROUTE_SYSTEM, 0},
+ [ZEBRA_ROUTE_KERNEL] = {ZEBRA_ROUTE_KERNEL, 0},
+ [ZEBRA_ROUTE_CONNECT] = {ZEBRA_ROUTE_CONNECT, 0},
+ [ZEBRA_ROUTE_STATIC] = {ZEBRA_ROUTE_STATIC, 1},
+ [ZEBRA_ROUTE_RIP] = {ZEBRA_ROUTE_RIP, 120},
+ [ZEBRA_ROUTE_RIPNG] = {ZEBRA_ROUTE_RIPNG, 120},
+ [ZEBRA_ROUTE_OSPF] = {ZEBRA_ROUTE_OSPF, 110},
+ [ZEBRA_ROUTE_OSPF6] = {ZEBRA_ROUTE_OSPF6, 110},
+ [ZEBRA_ROUTE_ISIS] = {ZEBRA_ROUTE_ISIS, 115},
+ [ZEBRA_ROUTE_BGP] = {ZEBRA_ROUTE_BGP, 20 /* IBGP is 200. */},
+ [ZEBRA_ROUTE_NHRP] = {ZEBRA_ROUTE_NHRP, 10},
/* no entry/default: 150 */
};
/* Buffer ROUTE_ENTRY_CHANGED here, because it will get cleared if
* fib == selected */
- bool selected_changed = new_selected && CHECK_FLAG(new_selected->status,
- ROUTE_ENTRY_CHANGED);
+ bool selected_changed =
+ new_selected
+ && CHECK_FLAG(new_selected->status, ROUTE_ENTRY_CHANGED);
/* Update fib according to selection results */
if (new_fib && old_fib)
* Map from rib types to queue type (priority) in meta queue
*/
static const u_char meta_queue_map[ZEBRA_ROUTE_MAX] = {
- [ZEBRA_ROUTE_SYSTEM] = 4,
- [ZEBRA_ROUTE_KERNEL] = 0,
- [ZEBRA_ROUTE_CONNECT] = 0,
- [ZEBRA_ROUTE_STATIC] = 1,
- [ZEBRA_ROUTE_RIP] = 2,
- [ZEBRA_ROUTE_RIPNG] = 2,
- [ZEBRA_ROUTE_OSPF] = 2,
- [ZEBRA_ROUTE_OSPF6] = 2,
- [ZEBRA_ROUTE_ISIS] = 2,
- [ZEBRA_ROUTE_BGP] = 3,
- [ZEBRA_ROUTE_PIM] = 4, // Shouldn't happen but for safety
- [ZEBRA_ROUTE_EIGRP] = 2,
- [ZEBRA_ROUTE_NHRP] = 2,
- [ZEBRA_ROUTE_HSLS] = 4,
- [ZEBRA_ROUTE_OLSR] = 4,
- [ZEBRA_ROUTE_TABLE] = 1,
- [ZEBRA_ROUTE_LDP] = 4,
- [ZEBRA_ROUTE_VNC] = 3,
- [ZEBRA_ROUTE_VNC_DIRECT] = 3,
- [ZEBRA_ROUTE_VNC_DIRECT_RH] = 3,
- [ZEBRA_ROUTE_BGP_DIRECT] = 3,
- [ZEBRA_ROUTE_BGP_DIRECT_EXT] = 3,
- [ZEBRA_ROUTE_BABEL] = 2,
- [ZEBRA_ROUTE_ALL] = 4, // Shouldn't happen but for safety
+ [ZEBRA_ROUTE_SYSTEM] = 4,
+ [ZEBRA_ROUTE_KERNEL] = 0,
+ [ZEBRA_ROUTE_CONNECT] = 0,
+ [ZEBRA_ROUTE_STATIC] = 1,
+ [ZEBRA_ROUTE_RIP] = 2,
+ [ZEBRA_ROUTE_RIPNG] = 2,
+ [ZEBRA_ROUTE_OSPF] = 2,
+ [ZEBRA_ROUTE_OSPF6] = 2,
+ [ZEBRA_ROUTE_ISIS] = 2,
+ [ZEBRA_ROUTE_BGP] = 3,
+ [ZEBRA_ROUTE_PIM] = 4, // Shouldn't happen but for safety
+ [ZEBRA_ROUTE_EIGRP] = 2,
+ [ZEBRA_ROUTE_NHRP] = 2,
+ [ZEBRA_ROUTE_HSLS] = 4,
+ [ZEBRA_ROUTE_OLSR] = 4,
+ [ZEBRA_ROUTE_TABLE] = 1,
+ [ZEBRA_ROUTE_LDP] = 4,
+ [ZEBRA_ROUTE_VNC] = 3,
+ [ZEBRA_ROUTE_VNC_DIRECT] = 3,
+ [ZEBRA_ROUTE_VNC_DIRECT_RH] = 3,
+ [ZEBRA_ROUTE_BGP_DIRECT] = 3,
+ [ZEBRA_ROUTE_BGP_DIRECT_EXT] = 3,
+ [ZEBRA_ROUTE_BABEL] = 2,
+ [ZEBRA_ROUTE_ALL] = 4, // Shouldn't happen but for safety
};
/* Look into the RN and queue it into one or more priority queues,
family2afi(afi), gate,
buf2,
INET_ADDRSTRLEN), /* FIXME
- */
+ */
ifindex, type);
else
rnode_debug(
struct route_entry *state;
struct prefix resolved_route;
struct list *client_list;
- struct list *
- zebra_static_route_list; /* static routes dependent on this NH
- */
+ struct list
+ *zebra_static_route_list; /* static routes dependent on this NH
+ */
struct route_node *node;
int filtered[ZEBRA_ROUTE_MAX]; /* if this has been filtered for client
- */
+ */
};
typedef enum { RNH_NEXTHOP_TYPE, RNH_IMPORT_CHECK_TYPE } rnh_type_t;
/* Route map commands for tag matching */
static struct route_map_rule_cmd route_match_tag_cmd = {
- "tag", route_match_tag, route_map_rule_tag_compile,
+ "tag",
+ route_match_tag,
+ route_map_rule_tag_compile,
route_map_rule_tag_free,
};
/* Set src rule structure. */
static struct route_map_rule_cmd route_set_src_cmd = {
- "src", route_set_src, route_set_src_compile, route_set_src_free,
+ "src",
+ route_set_src,
+ route_set_src_compile,
+ route_set_src_free,
};
static int zebra_route_map_update_timer(struct thread *thread)
if (!stable)
return -1;
- if (!gate && (type == STATIC_IPV4_GATEWAY || type == STATIC_IPV6_GATEWAY
- || type == STATIC_IPV6_GATEWAY_IFINDEX))
+ if (!gate
+ && (type == STATIC_IPV4_GATEWAY || type == STATIC_IPV6_GATEWAY
+ || type == STATIC_IPV6_GATEWAY_IFINDEX))
return -1;
if (!ifindex
/* Do nothing if there is a same static route. */
for (si = rn->info; si; si = si->next) {
if (type == si->type
- && (!gate || ((afi == AFI_IP
- && IPV4_ADDR_SAME(gate, &si->addr.ipv4))
- || (afi == AFI_IP6
- && IPV6_ADDR_SAME(gate, &si->addr.ipv6))))
+ && (!gate
+ || ((afi == AFI_IP
+ && IPV4_ADDR_SAME(gate, &si->addr.ipv4))
+ || (afi == AFI_IP6
+ && IPV6_ADDR_SAME(gate, &si->addr.ipv6))))
&& (!ifindex || ifindex == si->ifindex)) {
if ((distance == si->distance) && (tag == si->tag)
&& !memcmp(&si->snh_label, snh_label,
/* Find same static route is the tree */
for (si = rn->info; si; si = si->next)
if (type == si->type
- && (!gate || ((afi == AFI_IP
- && IPV4_ADDR_SAME(gate, &si->addr.ipv4))
- || (afi == AFI_IP6
- && IPV6_ADDR_SAME(gate, &si->addr.ipv6))))
+ && (!gate
+ || ((afi == AFI_IP
+ && IPV4_ADDR_SAME(gate, &si->addr.ipv4))
+ || (afi == AFI_IP6
+ && IPV6_ADDR_SAME(gate, &si->addr.ipv6))))
&& (!ifindex || ifindex == si->ifindex)
&& (!tag || (tag == si->tag))
&& (!snh_label->num_labels
}
if (use_json) {
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
}
"FIB", zvrf_name(((rib_table_info_t *)table->info)->zvrf));
for (i = 0; i < ZEBRA_ROUTE_MAX; i++) {
- if ((rib_cnt[i] > 0) || (i == ZEBRA_ROUTE_BGP
- && rib_cnt[ZEBRA_ROUTE_IBGP] > 0)) {
+ if ((rib_cnt[i] > 0)
+ || (i == ZEBRA_ROUTE_BGP
+ && rib_cnt[ZEBRA_ROUTE_IBGP] > 0)) {
if (i == ZEBRA_ROUTE_BGP) {
vty_out(vty, "%-20s %-20d %-20d \n", "ebgp",
rib_cnt[ZEBRA_ROUTE_BGP],
wctx.flags = DEL_REMOTE_MAC_FROM_VTEP;
wctx.r_vtep_ip = *r_vtep_ip;
- hash_iterate(zvni->mac_table, (void (*)(struct hash_backet *,
- void *))zvni_mac_del_hash_entry,
- &wctx);
+ hash_iterate(
+ zvni->mac_table,
+ (void (*)(struct hash_backet *, void *))zvni_mac_del_hash_entry,
+ &wctx);
}
/*
wctx.upd_client = upd_client;
wctx.flags = flags;
- hash_iterate(zvni->mac_table, (void (*)(struct hash_backet *,
- void *))zvni_mac_del_hash_entry,
- &wctx);
+ hash_iterate(
+ zvni->mac_table,
+ (void (*)(struct hash_backet *, void *))zvni_mac_del_hash_entry,
+ &wctx);
}
/*
send_del = 1;
} else if (ext_learned)
/* The neighbor is remote and that is the notification we got.
- */
+ */
{
/* TODO: Evaluate if we need to do anything here. */
return 0;
if (flags
&& !CHECK_FLAG(rnh->flags, ZEBRA_NHT_EXACT_MATCH))
SET_FLAG(rnh->flags, ZEBRA_NHT_EXACT_MATCH);
- else if (!flags && CHECK_FLAG(rnh->flags,
- ZEBRA_NHT_EXACT_MATCH))
+ else if (!flags
+ && CHECK_FLAG(rnh->flags,
+ ZEBRA_NHT_EXACT_MATCH))
UNSET_FLAG(rnh->flags, ZEBRA_NHT_EXACT_MATCH);
}
RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
{
struct zebra_vrf *zvrf = vrf->info;
- vty_out(vty, "%-25s %10" PRIu64 " %10" PRIu64 " %10" PRIu64
- " %10" PRIu64 " %10" PRIu64 "\n",
+ vty_out(vty,
+ "%-25s %10" PRIu64 " %10" PRIu64 " %10" PRIu64
+ " %10" PRIu64 " %10" PRIu64 "\n",
vrf->name, zvrf->installs, zvrf->removals,
zvrf->neigh_updates, zvrf->lsp_installs,
zvrf->lsp_removals);