diff options
54 files changed, 1018 insertions, 1900 deletions
diff --git a/Makefile.am b/Makefile.am index 166ac29d1c..851cefc85c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -40,6 +40,12 @@ shvar-%: var-%: @echo "$($*)" >&$(VARFD) +if ONLY_CLIPPY +.DEFAULT_GOAL := clippy-only +endif +clippy-only: Makefile lib/clippy config.h +.PHONY: clippy-only + # overwriting these vars breaks cross-compilation. let's be helpful and warn. # # note: "#AUTODERP# " will be removed from Makefile by configure. These are diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index 5a4105b400..d46623c9d2 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -1664,8 +1664,9 @@ int bgp_mp_reach_parse(struct bgp_attr_parser_args *args, */ if (bgp_debug_update(peer, NULL, NULL, 0)) zlog_debug( - "%s: MP_REACH received AFI %u or SAFI %u is unrecognized", - peer->host, pkt_afi, pkt_safi); + "%s: MP_REACH received AFI %s or SAFI %s is unrecognized", + peer->host, iana_afi2str(pkt_afi), + iana_safi2str(pkt_safi)); return BGP_ATTR_PARSE_ERROR; } @@ -1849,8 +1850,9 @@ int bgp_mp_unreach_parse(struct bgp_attr_parser_args *args, */ if (bgp_debug_update(peer, NULL, NULL, 0)) zlog_debug( - "%s: MP_UNREACH received AFI %u or SAFI %u is unrecognized", - peer->host, pkt_afi, pkt_safi); + "%s: MP_UNREACH received AFI %s or SAFI %s is unrecognized", + peer->host, iana_afi2str(pkt_afi), + iana_safi2str(pkt_safi)); return BGP_ATTR_PARSE_ERROR; } diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 6eddd0e1e3..355bc93320 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -1488,7 +1488,8 @@ static void vpn_policy_routemap_update(struct bgp *bgp, const char *rmap_name) /* This API is used during router-id change, reflect VPNs * auto RD and RT values and readvertise routes to VPN table. */ -void vpn_handle_router_id_update(struct bgp *bgp, bool withdraw) +void vpn_handle_router_id_update(struct bgp *bgp, bool withdraw, + bool is_config) { afi_t afi; int debug; @@ -1536,6 +1537,20 @@ void vpn_handle_router_id_update(struct bgp *bgp, bool withdraw) } } else { + /* + * Router-id changes that are not explicit config + * changes should not replace configured RD/RT. + */ + if (!is_config) { + if (CHECK_FLAG(bgp->vpn_policy[afi].flags, + BGP_VPN_POLICY_TOVPN_RD_SET)) { + if (debug) + zlog_debug("%s: auto router-id change skipped", + __func__); + goto postchange; + } + } + /* New router-id derive auto RD and RT and export * to VPN */ @@ -1565,6 +1580,8 @@ void vpn_handle_router_id_update(struct bgp *bgp, bool withdraw) = ecommunity_dup(ecom); } + +postchange: /* Update routes to VPN */ vpn_leak_postchange(BGP_VPN_POLICY_DIR_TOVPN, afi, bgp_get_default(), diff --git a/bgpd/bgp_mplsvpn.h b/bgpd/bgp_mplsvpn.h index 1526a8111e..2a6c0e1708 100644 --- a/bgpd/bgp_mplsvpn.h +++ b/bgpd/bgp_mplsvpn.h @@ -264,6 +264,7 @@ extern void vpn_policy_routemap_event(const char *rmap_name); extern vrf_id_t get_first_vrf_for_redirect_with_rt(struct ecommunity *eckey); extern void vpn_leak_postchange_all(void); -extern void vpn_handle_router_id_update(struct bgp *bgp, bool withdraw); +extern void vpn_handle_router_id_update(struct bgp *bgp, bool withdraw, + bool is_config); #endif /* _QUAGGA_BGP_MPLSVPN_H */ diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c index 7af5827d00..64529f6ef3 100644 --- a/bgpd/bgp_open.c +++ b/bgpd/bgp_open.c @@ -264,8 +264,9 @@ static int bgp_capability_mp(struct peer *peer, struct capability_header *hdr) bgp_capability_mp_data(s, &mpc); if (bgp_debug_neighbor_events(peer)) - zlog_debug("%s OPEN has MP_EXT CAP for afi/safi: %u/%u", - peer->host, mpc.afi, mpc.safi); + zlog_debug("%s OPEN has MP_EXT CAP for afi/safi: %s/%s", + peer->host, iana_afi2str(mpc.afi), + iana_safi2str(mpc.safi)); /* Convert AFI, SAFI to internal values, check. */ if (bgp_map_afi_safi_iana2int(mpc.afi, mpc.safi, &afi, &safi)) @@ -325,8 +326,8 @@ static int bgp_capability_orf_entry(struct peer *peer, pkt_safi = mpc.safi; if (bgp_debug_neighbor_events(peer)) - zlog_debug("%s ORF Cap entry for afi/safi: %u/%u", peer->host, - mpc.afi, mpc.safi); + zlog_debug("%s ORF Cap entry for afi/safi: %s/%s", peer->host, + iana_afi2str(mpc.afi), iana_safi2str(mpc.safi)); /* Convert AFI, SAFI to internal values, check. */ if (bgp_map_afi_safi_iana2int(pkt_afi, pkt_safi, &afi, &safi)) { @@ -407,11 +408,11 @@ static int bgp_capability_orf_entry(struct peer *peer, if (bgp_debug_neighbor_events(peer)) zlog_debug( "%s OPEN has %s ORF capability" - " as %s for afi/safi: %d/%d", + " as %s for afi/safi: %s/%s", peer->host, lookup_msg(orf_type_str, type, NULL), - lookup_msg(orf_mode_str, mode, NULL), pkt_afi, - pkt_safi); + lookup_msg(orf_mode_str, mode, NULL), + iana_afi2str(pkt_afi), iana_safi2str(pkt_safi)); if (hdr->code == CAPABILITY_CODE_ORF) { sm_cap = PEER_CAP_ORF_PREFIX_SM_RCV; @@ -487,15 +488,17 @@ static int bgp_capability_restart(struct peer *peer, if (bgp_map_afi_safi_iana2int(pkt_afi, pkt_safi, &afi, &safi)) { if (bgp_debug_neighbor_events(peer)) zlog_debug( - "%s Addr-family %d/%d(afi/safi) not supported." + "%s Addr-family %s/%s(afi/safi) not supported." " Ignore the Graceful Restart capability for this AFI/SAFI", - peer->host, pkt_afi, pkt_safi); + peer->host, iana_afi2str(pkt_afi), + iana_safi2str(pkt_safi)); } else if (!peer->afc[afi][safi]) { if (bgp_debug_neighbor_events(peer)) zlog_debug( - "%s Addr-family %d/%d(afi/safi) not enabled." + "%s Addr-family %s/%s(afi/safi) not enabled." " Ignore the Graceful Restart capability", - peer->host, pkt_afi, pkt_safi); + peer->host, iana_afi2str(pkt_afi), + iana_safi2str(pkt_safi)); } else { if (bgp_debug_neighbor_events(peer)) zlog_debug( @@ -564,8 +567,9 @@ static int bgp_capability_addpath(struct peer *peer, if (bgp_debug_neighbor_events(peer)) zlog_debug( - "%s OPEN has AddPath CAP for afi/safi: %u/%u%s%s", - peer->host, pkt_afi, pkt_safi, + "%s OPEN has AddPath CAP for afi/safi: %s/%s%s%s", + peer->host, iana_afi2str(pkt_afi), + iana_safi2str(pkt_safi), (send_receive & BGP_ADDPATH_RX) ? ", receive" : "", (send_receive & BGP_ADDPATH_TX) ? ", transmit" @@ -575,16 +579,18 @@ static int bgp_capability_addpath(struct peer *peer, if (bgp_map_afi_safi_iana2int(pkt_afi, pkt_safi, &afi, &safi)) { if (bgp_debug_neighbor_events(peer)) zlog_debug( - "%s Addr-family %d/%d(afi/safi) not supported." + "%s Addr-family %s/%s(afi/safi) not supported." " Ignore the Addpath Attribute for this AFI/SAFI", - peer->host, pkt_afi, pkt_safi); + peer->host, iana_afi2str(pkt_afi), + iana_safi2str(pkt_safi)); continue; } else if (!peer->afc[afi][safi]) { if (bgp_debug_neighbor_events(peer)) zlog_debug( - "%s Addr-family %d/%d(afi/safi) not enabled." + "%s Addr-family %s/%s(afi/safi) not enabled." " Ignore the AddPath capability for this AFI/SAFI", - peer->host, pkt_afi, pkt_safi); + peer->host, iana_afi2str(pkt_afi), + iana_safi2str(pkt_safi)); continue; } @@ -624,16 +630,18 @@ static int bgp_capability_enhe(struct peer *peer, struct capability_header *hdr) if (bgp_debug_neighbor_events(peer)) zlog_debug( - "%s Received with afi/safi/next-hop afi: %u/%u/%u", - peer->host, pkt_afi, pkt_safi, pkt_nh_afi); + "%s Received with afi/safi/next-hop afi: %s/%s/%u", + peer->host, iana_afi2str(pkt_afi), + iana_safi2str(pkt_safi), pkt_nh_afi); /* Convert AFI, SAFI to internal values, check. */ if (bgp_map_afi_safi_iana2int(pkt_afi, pkt_safi, &afi, &safi)) { if (bgp_debug_neighbor_events(peer)) zlog_debug( - "%s Addr-family %d/%d(afi/safi) not supported." + "%s Addr-family %s/%s(afi/safi) not supported." " Ignore the ENHE Attribute for this AFI/SAFI", - peer->host, pkt_afi, pkt_safi); + peer->host, iana_afi2str(pkt_afi), + iana_safi2str(pkt_safi)); continue; } @@ -652,9 +660,10 @@ static int bgp_capability_enhe(struct peer *peer, struct capability_header *hdr) || safi == SAFI_LABELED_UNICAST)) { flog_warn( EC_BGP_CAPABILITY_INVALID_DATA, - "%s Unexpected afi/safi/next-hop afi: %u/%u/%u " + "%s Unexpected afi/safi/next-hop afi: %s/%s/%u " "in Extended Next-hop capability, ignoring", - peer->host, pkt_afi, pkt_safi, pkt_nh_afi); + peer->host, iana_afi2str(pkt_afi), + iana_safi2str(pkt_safi), pkt_nh_afi); continue; } diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index 655a4745cb..bb9c394047 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -822,12 +822,13 @@ void bgp_route_refresh_send(struct peer *peer, afi_t afi, safi_t safi, stream_putc(s, ORF_COMMON_PART_REMOVE_ALL); if (bgp_debug_neighbor_events(peer)) zlog_debug( - "%s sending REFRESH_REQ to remove ORF(%d) (%s) for afi/safi: %d/%d", + "%s sending REFRESH_REQ to remove ORF(%d) (%s) for afi/safi: %s/%s", peer->host, orf_type, (when_to_refresh == REFRESH_DEFER ? "defer" : "immediate"), - pkt_afi, pkt_safi); + iana_afi2str(pkt_afi), + iana_safi2str(pkt_safi)); } else { SET_FLAG(peer->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND); @@ -838,12 +839,13 @@ void bgp_route_refresh_send(struct peer *peer, afi_t afi, safi_t safi, ORF_COMMON_PART_DENY); if (bgp_debug_neighbor_events(peer)) zlog_debug( - "%s sending REFRESH_REQ with pfxlist ORF(%d) (%s) for afi/safi: %d/%d", + "%s sending REFRESH_REQ with pfxlist ORF(%d) (%s) for afi/safi: %s/%s", peer->host, orf_type, (when_to_refresh == REFRESH_DEFER ? "defer" : "immediate"), - pkt_afi, pkt_safi); + iana_afi2str(pkt_afi), + iana_safi2str(pkt_safi)); } /* Total ORF Entry Len. */ @@ -856,8 +858,9 @@ void bgp_route_refresh_send(struct peer *peer, afi_t afi, safi_t safi, if (bgp_debug_neighbor_events(peer)) { if (!orf_refresh) - zlog_debug("%s sending REFRESH_REQ for afi/safi: %d/%d", - peer->host, pkt_afi, pkt_safi); + zlog_debug("%s sending REFRESH_REQ for afi/safi: %s/%s", + peer->host, iana_afi2str(pkt_afi), + iana_safi2str(pkt_safi)); } /* Add packet to the peer. */ @@ -901,11 +904,11 @@ void bgp_capability_send(struct peer *peer, afi_t afi, safi_t safi, if (bgp_debug_neighbor_events(peer)) zlog_debug( - "%s sending CAPABILITY has %s MP_EXT CAP for afi/safi: %d/%d", + "%s sending CAPABILITY has %s MP_EXT CAP for afi/safi: %s/%s", peer->host, action == CAPABILITY_ACTION_SET ? "Advertising" : "Removing", - pkt_afi, pkt_safi); + iana_afi2str(pkt_afi), iana_safi2str(pkt_safi)); } /* Set packet size. */ @@ -1788,14 +1791,16 @@ static int bgp_route_refresh_receive(struct peer *peer, bgp_size_t size) pkt_safi = stream_getc(s); if (bgp_debug_update(peer, NULL, NULL, 0)) - zlog_debug("%s rcvd REFRESH_REQ for afi/safi: %d/%d", - peer->host, pkt_afi, pkt_safi); + zlog_debug("%s rcvd REFRESH_REQ for afi/safi: %s/%s", + peer->host, iana_afi2str(pkt_afi), + iana_safi2str(pkt_safi)); /* Convert AFI, SAFI to internal values and check. */ if (bgp_map_afi_safi_iana2int(pkt_afi, pkt_safi, &afi, &safi)) { zlog_info( - "%s REFRESH_REQ for unrecognized afi/safi: %d/%d - ignored", - peer->host, pkt_afi, pkt_safi); + "%s REFRESH_REQ for unrecognized afi/safi: %s/%s - ignored", + peer->host, iana_afi2str(pkt_afi), + iana_safi2str(pkt_safi)); return BGP_PACKET_NOOP; } @@ -2090,8 +2095,10 @@ static int bgp_capability_msg_parse(struct peer *peer, uint8_t *pnt, if (bgp_debug_neighbor_events(peer)) zlog_debug( "%s Dynamic Capability MP_EXT afi/safi invalid " - "(%u/%u)", - peer->host, pkt_afi, pkt_safi); + "(%s/%s)", + peer->host, + iana_afi2str(pkt_afi), + iana_safi2str(pkt_safi)); continue; } diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 4de73f1244..c7188cdc78 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -5787,6 +5787,13 @@ static void bgp_aggregate_route(struct bgp *bgp, struct prefix *p, unsigned long match = 0; uint8_t atomic_aggregate = 0; + /* If the bgp instance is being deleted or self peer is deleted + * then do not create aggregate route + */ + if (bgp_flag_check(bgp, BGP_FLAG_DELETE_IN_PROGRESS) || + (bgp->peer_self == NULL)) + return; + /* ORIGIN attribute: If at least one route among routes that are aggregated has ORIGIN with the value INCOMPLETE, then the aggregated route must have the ORIGIN attribute with the value diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 6665bad852..a18a3bb952 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -7463,11 +7463,14 @@ DEFUN (show_bgp_vrfs, continue; count++; - if (!uj && count == 1) + if (!uj && count == 1) { vty_out(vty, - "%4s %-5s %-16s %9s %10s %-37s %-10s %-15s\n", + "%4s %-5s %-16s %9s %10s %-37s\n", "Type", "Id", "routerId", "#PeersVfg", - "#PeersEstb", "Name", "L3-VNI", "Rmac"); + "#PeersEstb", "Name"); + vty_out(vty, "%11s %-16s %-21s %-6s\n", " ", + "L3-VNI", "RouterMAC", "Interface"); + } peers_cfg = peers_estb = 0; if (uj) @@ -7508,16 +7511,24 @@ DEFUN (show_bgp_vrfs, json_object_string_add( json_vrf, "rmac", prefix_mac2str(&bgp->rmac, buf, sizeof(buf))); + json_object_string_add(json_vrf, "interface", + ifindex2ifname(bgp->l3vni_svi_ifindex, + bgp->vrf_id)); json_object_object_add(json_vrfs, name, json_vrf); - } else + } else { vty_out(vty, - "%4s %-5d %-16s %9u %10u %-37s %-10u %-15s\n", + "%4s %-5d %-16s %-9u %-10u %-37s\n", type, bgp->vrf_id == VRF_UNKNOWN ? -1 : (int)bgp->vrf_id, inet_ntoa(bgp->router_id), peers_cfg, - peers_estb, name, bgp->l3vni, - prefix_mac2str(&bgp->rmac, buf, sizeof(buf))); + peers_estb, name); + vty_out(vty,"%11s %-16u %-21s %-20s\n", " ", + bgp->l3vni, + prefix_mac2str(&bgp->rmac, buf, sizeof(buf)), + ifindex2ifname(bgp->l3vni_svi_ifindex, + bgp->vrf_id)); + } } if (uj) { diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index 5e9fc57f59..c0f2dfca17 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -793,6 +793,7 @@ bool bgp_zebra_nexthop_set(union sockunion *local, union sockunion *remote, peer->bgp->vrf_id); } if (local->sa.sa_family == AF_INET6) { + memcpy(&nexthop->v6_global, &local->sin6.sin6_addr, IPV6_MAX_BYTELEN); if (IN6_IS_ADDR_LINKLOCAL(&local->sin6.sin6_addr)) { if (peer->conf_if || peer->ifname) ifp = if_lookup_by_name(peer->conf_if diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 6d67f4460c..af90e9841a 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -234,8 +234,11 @@ static int bgp_config_check(struct bgp *bgp, int config) return CHECK_FLAG(bgp->config, config); } -/* Set BGP router identifier. */ -static int bgp_router_id_set(struct bgp *bgp, const struct in_addr *id) +/* Set BGP router identifier; distinguish between explicit config and other + * cases. + */ +static int bgp_router_id_set(struct bgp *bgp, const struct in_addr *id, + bool is_config) { struct peer *peer; struct listnode *node, *nnode; @@ -247,7 +250,7 @@ static int bgp_router_id_set(struct bgp *bgp, const struct in_addr *id) if (is_evpn_enabled()) bgp_evpn_handle_router_id_update(bgp, TRUE); - vpn_handle_router_id_update(bgp, TRUE); + vpn_handle_router_id_update(bgp, TRUE, is_config); IPV4_ADDR_COPY(&bgp->router_id, id); @@ -266,7 +269,7 @@ static int bgp_router_id_set(struct bgp *bgp, const struct in_addr *id) if (is_evpn_enabled()) bgp_evpn_handle_router_id_update(bgp, FALSE); - vpn_handle_router_id_update(bgp, FALSE); + vpn_handle_router_id_update(bgp, FALSE, is_config); return 0; } @@ -300,7 +303,7 @@ void bgp_router_id_zebra_bump(vrf_id_t vrf_id, const struct prefix *router_id) if (BGP_DEBUG(zebra, ZEBRA)) zlog_debug("RID change : vrf %u, RTR ID %s", bgp->vrf_id, inet_ntoa(*addr)); - bgp_router_id_set(bgp, addr); + bgp_router_id_set(bgp, addr, FALSE); } } } @@ -320,7 +323,7 @@ void bgp_router_id_zebra_bump(vrf_id_t vrf_id, const struct prefix *router_id) if (BGP_DEBUG(zebra, ZEBRA)) zlog_debug("RID change : vrf %u, RTR ID %s", bgp->vrf_id, inet_ntoa(*addr)); - bgp_router_id_set(bgp, addr); + bgp_router_id_set(bgp, addr, FALSE); } } @@ -331,7 +334,8 @@ void bgp_router_id_zebra_bump(vrf_id_t vrf_id, const struct prefix *router_id) int bgp_router_id_static_set(struct bgp *bgp, struct in_addr id) { bgp->router_id_static = id; - bgp_router_id_set(bgp, id.s_addr ? &id : &bgp->router_id_zebra); + bgp_router_id_set(bgp, id.s_addr ? &id : &bgp->router_id_zebra, + TRUE /* is config */); return 0; } @@ -3185,7 +3189,7 @@ int bgp_get(struct bgp **bgp_val, as_t *as, const char *name, bgp = bgp_create(as, name, inst_type); if (bgp_option_check(BGP_OPT_NO_ZEBRA) && name) bgp->vrf_id = vrf_generate_id(); - bgp_router_id_set(bgp, &bgp->router_id_zebra); + bgp_router_id_set(bgp, &bgp->router_id_zebra, TRUE); bgp_address_init(bgp); bgp_tip_hash_init(bgp); bgp_scan_init(bgp); @@ -3287,6 +3291,9 @@ int bgp_delete(struct bgp *bgp) THREAD_OFF(bgp->t_update_delay); THREAD_OFF(bgp->t_establish_wait); + /* Set flag indicating bgp instance delete in progress */ + bgp_flag_set(bgp, BGP_FLAG_DELETE_IN_PROGRESS); + if (BGP_DEBUG(zebra, ZEBRA)) { if (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) zlog_debug("Deleting Default VRF"); diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index 518f1f6714..088c6411b4 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -28,6 +28,7 @@ #include "lib/json.h" #include "vrf.h" #include "vty.h" +#include "iana_afi.h" /* For union sockunion. */ #include "queue.h" @@ -361,6 +362,7 @@ struct bgp { #define BGP_FLAG_SHOW_HOSTNAME (1 << 19) #define BGP_FLAG_GR_PRESERVE_FWD (1 << 20) #define BGP_FLAG_GRACEFUL_SHUTDOWN (1 << 21) +#define BGP_FLAG_DELETE_IN_PROGRESS (1 << 22) /* BGP Per AF flags */ uint16_t af_flags[AFI_MAX][SAFI_MAX]; diff --git a/configure.ac b/configure.ac index 77d5ee1555..828692c3eb 100755 --- a/configure.ac +++ b/configure.ac @@ -25,9 +25,25 @@ dnl ----------------------------------- AC_CANONICAL_BUILD() AC_CANONICAL_HOST() -AS_IF([test "$host" != "$build"], [ +hosttools_clippy="false" +build_clippy="true" + +dnl case 1: external clippy +if test -n "$with_clippy" -a "$with_clippy" != "no" -a "$with_clippy" != "yes"; then + if test "$enable_clippy_only" == "yes"; then + AC_MSG_ERROR([--enable-clippy-only does not make sense with --with-clippy]) + fi + + CLIPPY="$with_clippy" + build_clippy="false" + if test ! -x "$with_clippy"; then + AC_MSG_ERROR([clippy tool ($with_clippy) is not executable]) + fi + +dnl case 2: cross-compiling internal clippy +elif test "$host" != "$build"; then if test "$srcdir" = "."; then - AC_MSG_ERROR([cross-compilation is only possible with builddir separate from srcdir. create a separate directory and run as .../path-to-frr/configure.]) + AC_MSG_ERROR([cross-compilation is only possible with builddir separate from srcdir or by building clippy separately and using the --with-clippy option. create a separate directory and run as .../path-to-frr/configure.]) fi test -d hosttools || mkdir hosttools abssrc="`cd \"${srcdir}\"; pwd`" @@ -37,23 +53,47 @@ AS_IF([test "$host" != "$build"], [ AC_MSG_NOTICE([... use HOST_CPPFLAGS / HOST_CFLAGS / HOST_LDFLAGS if neccessary]) AC_MSG_NOTICE([...]) - ( CPPFLAGS="$HOST_CPPFLAGS"; \ - CFLAGS="$HOST_CFLAGS"; \ - LDFLAGS="$HOST_LDFLAGS"; \ - cd hosttools; "${abssrc}/configure" "--host=$build" "--build=$build" "--enable-clippy-only" "--disable-nhrpd" "--disable-vtysh"; ) + ( + for var in $ac_precious_vars; do + dnl special cases + case "$var" in + YACC|YFLAGS) continue;; + PYTHON*) retain=true;; + *) retain=false; + esac + + eval "hostvar=\"\${HOST_$var}\"" + eval "targetvar=\"\${$var}\"" + if test -n "$hostvar"; then + eval "$var='$hostvar'" + _AS_ECHO_LOG([host $var='$hostvar']) + elif $retain; then + _AS_ECHO_LOG([host retain $var='$targetvar']) + else + eval "unset $var" + _AS_ECHO_LOG([host unset $var]) + fi + done + cd hosttools + "${abssrc}/configure" "--host=$build" "--build=$build" "--enable-clippy-only" "--disable-nhrpd" "--disable-vtysh" + ) || exit 1 AC_MSG_NOTICE([...]) AC_MSG_NOTICE([... cross-compilation: finished self-configuring for build platform tools]) AC_MSG_NOTICE([...]) build_clippy="false" - HOSTTOOLS="hosttools/" -], [ - build_clippy="true" - HOSTTOOLS="" -]) -AC_SUBST([HOSTTOOLS]) + hosttools_clippy="true" + CLIPPY="hosttools/lib/clippy" + +dnl case 3: normal build internal clippy +else + CLIPPY="lib/clippy\$(EXEEXT)" +fi +AC_SUBST([CLIPPY]) AM_CONDITIONAL([BUILD_CLIPPY], [$build_clippy]) +AM_CONDITIONAL([HOSTTOOLS_CLIPPY], [$hosttools_clippy]) +AM_CONDITIONAL([ONLY_CLIPPY], [test "$enable_clippy_only" = "yes"]) # Disable portability warnings -- our automake code (in particular # common.am) uses some constructs specific to gmake. @@ -138,12 +178,11 @@ CXXFLAGS="$orig_cxxflags" AC_PROG_CC_C99 dnl NB: see C11 below -AC_PROG_EGREP PKG_PROG_PKG_CONFIG -dnl autoconf 2.59 appears not to support AC_PROG_SED -dnl AC_PROG_SED -AC_CHECK_PROG([SED],[sed],[sed],[/bin/false]) +dnl it's 2019, sed is sed. +SED=sed +AC_SUBST([SED]) dnl try and enable CFLAGS that are useful for FRR dnl - specifically, options to control warnings @@ -237,9 +276,7 @@ else fi if test "z$orig_cflags" = "z"; then AC_C_FLAG([-g]) - AC_C_FLAG([-Os], [ - AC_C_FLAG([-O2]) - ]) + AC_C_FLAG([-O2]) fi fi AM_CONDITIONAL([DEV_BUILD], [test "x$enable_dev_build" = "xyes"]) @@ -330,7 +367,6 @@ dnl Check programs dnl -------------- AC_PROG_INSTALL AC_PROG_LN_S -AC_PROG_MAKE_SET AC_CHECK_TOOL([AR], [ar]) dnl ------- @@ -400,6 +436,8 @@ AC_ARG_WITH([pkg-extra-version], AC_ARG_WITH([pkg-git-version], AS_HELP_STRING([--with-pkg-git-version], [add git information to MOTD and build version string]), [ test "x$withval" != "xno" && with_pkg_git_version="yes" ]) +AC_ARG_WITH([clippy], + AS_HELP_STRING([--with-clippy=PATH], [use external clippy helper program])) AC_ARG_WITH([vtysh_pager], AS_HELP_STRING([--with-vtysh-pager=PAGER], [control what pager is compiled in as default]), VTYSH_PAGER=$withval, VTYSH_PAGER="more") @@ -605,8 +643,6 @@ if test "${enable_shell_access}" = "yes"; then AC_DEFINE([HAVE_SHELL_ACCESS], [1], [Allow user to use ssh/telnet/bash, be aware this is considered insecure]) fi -AM_CONDITIONAL([FPM], [test "x$enable_fpm" = "xyes"]) - # # Python for clippy # @@ -637,31 +673,6 @@ FRR_PYTHON_MOD_EXEC([sphinx], [--version], [ AC_SUBST([PYSPHINX]) # -# Logic for protobuf support. -# -if test "$enable_protobuf" = "yes"; then - # Check for protoc & protoc-c - - # protoc is not required, it's only for a "be nice" helper target - AC_CHECK_PROGS([PROTOC], [protoc], [/bin/false]) - - AC_CHECK_PROGS([PROTOC_C], [protoc-c], [/bin/false]) - if test "$PROTOC_C" = "/bin/false"; then - AC_MSG_FAILURE([protobuf requested but protoc-c not found. Install protobuf-c.]) - fi - - PKG_CHECK_MODULES([PROTOBUF_C], [libprotobuf-c >= 0.14],, [ - AC_MSG_FAILURE([protobuf requested but libprotobuf-c not found. Install protobuf-c.]) - ]) - AC_CHECK_HEADER([google/protobuf-c/protobuf-c.h], [], [ - AC_MSG_FAILURE([protobuf requested but protobuf-c.h not found. Install protobuf-c.]) - ]) - - AC_DEFINE([HAVE_PROTOBUF], [1], [protobuf]) -fi -AM_CONDITIONAL([HAVE_PROTOBUF], [test "x$enable_protobuf" = "xyes"]) - -# # Logic for old vpn commands support. # if test "$enable_oldvpn_commands" = "yes"; then @@ -785,25 +796,11 @@ if test -n "$frr_cv_interp"; then AC_DEFINE_UNQUOTED([INTERP], ["$frr_cv_interp"], [.interp value]) fi -dnl ------------------------------------ -dnl Check C keywords and standard types -dnl ------------------------------------ -AC_C_CONST -AC_C_INLINE -AC_C_VOLATILE -AC_HEADER_STDC -dnl AC_TYPE_PID_T -AC_TYPE_UID_T -AC_TYPE_MODE_T -AC_TYPE_SIZE_T -AC_STRUCT_TM - dnl ------------------------- dnl Check other header files. dnl ------------------------- AC_CHECK_HEADERS([stropts.h sys/ksym.h \ - linux/version.h asm/types.h \ - sys/cdefs.h]) + linux/version.h asm/types.h]) ac_stdatomic_ok=false AC_DEFINE([FRR_AUTOCONF_ATOMIC], [1], [did autoconf checks for atomic funcs]) @@ -990,7 +987,7 @@ FRR_INCLUDES AC_CHECK_HEADERS([netinet/in_var.h \ net/if_dl.h net/netopt.h \ inet/nd.h netinet/ip_icmp.h \ - sys/sysctl.h sys/sockio.h kvm.h sys/conf.h], + sys/sysctl.h sys/sockio.h sys/conf.h], [], [], [FRR_INCLUDES]) AC_CHECK_HEADERS([ucontext.h], [], [], @@ -1110,7 +1107,48 @@ if test "${enable_realms}" = "yes"; then ;; esac fi -AM_CONDITIONAL([SUPPORT_REALMS], [test "${enable_realms}" = "yes"]) + +dnl ------------------------------- +dnl Endian-ness check +dnl ------------------------------- +AC_WORDS_BIGENDIAN + +dnl --------------- +dnl other functions +dnl --------------- +AC_CHECK_FUNCS([ \ + strlcat strlcpy \ + getgrouplist]) + +dnl ########################################################################## +dnl LARGE if block spans a lot of "configure"! +if test "${enable_clippy_only}" != "yes"; then +dnl ########################################################################## + +# +# Logic for protobuf support. +# +if test "$enable_protobuf" = "yes"; then + # Check for protoc & protoc-c + + # protoc is not required, it's only for a "be nice" helper target + AC_CHECK_PROGS([PROTOC], [protoc], [/bin/false]) + + AC_CHECK_PROGS([PROTOC_C], [protoc-c], [/bin/false]) + if test "$PROTOC_C" = "/bin/false"; then + AC_MSG_FAILURE([protobuf requested but protoc-c not found. Install protobuf-c.]) + fi + + PKG_CHECK_MODULES([PROTOBUF_C], [libprotobuf-c >= 0.14],, [ + AC_MSG_FAILURE([protobuf requested but libprotobuf-c not found. Install protobuf-c.]) + ]) + AC_CHECK_HEADER([google/protobuf-c/protobuf-c.h], [], [ + AC_MSG_FAILURE([protobuf requested but protobuf-c.h not found. Install protobuf-c.]) + ]) + + AC_DEFINE([HAVE_PROTOBUF], [1], [protobuf]) +fi + dnl --------------------- dnl Integrated VTY option @@ -1159,7 +1197,6 @@ case "${enable_vtysh}" in ;; esac AC_SUBST([LIBREADLINE]) -AM_CONDITIONAL([VTYSH], test "x$VTYSH" = "xvtysh") dnl ---------- dnl PAM module @@ -1222,42 +1259,16 @@ fi AC_SUBST([LIBPAM]) dnl ------------------------------- -dnl Endian-ness check -dnl ------------------------------- -AC_WORDS_BIGENDIAN - -dnl ------------------------------- -dnl check the size in byte of the C -dnl ------------------------------- -dnl AC_CHECK_SIZEOF(char) -dnl AC_CHECK_SIZEOF(int) -dnl AC_CHECK_SIZEOF(short) -dnl AC_CHECK_SIZEOF(long) - -dnl ---------------------------- -dnl check existance of functions -dnl ---------------------------- -AC_FUNC_FNMATCH -AC_FUNC_FORK -AC_FUNC_MKTIME -AC_FUNC_STAT - -dnl ------------------------------- dnl bgpd needs pow() and hence libm dnl ------------------------------- TMPLIBS="$LIBS" -AC_CHECK_HEADER([math.h], - [AC_CHECK_LIB([m], [pow], - [LIBM="-lm" - LIBS="$LIBS $LIBM" - AC_CHECK_FUNCS(pow,[],[LIBM=""]) - ]) -]) -if test x"$LIBM" = x ; then +LIBS="" +AC_SEARCH_LIBS([pow], [m], [ + LIBM="$LIBS" +], [ AC_MSG_WARN([Unable to find working pow function - bgpd may not link]) -fi +]) LIBS="$TMPLIBS" - AC_SUBST([LIBM]) AC_CHECK_FUNCS([ppoll], [ @@ -1267,13 +1278,6 @@ AC_CHECK_FUNCS([pollts], [ AC_DEFINE([HAVE_POLLTS], [1], [have NetBSD pollts()]) ]) -dnl --------------- -dnl other functions -dnl --------------- -AC_CHECK_FUNCS([ \ - strlcat strlcpy \ - getgrouplist]) - AC_CHECK_HEADER([asm-generic/unistd.h], [AC_CHECK_DECL(__NR_setns, AC_DEFINE([HAVE_NETNS], [1], [Have netns]),, @@ -1418,6 +1422,28 @@ if test $ac_cv_have_decl_TCP_MD5SIG = no; then AC_CHECK_DECLS([TCP_MD5SIG], [], [], MD5_INCLUDES)]) fi +AC_SUBST([SOLARIS]) +AC_CHECK_LIB([crypt], [crypt], [], + [AC_CHECK_LIB([crypto], [DES_crypt])]) +AC_CHECK_LIB([resolv], [res_init]) + +dnl --------------------------- +dnl check system has PCRE regexp +dnl --------------------------- +if test "x$enable_pcreposix" = "xyes"; then + AC_CHECK_LIB([pcreposix], [regexec], [], [ + AC_MSG_ERROR([--enable-pcreposix given but unable to find libpcreposix]) + ]) +fi +AC_SUBST([HAVE_LIBPCREPOSIX]) + +dnl ########################################################################## +dnl test "${enable_clippy_only}" != "yes" +fi +dnl END OF LARGE if block +dnl ########################################################################## + + dnl ---------------------------------------------------------------------------- dnl figure out if domainname is available in the utsname struct (GNU extension). dnl ---------------------------------------------------------------------------- @@ -1450,18 +1476,6 @@ FRR_INCLUDES dnl -------------------- dnl Daemon disable check dnl -------------------- -AM_CONDITIONAL([ZEBRA], [test "${enable_zebra}" != "no"]) - -if test "${enable_bgpd}" = "no";then - BGPD="" -else - BGPD="bgpd" -fi -AM_CONDITIONAL([BGPD], [test "x$BGPD" = "xbgpd"]) - -AM_CONDITIONAL([RIPD], [test "${enable_ripd}" != "no"]) -AM_CONDITIONAL([OSPFD], [test "${enable_ospfd}" != "no"]) -AM_CONDITIONAL([LDPD], [test "${enable_ldpd}" != "no"]) AS_IF([test "${enable_ldpd}" != "no"], [ AC_DEFINE([HAVE_LDPD], [1], [ldpd]) @@ -1485,8 +1499,6 @@ else esac fi -AM_CONDITIONAL([BFDD], [test "x$BFDD" = "xbfdd"]) - if test "$ac_cv_lib_json_c_json_object_get" = no -a "x$BFDD" = "xbfdd"; then AC_MSG_ERROR(["you must use json-c library to use bfdd"]) fi @@ -1504,16 +1516,12 @@ case "$host_os" in fi ;; esac -AM_CONDITIONAL([NHRPD], [test "x$NHRPD" = "xnhrpd"]) - -AM_CONDITIONAL([EIGRPD], [test "${enable_eigrpd}" != "no"]) if test "${enable_watchfrr}" = "no";then WATCHFRR="" else WATCHFRR="watchfrr" fi -AM_CONDITIONAL([WATCHFRR], [test "x$WATCHFRR" = "xwatchfrr"]) OSPFCLIENT="" if test "${enable_ospfapi}" != "no";then @@ -1524,18 +1532,6 @@ if test "${enable_ospfapi}" != "no";then fi fi -AM_CONDITIONAL([OSPFCLIENT], [test "x$OSPFCLIENT" = "xospfclient"]) -AM_CONDITIONAL([RIPNGD], [test "${enable_ripngd}" != "no"]) -AM_CONDITIONAL([BABELD], [test "${enable_babeld}" != "no"]) -AM_CONDITIONAL([OSPF6D], [test "${enable_ospf6d}" != "no"]) -AM_CONDITIONAL([ISISD], [test "${enable_isisd}" != "no"]) -AM_CONDITIONAL([PIMD], [test "${enable_pimd}" != "no"]) -AM_CONDITIONAL([PBRD], [test "${enable_pbrd}" != "no"]) -AM_CONDITIONAL([SHARPD], [test "${enable_sharpd}" = "yes"]) -AM_CONDITIONAL([STATICD], [test "${enable_staticd}" != "no"]) -AM_CONDITIONAL([FABRICD], [test "${enable_fabricd}" != "no"]) -AM_CONDITIONAL([VRRPD], [test "${enable_vrrpd}" != "no"]) - if test "${enable_bgp_announce}" = "no";then AC_DEFINE([DISABLE_BGP_ANNOUNCE], [1], [Disable BGP installation to zebra]) else @@ -1545,22 +1541,11 @@ fi if test "${enable_bgp_vnc}" != "no";then AC_DEFINE([ENABLE_BGP_VNC], [1], [Enable BGP VNC support]) fi -AM_CONDITIONAL([ENABLE_BGP_VNC], [test x${enable_bgp_vnc} != xno]) -AC_SUBST([SOLARIS]) -AC_CHECK_LIB([crypt], [crypt], [], - [AC_CHECK_LIB([crypto], [DES_crypt])]) -AC_CHECK_LIB([resolv], [res_init]) - -dnl --------------------------- -dnl check system has PCRE regexp -dnl --------------------------- -if test "x$enable_pcreposix" = "xyes"; then - AC_CHECK_LIB([pcreposix], [regexec], [], [ - AC_MSG_ERROR([--enable-pcreposix given but unable to find libpcreposix]) - ]) -fi -AC_SUBST([HAVE_LIBPCREPOSIX]) +dnl ########################################################################## +dnl LARGE if block +if test "${enable_clippy_only}" != "yes"; then +dnl ########################################################################## dnl ------------------ dnl check C-Ares library @@ -1612,7 +1597,6 @@ int main(void); AH_TEMPLATE([SNMP_AGENTX], [Use SNMP AgentX to interface with snmpd]) AC_DEFINE_UNQUOTED(AS_TR_CPP(SNMP_${SNMP_METHOD}),,[SNMP method to interface with snmpd]) fi -AM_CONDITIONAL([SNMP], [test "x${SNMP_METHOD}" != "x"]) AC_SUBST([SNMP_LIBS]) AC_SUBST([SNMP_CFLAGS]) @@ -1645,7 +1629,6 @@ if test "$enable_config_rollbacks" = "yes"; then AC_MSG_ERROR([--enable-config-rollbacks given but sqlite3 was not found on your system.]) ]) fi -AM_CONDITIONAL([SQLITE3], [$SQLITE3]) dnl --------------- dnl confd @@ -1661,7 +1644,6 @@ if test "$enable_confd" != "" -a "$enable_confd" != "no"; then AC_SUBST([CONFD_LIBS]) AC_DEFINE([HAVE_CONFD], [1], [Enable confd integration]) fi -AM_CONDITIONAL([CONFD], [test "x$enable_confd" != "x"]) dnl --------------- dnl sysrepo @@ -1674,7 +1656,6 @@ if test "$enable_sysrepo" = "yes"; then AC_MSG_ERROR([sysrepo was not found on your system.])] ) fi -AM_CONDITIONAL([SYSREPO], [test "x$enable_sysrepo" = "xyes"]) dnl --------------- dnl gRPC @@ -1693,12 +1674,42 @@ if test "$enable_grpc" = "yes"; then AC_MSG_ERROR([grpc/grpc++ were not found on your system.]) ]) fi -AM_CONDITIONAL([GRPC], [test "x$enable_grpc" = "xyes"]) -dnl --------------- -dnl math -dnl --------------- -AC_SEARCH_LIBS([sqrt], [m]) +dnl ------ +dnl ZeroMQ +dnl ------ +if test "x$enable_zeromq" != "xno"; then + PKG_CHECK_MODULES([ZEROMQ], [libzmq >= 4.0.0], [ + AC_DEFINE([HAVE_ZEROMQ], [1], [Enable ZeroMQ support]) + ZEROMQ=true + ], [ + if test "x$enable_zeromq" = "xyes"; then + AC_MSG_ERROR([configuration specifies --enable-zeromq but libzmq was not found]) + fi + ]) +fi + +dnl ------------------------------------ +dnl Enable RPKI and add librtr to libs +dnl ------------------------------------ +if test "${enable_rpki}" = "yes"; then + PKG_CHECK_MODULES([RTRLIB], [rtrlib >= 0.5.0], + [RPKI=true], + [RPKI=false + AC_MSG_ERROR([rtrlib was not found on your system or is too old.])] + ) +fi + +dnl ------------------------------------------ +dnl Check whether rtrlib was build with ssh support +dnl ------------------------------------------ +AC_MSG_CHECKING([whether the RTR Library is compiled with SSH]) +AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "rtrlib/rtrlib.h"]], + [[struct tr_ssh_config config;]])], + [AC_MSG_RESULT([yes]) + AC_DEFINE([FOUND_SSH], [1], [found_ssh])], + AC_MSG_RESULT([no]) +) dnl --------------- dnl dlopen & dlinfo @@ -1749,7 +1760,11 @@ if test "$frr_cv_rtld_di_linkmap" = yes; then AC_DEFINE([HAVE_DLINFO_LINKMAP], [1], [Have dlinfo RTLD_DI_LINKMAP]) fi -AM_CONDITIONAL([SNMP], [test "x$SNMP_METHOD" = "xagentx"]) +dnl ########################################################################## +dnl test "${enable_clippy_only}" != "yes" +fi +dnl END OF LARGE if block +dnl ########################################################################## dnl --------------------------- dnl sockaddr and netinet checks @@ -1759,7 +1774,7 @@ AC_CHECK_TYPES([ struct vifctl, struct mfcctl, struct sioc_sg_req, vifi_t, struct sioc_vif_req, struct igmpmsg, struct ifaliasreq, struct if6_aliasreq, struct in6_aliasreq, - struct nd_opt_adv_interval, struct rt_addrinfo, + struct nd_opt_adv_interval, struct nd_opt_homeagent_info, struct nd_opt_adv_interval, struct nd_opt_rdnss, struct nd_opt_dnssl], [], [], FRR_INCLUDES) @@ -1794,7 +1809,6 @@ no) ;; esac -AM_CONDITIONAL([IRDP], [$IRDP]) dnl ----------------------- dnl checking for IP_PKTINFO @@ -1901,7 +1915,7 @@ AC_MSG_CHECKING([version of bison]) frr_ac_bison_version="$(eval $YACC -V | grep bison | head -n 1)" frr_ac_bison_version="${frr_ac_bison_version##* }" frr_ac_bison_missing="false" -case "x${frr_ac_bison_version}" in +case "x${frr_ac_bison_version}x" in x2.7*) BISON_OPENBRACE='"' BISON_CLOSEBRACE='"' @@ -1918,11 +1932,17 @@ case "x${frr_ac_bison_version}" in AC_MSG_WARN([could not determine bison version. Please install GNU bison 2.7.x or newer.]) frr_ac_bison_missing="true" ;; - *) + x3.[012][^0-9]*) BISON_OPENBRACE='{' BISON_CLOSEBRACE='}' BISON_VERBOSE='-Dparse.error=verbose' - AC_MSG_RESULT([$frr_ac_bison_version - 3.0 or newer]) + AC_MSG_RESULT([$frr_ac_bison_version - 3.0 to 3.2]) + ;; + *) + BISON_OPENBRACE='{' + BISON_CLOSEBRACE='}' + BISON_VERBOSE='-Dparse.error=verbose -Wno-yacc' + AC_MSG_RESULT([$frr_ac_bison_version - 3.3 or newer]) ;; esac AC_SUBST([BISON_OPENBRACE]) @@ -2076,21 +2096,6 @@ size_t ac_x; ac_x = malloc_size(NULL); ]) ]) -dnl ------ -dnl ZeroMQ -dnl ------ -if test "x$enable_zeromq" != "xno"; then - PKG_CHECK_MODULES([ZEROMQ], [libzmq >= 4.0.0], [ - AC_DEFINE([HAVE_ZEROMQ], [1], [Enable ZeroMQ support]) - ZEROMQ=true - ], [ - if test "x$enable_zeromq" = "xyes"; then - AC_MSG_ERROR([configuration specifies --enable-zeromq but libzmq was not found]) - fi - ]) -fi -AM_CONDITIONAL([ZEROMQ], [test "x$ZEROMQ" = "xtrue"]) - dnl ---------- dnl configure date dnl ---------- @@ -2176,39 +2181,43 @@ AC_DEFINE_UNQUOTED([YANG_MODELS_PATH], ["$CFG_YANGMODELS"], [path to YANG data m AC_DEFINE_UNQUOTED([LIBYANG_PLUGINS_PATH], ["$CFG_LIBYANG_PLUGINS"], [path to libyang plugins]) AC_DEFINE_UNQUOTED([WATCHFRR_SH_PATH], ["${CFG_SBIN%/}/watchfrr.sh"], [path to watchfrr.sh]) -dnl ------------------------------------ -dnl Enable RPKI and add librtr to libs -dnl ------------------------------------ -if test "${enable_rpki}" = "yes"; then - PKG_CHECK_MODULES([RTRLIB], [rtrlib >= 0.5.0], - [RPKI=true], - [RPKI=false - AC_MSG_ERROR([rtrlib was not found on your system or is too old.])] - ) -fi +dnl various features +AM_CONDITIONAL([SUPPORT_REALMS], [test "${enable_realms}" = "yes"]) +AM_CONDITIONAL([ENABLE_BGP_VNC], [test x${enable_bgp_vnc} != xno]) +dnl northbound +AM_CONDITIONAL([SQLITE3], [$SQLITE3]) +AM_CONDITIONAL([CONFD], [test "x$enable_confd" != "x"]) +AM_CONDITIONAL([SYSREPO], [test "x$enable_sysrepo" = "xyes"]) +AM_CONDITIONAL([GRPC], [test "x$enable_grpc" = "xyes"]) +AM_CONDITIONAL([ZEROMQ], [test "x$ZEROMQ" = "xtrue"]) +dnl plugins AM_CONDITIONAL([RPKI], [test "x$RPKI" = "xtrue"]) - -dnl ------------------------------------------ -dnl Check whether rtrlib was build with ssh support -dnl ------------------------------------------ -AC_MSG_CHECKING([whether the RTR Library is compiled with SSH]) -AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "rtrlib/rtrlib.h"]], - [[struct tr_ssh_config config;]])], - [AC_MSG_RESULT([yes]) - AC_DEFINE([FOUND_SSH], [1], [found_ssh])], - AC_MSG_RESULT([no]) -) - -dnl --------------------------- -dnl Check htonl works correctly -dnl --------------------------- -AC_MSG_CHECKING([for working htonl]) -AC_CACHE_VAL(ac_cv_htonl_works, - [AC_LINK_IFELSE([AC_LANG_PROGRAM([FRR_INCLUDES],[htonl (0);])], - [ac_cv_htonl_works=yes], [ac_cv_htonl_works=no]) - ] -) -AC_MSG_RESULT([$ac_cv_htonl_works]) +AM_CONDITIONAL([SNMP], [test "x$SNMP_METHOD" = "xagentx"]) +AM_CONDITIONAL([IRDP], [$IRDP]) +AM_CONDITIONAL([FPM], [test "x$enable_fpm" = "xyes"]) +AM_CONDITIONAL([HAVE_PROTOBUF], [test "x$enable_protobuf" = "xyes"]) +dnl daemons +AM_CONDITIONAL([VTYSH], [test "x$VTYSH" = "xvtysh"]) +AM_CONDITIONAL([ZEBRA], [test "${enable_zebra}" != "no"]) +AM_CONDITIONAL([BGPD], [test "x${enable_bgpd}" != "no"]) +AM_CONDITIONAL([RIPD], [test "${enable_ripd}" != "no"]) +AM_CONDITIONAL([OSPFD], [test "${enable_ospfd}" != "no"]) +AM_CONDITIONAL([LDPD], [test "${enable_ldpd}" != "no"]) +AM_CONDITIONAL([BFDD], [test "x$BFDD" = "xbfdd"]) +AM_CONDITIONAL([NHRPD], [test "x$NHRPD" = "xnhrpd"]) +AM_CONDITIONAL([EIGRPD], [test "${enable_eigrpd}" != "no"]) +AM_CONDITIONAL([WATCHFRR], [test "x$WATCHFRR" = "xwatchfrr"]) +AM_CONDITIONAL([OSPFCLIENT], [test "x$OSPFCLIENT" = "xospfclient"]) +AM_CONDITIONAL([RIPNGD], [test "${enable_ripngd}" != "no"]) +AM_CONDITIONAL([BABELD], [test "${enable_babeld}" != "no"]) +AM_CONDITIONAL([OSPF6D], [test "${enable_ospf6d}" != "no"]) +AM_CONDITIONAL([ISISD], [test "${enable_isisd}" != "no"]) +AM_CONDITIONAL([PIMD], [test "${enable_pimd}" != "no"]) +AM_CONDITIONAL([PBRD], [test "${enable_pbrd}" != "no"]) +AM_CONDITIONAL([SHARPD], [test "${enable_sharpd}" = "yes"]) +AM_CONDITIONAL([STATICD], [test "${enable_staticd}" != "no"]) +AM_CONDITIONAL([FABRICD], [test "${enable_fabricd}" != "no"]) +AM_CONDITIONAL([VRRPD], [test "${enable_vrrpd}" != "no"]) AC_CONFIG_FILES([Makefile],[sed -e 's/^#AUTODERP# //' -i Makefile]) diff --git a/doc/developer/building-frr-for-fedora.rst b/doc/developer/building-frr-for-fedora.rst index d11da2d647..0208f1146b 100644 --- a/doc/developer/building-frr-for-fedora.rst +++ b/doc/developer/building-frr-for-fedora.rst @@ -14,7 +14,7 @@ Installing Dependencies sudo dnf install git autoconf automake libtool make \ readline-devel texinfo net-snmp-devel groff pkgconfig json-c-devel \ pam-devel python3-pytest bison flex c-ares-devel python3-devel \ - python3-sphinx perl-core patch + python3-sphinx perl-core patch systemd-devel .. include:: building-libyang.rst diff --git a/doc/user/installation.rst b/doc/user/installation.rst index 6438c11413..64949fc8ea 100644 --- a/doc/user/installation.rst +++ b/doc/user/installation.rst @@ -465,7 +465,8 @@ Additional kernel modules are also needed to support MPLS forwarding. mpls_router mpls_iptunnel - The following is an example to enable MPLS forwarding in the kernel: + The following is an example to enable MPLS forwarding in the + kernel, typically by editing :file:`/etc/sysctl.conf`: .. code-block:: shell diff --git a/docker/debian/Dockerfile b/docker/debian/Dockerfile index 4f192ec33e..fde29d4911 100644 --- a/docker/debian/Dockerfile +++ b/docker/debian/Dockerfile @@ -1,10 +1,14 @@ -FROM debian:stretch +FROM debian:buster MAINTAINER Rob Gil (rob@rem5.com) +ENV DEBIAN_FRONTEND noninteractive +ENV APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn RUN apt-get update RUN apt-get install -y libpcre3-dev apt-transport-https ca-certificates curl wget logrotate \ - libc-ares2 libjson-c3 vim systemd procps -RUN curl -sLO https://ci1.netdef.org/artifact/LIBYANG-YANGRELEASE/shared/build-1/Debian-9-x86_64-Packages/libyang_0.16.46_amd64.deb && dpkg -i libyang_0.16.46_amd64.deb -RUN curl -sLO https://github.com/FRRouting/frr/releases/download/frr-6.0.2/frr_6.0.2-0.deb9u1_amd64.deb && dpkg -i frr_6.0.2-0.deb9u1_amd64.deb + libc-ares2 libjson-c3 vim systemd procps libreadline7 gnupg2 lsb-release apt-utils +RUN curl -s https://deb.frrouting.org/frr/keys.asc | apt-key add - +RUN echo deb https://deb.frrouting.org/frr $(lsb_release -s -c) frr-stable | tee -a /etc/apt/sources.list.d/frr.list +RUN apt-get update +RUN apt-get install -y frr frr-pythontools ADD daemons /etc/frr/daemons ADD docker-start /usr/sbin/docker-start ENTRYPOINT ["/usr/sbin/docker-start"] diff --git a/eigrpd/eigrp_packet.c b/eigrpd/eigrp_packet.c index bedaf15c47..4efb91e4a0 100644 --- a/eigrpd/eigrp_packet.c +++ b/eigrpd/eigrp_packet.c @@ -1114,6 +1114,7 @@ static struct TLV_IPv4_Internal_type *eigrp_IPv4_InternalTLV_new(void) struct TLV_IPv4_Internal_type *eigrp_read_ipv4_tlv(struct stream *s) { struct TLV_IPv4_Internal_type *tlv; + uint32_t destination_tmp; tlv = eigrp_IPv4_InternalTLV_new(); @@ -1133,31 +1134,16 @@ struct TLV_IPv4_Internal_type *eigrp_read_ipv4_tlv(struct stream *s) tlv->prefix_length = stream_getc(s); - if (tlv->prefix_length <= 8) { - tlv->destination_part[0] = stream_getc(s); - tlv->destination.s_addr = (tlv->destination_part[0]); - } else if (tlv->prefix_length > 8 && tlv->prefix_length <= 16) { - tlv->destination_part[0] = stream_getc(s); - tlv->destination_part[1] = stream_getc(s); - tlv->destination.s_addr = ((tlv->destination_part[1] << 8) - + tlv->destination_part[0]); - } else if (tlv->prefix_length > 16 && tlv->prefix_length <= 24) { - tlv->destination_part[0] = stream_getc(s); - tlv->destination_part[1] = stream_getc(s); - tlv->destination_part[2] = stream_getc(s); - tlv->destination.s_addr = ((tlv->destination_part[2] << 16) - + (tlv->destination_part[1] << 8) - + tlv->destination_part[0]); - } else if (tlv->prefix_length > 24 && tlv->prefix_length <= 32) { - tlv->destination_part[0] = stream_getc(s); - tlv->destination_part[1] = stream_getc(s); - tlv->destination_part[2] = stream_getc(s); - tlv->destination_part[3] = stream_getc(s); - tlv->destination.s_addr = ((tlv->destination_part[3] << 24) - + (tlv->destination_part[2] << 16) - + (tlv->destination_part[1] << 8) - + tlv->destination_part[0]); - } + destination_tmp = stream_getc(s) << 24; + if (tlv->prefix_length > 8) + destination_tmp |= stream_getc(s) << 16; + if (tlv->prefix_length > 16) + destination_tmp |= stream_getc(s) << 8; + if (tlv->prefix_length > 24) + destination_tmp |= stream_getc(s); + + tlv->destination.s_addr = htonl(destination_tmp); + return tlv; } @@ -1234,15 +1220,13 @@ uint16_t eigrp_add_internalTLV_to_stream(struct stream *s, stream_putc(s, pe->destination->prefixlen); - stream_putc(s, pe->destination->u.prefix4.s_addr & 0xFF); + stream_putc(s, (ntohl(pe->destination->u.prefix4.s_addr) >> 24) & 0xFF); if (pe->destination->prefixlen > 8) - stream_putc(s, (pe->destination->u.prefix4.s_addr >> 8) & 0xFF); + stream_putc(s, (ntohl(pe->destination->u.prefix4.s_addr) >> 16) & 0xFF); if (pe->destination->prefixlen > 16) - stream_putc(s, - (pe->destination->u.prefix4.s_addr >> 16) & 0xFF); + stream_putc(s, (ntohl(pe->destination->u.prefix4.s_addr) >> 8) & 0xFF); if (pe->destination->prefixlen > 24) - stream_putc(s, - (pe->destination->u.prefix4.s_addr >> 24) & 0xFF); + stream_putc(s, ntohl(pe->destination->u.prefix4.s_addr) & 0xFF); return length; } diff --git a/eigrpd/eigrp_structs.h b/eigrpd/eigrp_structs.h index a78e5a53cf..1b9186f011 100644 --- a/eigrpd/eigrp_structs.h +++ b/eigrpd/eigrp_structs.h @@ -409,7 +409,6 @@ struct TLV_IPv4_Internal_type { uint8_t prefix_length; - unsigned char destination_part[4]; struct in_addr destination; } __attribute__((packed)); diff --git a/isisd/isis_misc.c b/isisd/isis_misc.c index 0a42adea37..d4c38efaf3 100644 --- a/isisd/isis_misc.c +++ b/isisd/isis_misc.c @@ -23,6 +23,7 @@ #include <zebra.h> +#include "printfrr.h" #include "stream.h" #include "vty.h" #include "hash.h" @@ -511,42 +512,14 @@ void zlog_dump_data(void *data, int len) return; } -static char *qasprintf(const char *format, va_list ap) -{ - va_list aq; - va_copy(aq, ap); - - int size = 0; - char *p = NULL; - - size = vsnprintf(p, size, format, ap); - - if (size < 0) { - va_end(aq); - return NULL; - } - - size++; - p = XMALLOC(MTYPE_TMP, size); - - size = vsnprintf(p, size, format, aq); - va_end(aq); - - if (size < 0) { - XFREE(MTYPE_TMP, p); - return NULL; - } - - return p; -} - void log_multiline(int priority, const char *prefix, const char *format, ...) { + char shortbuf[256]; va_list ap; char *p; va_start(ap, format); - p = qasprintf(format, ap); + p = asnprintfrr(MTYPE_TMP, shortbuf, sizeof(shortbuf), format, ap); va_end(ap); if (!p) @@ -558,16 +531,18 @@ void log_multiline(int priority, const char *prefix, const char *format, ...) zlog(priority, "%s%s", prefix, line); } - XFREE(MTYPE_TMP, p); + if (p != shortbuf) + XFREE(MTYPE_TMP, p); } void vty_multiline(struct vty *vty, const char *prefix, const char *format, ...) { + char shortbuf[256]; va_list ap; char *p; va_start(ap, format); - p = qasprintf(format, ap); + p = asnprintfrr(MTYPE_TMP, shortbuf, sizeof(shortbuf), format, ap); va_end(ap); if (!p) @@ -579,7 +554,8 @@ void vty_multiline(struct vty *vty, const char *prefix, const char *format, ...) vty_out(vty, "%s%s\n", prefix, line); } - XFREE(MTYPE_TMP, p); + if (p != shortbuf) + XFREE(MTYPE_TMP, p); } void vty_out_timestr(struct vty *vty, time_t uptime) diff --git a/isisd/isis_misc.h b/isisd/isis_misc.h index c551fde7d1..fbfabaf24f 100644 --- a/isisd/isis_misc.h +++ b/isisd/isis_misc.h @@ -79,9 +79,9 @@ enum { ISIS_UI_LEVEL_BRIEF, #include "lib/log.h" void log_multiline(int priority, const char *prefix, const char *format, ...) - PRINTF_ATTRIBUTE(3, 4); + PRINTFRR(3, 4); struct vty; void vty_multiline(struct vty *vty, const char *prefix, const char *format, ...) - PRINTF_ATTRIBUTE(3, 4); + PRINTFRR(3, 4); void vty_out_timestr(struct vty *vty, time_t uptime); #endif diff --git a/lib/clippy.c b/lib/clippy.c index 44dcc02eb8..cd8067f5eb 100644 --- a/lib/clippy.c +++ b/lib/clippy.c @@ -85,8 +85,6 @@ int main(int argc, char **argv) if (PyRun_AnyFile(fp, pyfile)) { if (PyErr_Occurred()) PyErr_Print(); - else - printf("unknown python failure (?)\n"); return 1; } Py_Finalize(); diff --git a/lib/command.c b/lib/command.c index e5e0623163..0e16f30a8a 100644 --- a/lib/command.c +++ b/lib/command.c @@ -1053,9 +1053,16 @@ static int cmd_execute_command_real(vector vline, enum cmd_filter_type filter, if (matched_element->daemon) ret = CMD_SUCCESS_DAEMON; else { - /* Clear enqueued configuration changes. */ - vty->num_cfg_changes = 0; - memset(&vty->cfg_changes, 0, sizeof(vty->cfg_changes)); + if (vty->config) { + /* Clear array of enqueued configuration changes. */ + vty->num_cfg_changes = 0; + memset(&vty->cfg_changes, 0, sizeof(vty->cfg_changes)); + + /* Regenerate candidate configuration. */ + if (frr_get_cli_mode() == FRR_CLI_CLASSIC) + nb_config_replace(vty->candidate_config, + running_config, true); + } ret = matched_element->func(matched_element, vty, argc, argv); } diff --git a/lib/compiler.h b/lib/compiler.h index 9ce91e3361..7c7f4ce294 100644 --- a/lib/compiler.h +++ b/lib/compiler.h @@ -173,6 +173,11 @@ extern "C" { #endif #endif +#ifdef container_of +#undef container_of +#endif + +#if !(defined(__cplusplus) || defined(test__cplusplus)) /* this variant of container_of() retains 'const' on pointers without needing * to be told to do so. The following will all work without warning: * @@ -191,9 +196,6 @@ extern "C" { * struct cont *x = container_of(cp, const struct cont, member); * struct cont *x = container_of(p, const struct cont, member); */ -#ifdef container_of -#undef container_of -#endif #define container_of(ptr, type, member) \ (__builtin_choose_expr( \ __builtin_types_compatible_p(typeof(&((type *)0)->member), \ @@ -209,6 +211,15 @@ extern "C" { offsetof(type, member)); \ }) \ )) +#else +/* current C++ compilers don't have the builtins used above; so this version + * of the macro doesn't do the const check. */ +#define container_of(ptr, type, member) \ + ({ \ + const typeof(((type *)0)->member) *__mptr = (ptr); \ + (type *)((char *)__mptr - offsetof(type, member)); \ + }) +#endif #define container_of_null(ptr, type, member) \ ({ \ @@ -218,6 +229,68 @@ extern "C" { #define array_size(ar) (sizeof(ar) / sizeof(ar[0])) +/* sigh. this is so ugly, it overflows and wraps to being nice again. + * + * printfrr() supports "%Ld" for <int64_t>, whatever that is typedef'd to. + * However, gcc & clang think that "%Ld" is <long long>, which doesn't quite + * match up since int64_t is <long> on a lot of 64-bit systems. + * + * If we have _FRR_ATTRIBUTE_PRINTFRR, we loaded a compiler plugin that + * replaces the whole format checking bits with a custom version that + * understands "%Ld" (along with "%pI4" and co.), so we don't need to do + * anything. + * + * If we don't have that attribute... we still want -Wformat to work. So, + * this is the "f*ck it" approach and we just redefine int64_t to always be + * <long long>. This should work until such a time that <long long> is + * something else (e.g. 128-bit integer)... let's just guard against that + * with the _Static_assert below and work with the world we have right now, + * where <long long> is always 64-bit. + */ + +/* these need to be included before any of the following, so we can + * "overwrite" things. + */ +#include <stdint.h> +#include <inttypes.h> + +#ifdef _FRR_ATTRIBUTE_PRINTFRR +#define PRINTFRR(a, b) __attribute__((printfrr(a, b))) + +#else /* !_FRR_ATTRIBUTE_PRINTFRR */ +#define PRINTFRR(a, b) __attribute__((format(printf, a, b))) + +/* these should be typedefs, but might also be #define */ +#ifdef uint64_t +#undef uint64_t +#endif +#ifdef int64_t +#undef int64_t +#endif + +/* can't overwrite the typedef, but we can replace int64_t with _int64_t */ +typedef unsigned long long _uint64_t; +#define uint64_t _uint64_t +typedef signed long long _int64_t; +#define int64_t _int64_t + +/* if this breaks, 128-bit machines may have entered reality (or <long long> + * is something weird) + */ +#if __STDC_VERSION__ >= 201112L +_Static_assert(sizeof(_uint64_t) == 8 && sizeof(_int64_t) == 8, + "nobody expects the spanish intquisition"); +#endif + +/* since we redefined int64_t, we also need to redefine PRI*64 */ +#undef PRIu64 +#undef PRId64 +#undef PRIx64 +#define PRIu64 "llu" +#define PRId64 "lld" +#define PRIx64 "llx" +#endif /* !_FRR_ATTRIBUTE_PRINTFRR */ + #ifdef __cplusplus } #endif diff --git a/lib/defun_lex.l b/lib/defun_lex.l index 6c0805a4fa..19b06f51b8 100644 --- a/lib/defun_lex.l +++ b/lib/defun_lex.l @@ -163,7 +163,7 @@ static int yylex_clr(char **retbuf) return rv; } -static PyObject *get_args(void) +static PyObject *get_args(const char *filename, int lineno) { PyObject *pyObj = PyList_New(0); PyObject *pyArg = NULL; @@ -190,6 +190,13 @@ static PyObject *get_args(void) free(tval); continue; } + if (token == PREPROC) { + free(tval); + Py_DECREF(pyObj); + return PyErr_Format(PyExc_ValueError, + "%s:%d: cannot process CPP directive within argument list", + filename, lineno); + } if (token == SPECIAL) { if (depth == 1 && (tval[0] == ',' || tval[0] == ')')) { if (pyArg) @@ -244,7 +251,12 @@ PyObject *clippy_parse(PyObject *self, PyObject *args) case DEFUNNY: case INSTALL: case AUXILIARY: - pyArgs = get_args(); + pyArgs = get_args(filename, lineno); + if (!pyArgs) { + free(tval); + Py_DECREF(pyCont); + return NULL; + } pyItem = PyDict_New(); PyDict_SetItemString(pyItem, "type", PyUnicode_FromString(tval)); PyDict_SetItemString(pyItem, "args", pyArgs); @@ -260,6 +272,7 @@ PyObject *clippy_parse(PyObject *self, PyObject *args) pyItem = PyDict_New(); PyDict_SetItemString(pyItem, "type", PyUnicode_FromString("PREPROC")); PyDict_SetItemString(pyItem, "line", PyUnicode_FromString(tval)); + lineno--; break; } if (pyItem) { diff --git a/lib/iana_afi.h b/lib/iana_afi.h new file mode 100644 index 0000000000..ac03f73193 --- /dev/null +++ b/lib/iana_afi.h @@ -0,0 +1,133 @@ +/* + * iana_afi and safi definitions. + * Copyright (C) 2018-2019 Cumulus Networks, Inc. + * Donald Sharp + * + * 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 + */ +#ifndef __IANA_AFI_H__ + +#include <prefix.h> + +/* + * The above AFI and SAFI definitions are for internal use. The protocol + * definitions (IANA values) as for example used in BGP protocol packets + * are defined below and these will get mapped to/from the internal values + * in the appropriate places. + * The rationale is that the protocol (IANA) values may be sparse and are + * not optimal for use in data-structure sizing. + * Note: Only useful (i.e., supported) values are defined below. + */ +typedef enum { + IANA_AFI_RESERVED = 0, + IANA_AFI_IPV4 = 1, + IANA_AFI_IPV6 = 2, + IANA_AFI_L2VPN = 25, +} iana_afi_t; + +typedef enum { + IANA_SAFI_RESERVED = 0, + IANA_SAFI_UNICAST = 1, + IANA_SAFI_MULTICAST = 2, + IANA_SAFI_LABELED_UNICAST = 4, + IANA_SAFI_ENCAP = 7, + IANA_SAFI_EVPN = 70, + IANA_SAFI_MPLS_VPN = 128, + IANA_SAFI_FLOWSPEC = 133 +} iana_safi_t; + +static inline afi_t afi_iana2int(iana_afi_t afi) +{ + switch (afi) { + case IANA_AFI_IPV4: + return AFI_IP; + case IANA_AFI_IPV6: + return AFI_IP6; + case IANA_AFI_L2VPN: + return AFI_L2VPN; + default: + return AFI_MAX; + } +} + +static inline iana_afi_t afi_int2iana(afi_t afi) +{ + switch (afi) { + case AFI_IP: + return IANA_AFI_IPV4; + case AFI_IP6: + return IANA_AFI_IPV6; + case AFI_L2VPN: + return IANA_AFI_L2VPN; + default: + return IANA_AFI_RESERVED; + } +} + +static inline const char *iana_afi2str(iana_afi_t afi) +{ + return afi2str(afi_iana2int(afi)); +} + +static inline safi_t safi_iana2int(iana_safi_t safi) +{ + switch (safi) { + case IANA_SAFI_UNICAST: + return SAFI_UNICAST; + case IANA_SAFI_MULTICAST: + return SAFI_MULTICAST; + case IANA_SAFI_MPLS_VPN: + return SAFI_MPLS_VPN; + case IANA_SAFI_ENCAP: + return SAFI_ENCAP; + case IANA_SAFI_EVPN: + return SAFI_EVPN; + case IANA_SAFI_LABELED_UNICAST: + return SAFI_LABELED_UNICAST; + case IANA_SAFI_FLOWSPEC: + return SAFI_FLOWSPEC; + default: + return SAFI_MAX; + } +} + +static inline iana_safi_t safi_int2iana(safi_t safi) +{ + switch (safi) { + case SAFI_UNICAST: + return IANA_SAFI_UNICAST; + case SAFI_MULTICAST: + return IANA_SAFI_MULTICAST; + case SAFI_MPLS_VPN: + return IANA_SAFI_MPLS_VPN; + case SAFI_ENCAP: + return IANA_SAFI_ENCAP; + case SAFI_EVPN: + return IANA_SAFI_EVPN; + case SAFI_LABELED_UNICAST: + return IANA_SAFI_LABELED_UNICAST; + case SAFI_FLOWSPEC: + return IANA_SAFI_FLOWSPEC; + default: + return IANA_SAFI_RESERVED; + } +} + +static inline const char *iana_safi2str(iana_safi_t safi) +{ + return safi2str(safi_iana2int(safi)); +} + +#endif diff --git a/lib/lib_errors.c b/lib/lib_errors.c index b6c764d873..e0559f332d 100644 --- a/lib/lib_errors.c +++ b/lib/lib_errors.c @@ -51,6 +51,12 @@ static struct log_ref ferr_lib_warn[] = { .suggestion = "Gather log data and open an Issue", }, { + .code = EC_LIB_NO_THREAD, + .title = "The Event subsystem has detected an internal FD problem", + .description = "The Event subsystem has detected a file descriptor read/write event without an associated handling function. This is a bug, please collect log data and open an issue.", + .suggestion = "Gather log data and open an Issue", + }, + { .code = EC_LIB_RMAP_RECURSION_LIMIT, .title = "Reached the Route-Map Recursion Limit", .description = "The Route-Map subsystem has detected a route-map depth of RMAP_RECURSION_LIMIT and has stopped processing", diff --git a/lib/lib_errors.h b/lib/lib_errors.h index 39b39fb065..996a16ba95 100644 --- a/lib/lib_errors.h +++ b/lib/lib_errors.h @@ -45,6 +45,7 @@ enum lib_log_refs { EC_LIB_STREAM, EC_LIB_LINUX_NS, EC_LIB_SLOW_THREAD, + EC_LIB_NO_THREAD, EC_LIB_RMAP_RECURSION_LIMIT, EC_LIB_BACKUP_CONFIG, EC_LIB_VRF_LENGTH, @@ -81,20 +81,13 @@ extern void openzlog(const char *progname, const char *protoname, /* Close zlog function. */ extern void closezlog(void); -/* GCC have printf type attribute check. */ -#ifdef __GNUC__ -#define PRINTF_ATTRIBUTE(a,b) __attribute__ ((__format__ (__printf__, a, b))) -#else -#define PRINTF_ATTRIBUTE(a,b) -#endif /* __GNUC__ */ - /* Handy zlog functions. */ -extern void zlog_err(const char *format, ...) PRINTF_ATTRIBUTE(1, 2); -extern void zlog_warn(const char *format, ...) PRINTF_ATTRIBUTE(1, 2); -extern void zlog_info(const char *format, ...) PRINTF_ATTRIBUTE(1, 2); -extern void zlog_notice(const char *format, ...) PRINTF_ATTRIBUTE(1, 2); -extern void zlog_debug(const char *format, ...) PRINTF_ATTRIBUTE(1, 2); -extern void zlog(int priority, const char *format, ...) PRINTF_ATTRIBUTE(2, 3); +extern void zlog_err(const char *format, ...) PRINTFRR(1, 2); +extern void zlog_warn(const char *format, ...) PRINTFRR(1, 2); +extern void zlog_info(const char *format, ...) PRINTFRR(1, 2); +extern void zlog_notice(const char *format, ...) PRINTFRR(1, 2); +extern void zlog_debug(const char *format, ...) PRINTFRR(1, 2); +extern void zlog(int priority, const char *format, ...) PRINTFRR(2, 3); /* For logs which have error codes associated with them */ #define flog_err(ferr_id, format, ...) \ diff --git a/lib/prefix.c b/lib/prefix.c index 134d9cf908..7abeebcd09 100644 --- a/lib/prefix.c +++ b/lib/prefix.c @@ -1329,13 +1329,29 @@ const char *prefix2str(union prefixconstptr pu, char *str, int size) { const struct prefix *p = pu.p; char buf[PREFIX2STR_BUFFER]; + int byte, tmp, a, b; + bool z = false; + size_t l; switch (p->family) { case AF_INET: case AF_INET6: - snprintf(str, size, "%s/%d", inet_ntop(p->family, &p->u.prefix, - buf, PREFIX2STR_BUFFER), - p->prefixlen); + inet_ntop(p->family, &p->u.prefix, buf, sizeof(buf)); + l = strlen(buf); + buf[l++] = '/'; + byte = p->prefixlen; + if ((tmp = p->prefixlen - 100) >= 0) { + buf[l++] = '1'; + z = true; + byte = tmp; + } + b = byte % 10; + a = byte / 10; + if (a || z) + buf[l++] = '0' + a; + buf[l++] = '0' + b; + buf[l] = '\0'; + strlcpy(str, buf, size); break; case AF_ETHERNET: @@ -1349,11 +1365,11 @@ const char *prefix2str(union prefixconstptr pu, char *str, int size) break; case AF_FLOWSPEC: - sprintf(str, "FS prefix"); + strlcpy(str, "FS prefix", size); break; default: - sprintf(str, "UNK prefix"); + strlcpy(str, "UNK prefix", size); break; } diff --git a/lib/sbuf.c b/lib/sbuf.c index 03a2be3e09..c04af153b1 100644 --- a/lib/sbuf.c +++ b/lib/sbuf.c @@ -22,6 +22,7 @@ */ #include <zebra.h> +#include "printfrr.h" #include "sbuf.h" #include "memory.h" @@ -68,7 +69,7 @@ void sbuf_push(struct sbuf *buf, int indent, const char *format, ...) written1 = indent; va_start(args, format); - written2 = vsnprintf(NULL, 0, format, args); + written2 = vsnprintfrr(NULL, 0, format, args); va_end(args); new_size = buf->size; @@ -92,8 +93,8 @@ void sbuf_push(struct sbuf *buf, int indent, const char *format, ...) buf->pos = buf->size; va_start(args, format); - written = vsnprintf(buf->buf + buf->pos, buf->size - buf->pos, format, - args); + written = vsnprintfrr(buf->buf + buf->pos, buf->size - buf->pos, + format, args); va_end(args); if (written >= 0) diff --git a/lib/sbuf.h b/lib/sbuf.h index b1518a3aa8..9f0311006d 100644 --- a/lib/sbuf.h +++ b/lib/sbuf.h @@ -78,7 +78,7 @@ const char *sbuf_buf(struct sbuf *buf); void sbuf_free(struct sbuf *buf); #include "lib/log.h" void sbuf_push(struct sbuf *buf, int indent, const char *format, ...) - PRINTF_ATTRIBUTE(3, 4); + PRINTFRR(3, 4); #ifdef __cplusplus } diff --git a/lib/subdir.am b/lib/subdir.am index 4e6adced74..8b6cbe2aeb 100644 --- a/lib/subdir.am +++ b/lib/subdir.am @@ -3,7 +3,7 @@ # lib_LTLIBRARIES += lib/libfrr.la lib_libfrr_la_LDFLAGS = -version-info 0:0:0 -Xlinker -e_libfrr_version -lib_libfrr_la_LIBADD = $(LIBCAP) $(UNWIND_LIBS) $(LIBYANG_LIBS) $(LUA_LIB) +lib_libfrr_la_LIBADD = $(LIBCAP) $(UNWIND_LIBS) $(LIBYANG_LIBS) $(LUA_LIB) $(LIBM) lib_libfrr_la_SOURCES = \ lib/agg_table.c \ @@ -165,6 +165,7 @@ pkginclude_HEADERS += \ lib/graph.h \ lib/hash.h \ lib/hook.h \ + lib/iana_afi.h \ lib/id_alloc.h \ lib/if.h \ lib/if_rmap.h \ @@ -340,8 +341,10 @@ noinst_PROGRAMS += \ if BUILD_CLIPPY noinst_PROGRAMS += lib/clippy else -$(HOSTTOOLS)lib/clippy: - @$(MAKE) -C $(top_builddir)/$(HOSTTOOLS) lib/route_types.h lib/clippy +if HOSTTOOLS_CLIPPY +$(CLIPPY): + @$(MAKE) -C $(top_builddir)/hosttools lib/route_types.h lib/clippy +endif endif lib_grammar_sandbox_SOURCES = \ @@ -372,13 +375,11 @@ am__v_CLIPPY_ = $(am__v_CLIPPY_$(AM_DEFAULT_VERBOSITY)) am__v_CLIPPY_0 = @echo " CLIPPY " $@; am__v_CLIPPY_1 = -CLIPPY_DEPS = $(HOSTTOOLS)lib/clippy $(top_srcdir)/python/clidef.py +CLIPPY_DEPS = $(CLIPPY) $(top_srcdir)/python/clidef.py SUFFIXES = _clippy.c .proto .pb-c.c .pb-c.h .pb.h .pb.cc .grpc.pb.cc .c_clippy.c: - @{ test -x $(top_builddir)/$(HOSTTOOLS)lib/clippy || \ - $(MAKE) -C $(top_builddir)/$(HOSTTOOLS) lib/clippy; } - $(AM_V_CLIPPY) $(top_builddir)/$(HOSTTOOLS)lib/clippy $(top_srcdir)/python/clidef.py -o $@ $< + $(AM_V_CLIPPY) $(CLIPPY) $(top_srcdir)/python/clidef.py -o $@ $< ## automake's "ylwrap" is a great piece of GNU software... not. .l.c: diff --git a/lib/termtable.c b/lib/termtable.c index 01468b8203..b59c1118f8 100644 --- a/lib/termtable.c +++ b/lib/termtable.c @@ -20,6 +20,7 @@ #include <zebra.h> #include <stdio.h> +#include "printfrr.h" #include "memory.h" #include "termtable.h" @@ -134,6 +135,7 @@ static struct ttable_cell *ttable_insert_row_va(struct ttable *tt, int i, { assert(i >= -1 && i < tt->nrows); + char shortbuf[256]; char *res, *orig, *section; struct ttable_cell *row; int col = 0; @@ -158,9 +160,7 @@ static struct ttable_cell *ttable_insert_row_va(struct ttable *tt, int i, /* CALLOC a block of cells */ row = XCALLOC(MTYPE_TTABLE, tt->ncols * sizeof(struct ttable_cell)); - res = NULL; - vasprintf(&res, format, ap); - + res = vasnprintfrr(MTYPE_TMP, shortbuf, sizeof(shortbuf), format, ap); orig = res; while (res && col < tt->ncols) { @@ -170,7 +170,8 @@ static struct ttable_cell *ttable_insert_row_va(struct ttable *tt, int i, col++; } - free(orig); + if (orig != shortbuf) + XFREE(MTYPE_TMP, orig); /* insert row */ if (i == -1 || i == tt->nrows) diff --git a/lib/termtable.h b/lib/termtable.h index 491010a856..4f7c595ce2 100644 --- a/lib/termtable.h +++ b/lib/termtable.h @@ -137,8 +137,7 @@ void ttable_cell_del(struct ttable_cell *cell); * columns were specified */ struct ttable_cell *ttable_insert_row(struct ttable *tt, unsigned int row, - const char *format, ...) - PRINTF_ATTRIBUTE(3, 4); + const char *format, ...) PRINTFRR(3, 4); /** * Inserts a new row at the end of the table. * @@ -164,7 +163,7 @@ struct ttable_cell *ttable_insert_row(struct ttable *tt, unsigned int row, * columns were specified */ struct ttable_cell *ttable_add_row(struct ttable *tt, const char *format, ...) - PRINTF_ATTRIBUTE(2, 3); + PRINTFRR(2, 3); /** * Removes a row from the table. diff --git a/lib/thread.c b/lib/thread.c index 7489be5c2d..fc2de09df0 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -307,6 +307,7 @@ static void show_thread_poll_helper(struct vty *vty, struct thread_master *m) { const char *name = m->name ? m->name : "main"; char underline[strlen(name) + 1]; + struct thread *thread; uint32_t i; memset(underline, '-', sizeof(underline)); @@ -316,11 +317,31 @@ static void show_thread_poll_helper(struct vty *vty, struct thread_master *m) vty_out(vty, "----------------------%s\n", underline); vty_out(vty, "Count: %u/%d\n", (uint32_t)m->handler.pfdcount, m->fd_limit); - for (i = 0; i < m->handler.pfdcount; i++) - vty_out(vty, "\t%6d fd:%6d events:%2d revents:%2d\n", i, - m->handler.pfds[i].fd, - m->handler.pfds[i].events, + for (i = 0; i < m->handler.pfdcount; i++) { + vty_out(vty, "\t%6d fd:%6d events:%2d revents:%2d\t\t", i, + m->handler.pfds[i].fd, m->handler.pfds[i].events, m->handler.pfds[i].revents); + + if (m->handler.pfds[i].events & POLLIN) { + thread = m->read[m->handler.pfds[i].fd]; + + if (!thread) + vty_out(vty, "ERROR "); + else + vty_out(vty, "%s ", thread->funcname); + } else + vty_out(vty, " "); + + if (m->handler.pfds[i].events & POLLOUT) { + thread = m->write[m->handler.pfds[i].fd]; + + if (!thread) + vty_out(vty, "ERROR\n"); + else + vty_out(vty, "%s\n", thread->funcname); + } else + vty_out(vty, "\n"); + } } DEFUN (show_thread_poll, @@ -756,6 +777,7 @@ struct thread *funcname_thread_add_read_write(int dir, struct thread_master *m, debugargdef) { struct thread *thread = NULL; + struct thread **thread_array; assert(fd >= 0 && fd < m->fd_limit); pthread_mutex_lock(&m->mtx); @@ -770,11 +792,25 @@ struct thread *funcname_thread_add_read_write(int dir, struct thread_master *m, /* default to a new pollfd */ nfds_t queuepos = m->handler.pfdcount; + if (dir == THREAD_READ) + thread_array = m->read; + else + thread_array = m->write; + /* if we already have a pollfd for our file descriptor, find and * use it */ for (nfds_t i = 0; i < m->handler.pfdcount; i++) if (m->handler.pfds[i].fd == fd) { queuepos = i; + +#ifdef DEV_BUILD + /* + * What happens if we have a thread already + * created for this event? + */ + if (thread_array[fd]) + assert(!"Thread already scheduled for file descriptor"); +#endif break; } @@ -794,10 +830,7 @@ struct thread *funcname_thread_add_read_write(int dir, struct thread_master *m, pthread_mutex_lock(&thread->mtx); { thread->u.fd = fd; - if (dir == THREAD_READ) - m->read[thread->u.fd] = thread; - else - m->write[thread->u.fd] = thread; + thread_array[thread->u.fd] = thread; } pthread_mutex_unlock(&thread->mtx); @@ -1238,12 +1271,31 @@ static struct thread *thread_run(struct thread_master *m, struct thread *thread, } static int thread_process_io_helper(struct thread_master *m, - struct thread *thread, short state, int pos) + struct thread *thread, short state, + short actual_state, int pos) { struct thread **thread_array; - if (!thread) + /* + * poll() clears the .events field, but the pollfd array we + * pass to poll() is a copy of the one used to schedule threads. + * We need to synchronize state between the two here by applying + * the same changes poll() made on the copy of the "real" pollfd + * array. + * + * This cleans up a possible infinite loop where we refuse + * to respond to a poll event but poll is insistent that + * we should. + */ + m->handler.pfds[pos].events &= ~(state); + + if (!thread) { + if ((actual_state & (POLLHUP|POLLIN)) != POLLHUP) + flog_err(EC_LIB_NO_THREAD, + "Attempting to process an I/O event but for fd: %d(%d) no thread to handle this!\n", + m->handler.pfds[pos].fd, actual_state); return 0; + } if (thread->type == THREAD_READ) thread_array = m->read; @@ -1253,9 +1305,7 @@ static int thread_process_io_helper(struct thread_master *m, thread_array[thread->u.fd] = NULL; thread_list_add_tail(&m->ready, thread); thread->type = THREAD_READY; - /* if another pthread scheduled this file descriptor for the event we're - * responding to, no problem; we're getting to it now */ - thread->master->handler.pfds[pos].events &= ~(state); + return 1; } @@ -1291,12 +1341,13 @@ static void thread_process_io(struct thread_master *m, unsigned int num) * there's no need to update it. Similarily, barring deletion, * the fd * should still be a valid index into the master's pfds. */ - if (pfds[i].revents & (POLLIN | POLLHUP)) + if (pfds[i].revents & (POLLIN | POLLHUP)) { thread_process_io_helper(m, m->read[pfds[i].fd], POLLIN, - i); + pfds[i].revents, i); + } if (pfds[i].revents & POLLOUT) thread_process_io_helper(m, m->write[pfds[i].fd], - POLLOUT, i); + POLLOUT, pfds[i].revents, i); /* if one of our file descriptors is garbage, remove the same * from @@ -105,8 +105,8 @@ void vty_frame(struct vty *vty, const char *format, ...) va_list args; va_start(args, format); - vsnprintf(vty->frame + vty->frame_pos, - sizeof(vty->frame) - vty->frame_pos, format, args); + vsnprintfrr(vty->frame + vty->frame_pos, + sizeof(vty->frame) - vty->frame_pos, format, args); vty->frame_pos = strlen(vty->frame); va_end(args); } @@ -2289,6 +2289,7 @@ static void vty_read_file(struct nb_config *config, FILE *confp) vty->wfd = STDERR_FILENO; vty->type = VTY_FILE; vty->node = CONFIG_NODE; + vty->config = true; if (config) vty->candidate_config = config; else { @@ -302,8 +302,8 @@ extern struct vty *vty_stdio(void (*atclose)(int isexit)); * - vty_endframe() clears the buffer without printing it, and prints an * extra string if the buffer was empty before (for context-end markers) */ -extern int vty_out(struct vty *, const char *, ...) PRINTF_ATTRIBUTE(2, 3); -extern void vty_frame(struct vty *, const char *, ...) PRINTF_ATTRIBUTE(2, 3); +extern int vty_out(struct vty *, const char *, ...) PRINTFRR(2, 3); +extern void vty_frame(struct vty *, const char *, ...) PRINTFRR(2, 3); extern void vty_endframe(struct vty *, const char *); bool vty_set_include(struct vty *vty, const char *regexp); diff --git a/lib/zebra.h b/lib/zebra.h index 2f9ada09be..22239f8e60 100644 --- a/lib/zebra.h +++ b/lib/zebra.h @@ -244,13 +244,6 @@ size_t strlcpy(char *__restrict dest, const char *__restrict src, size_t destsize); #endif -/* GCC have printf type attribute check. */ -#ifdef __GNUC__ -#define PRINTF_ATTRIBUTE(a,b) __attribute__ ((__format__ (__printf__, a, b))) -#else -#define PRINTF_ATTRIBUTE(a,b) -#endif /* __GNUC__ */ - /* * RFC 3542 defines several macros for using struct cmsghdr. * Here, we define those that are not present @@ -373,35 +366,6 @@ typedef enum { SAFI_MAX = 8 } safi_t; -/* - * The above AFI and SAFI definitions are for internal use. The protocol - * definitions (IANA values) as for example used in BGP protocol packets - * are defined below and these will get mapped to/from the internal values - * in the appropriate places. - * The rationale is that the protocol (IANA) values may be sparse and are - * not optimal for use in data-structure sizing. - * Note: Only useful (i.e., supported) values are defined below. - */ -typedef enum { - IANA_AFI_RESERVED = 0, - IANA_AFI_IPV4 = 1, - IANA_AFI_IPV6 = 2, - IANA_AFI_L2VPN = 25, - IANA_AFI_IPMR = 128, - IANA_AFI_IP6MR = 129 -} iana_afi_t; - -typedef enum { - IANA_SAFI_RESERVED = 0, - IANA_SAFI_UNICAST = 1, - IANA_SAFI_MULTICAST = 2, - IANA_SAFI_LABELED_UNICAST = 4, - IANA_SAFI_ENCAP = 7, - IANA_SAFI_EVPN = 70, - IANA_SAFI_MPLS_VPN = 128, - IANA_SAFI_FLOWSPEC = 133 -} iana_safi_t; - /* Default Administrative Distance of each protocol. */ #define ZEBRA_KERNEL_DISTANCE_DEFAULT 0 #define ZEBRA_CONNECT_DISTANCE_DEFAULT 0 @@ -439,76 +403,4 @@ typedef uint32_t route_tag_t; #define ROUTE_TAG_MAX UINT32_MAX #define ROUTE_TAG_PRI PRIu32 -static inline afi_t afi_iana2int(iana_afi_t afi) -{ - switch (afi) { - case IANA_AFI_IPV4: - return AFI_IP; - case IANA_AFI_IPV6: - return AFI_IP6; - case IANA_AFI_L2VPN: - return AFI_L2VPN; - default: - return AFI_MAX; - } -} - -static inline iana_afi_t afi_int2iana(afi_t afi) -{ - switch (afi) { - case AFI_IP: - return IANA_AFI_IPV4; - case AFI_IP6: - return IANA_AFI_IPV6; - case AFI_L2VPN: - return IANA_AFI_L2VPN; - default: - return IANA_AFI_RESERVED; - } -} - -static inline safi_t safi_iana2int(iana_safi_t safi) -{ - switch (safi) { - case IANA_SAFI_UNICAST: - return SAFI_UNICAST; - case IANA_SAFI_MULTICAST: - return SAFI_MULTICAST; - case IANA_SAFI_MPLS_VPN: - return SAFI_MPLS_VPN; - case IANA_SAFI_ENCAP: - return SAFI_ENCAP; - case IANA_SAFI_EVPN: - return SAFI_EVPN; - case IANA_SAFI_LABELED_UNICAST: - return SAFI_LABELED_UNICAST; - case IANA_SAFI_FLOWSPEC: - return SAFI_FLOWSPEC; - default: - return SAFI_MAX; - } -} - -static inline iana_safi_t safi_int2iana(safi_t safi) -{ - switch (safi) { - case SAFI_UNICAST: - return IANA_SAFI_UNICAST; - case SAFI_MULTICAST: - return IANA_SAFI_MULTICAST; - case SAFI_MPLS_VPN: - return IANA_SAFI_MPLS_VPN; - case SAFI_ENCAP: - return IANA_SAFI_ENCAP; - case SAFI_EVPN: - return IANA_SAFI_EVPN; - case SAFI_LABELED_UNICAST: - return IANA_SAFI_LABELED_UNICAST; - case SAFI_FLOWSPEC: - return IANA_SAFI_FLOWSPEC; - default: - return IANA_SAFI_RESERVED; - } -} - #endif /* _ZEBRA_H */ diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index 18e84fef23..c6617d9d21 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -8717,9 +8717,17 @@ DEFUN (no_ip_pim_ucast_bsm, #if HAVE_BFDD > 0 DEFUN_HIDDEN( + ip_pim_bfd_param, + ip_pim_bfd_param_cmd, + "ip pim bfd (2-255) (50-60000) (50-60000)", + IP_STR + PIM_STR + "Enables BFD support\n" + "Detect Multiplier\n" + "Required min receive interval\n" + "Desired min transmit interval\n") #else DEFUN( -#endif /* HAVE_BFDD */ ip_pim_bfd_param, ip_pim_bfd_param_cmd, "ip pim bfd (2-255) (50-60000) (50-60000)", @@ -8729,6 +8737,7 @@ DEFUN( "Detect Multiplier\n" "Required min receive interval\n" "Desired min transmit interval\n") +#endif /* HAVE_BFDD */ { VTY_DECLVAR_CONTEXT(interface, ifp); int idx_number = 3; diff --git a/python/clidef.py b/python/clidef.py index f8d96115bd..85464a62d4 100644 --- a/python/clidef.py +++ b/python/clidef.py @@ -37,6 +37,7 @@ class RenderHandler(object): deref = '' drop_str = False canfail = True + canassert = False class StringHandler(RenderHandler): argtype = 'const char *' @@ -44,6 +45,7 @@ class StringHandler(RenderHandler): code = Template('$varname = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg;') drop_str = True canfail = False + canassert = True class LongHandler(RenderHandler): argtype = 'long' @@ -111,6 +113,7 @@ if (argv[_i]->text[0] == 'X') { _fail = !inet_aton(argv[_i]->arg, &s__$varname.sin.sin_addr); $varname = &s__$varname; }''') + canassert = True def mix_handlers(handlers): def combine(a, b): @@ -171,6 +174,7 @@ $argblocks return CMD_WARNING; #endif #endif +$argassert return ${fnname}_magic(self, vty, argc, argv$arglist); } @@ -182,16 +186,72 @@ argblock = Template(''' $code }''') -def process_file(fn, ofd, dumpfd, all_defun): +def get_always_args(token, always_args, args = [], stack = []): + if token in stack: + return + if token.type == 'END_TKN': + for arg in list(always_args): + if arg not in args: + always_args.remove(arg) + return + + stack = stack + [token] + if token.type in handlers and token.varname is not None: + args = args + [token.varname] + for nexttkn in token.next(): + get_always_args(nexttkn, always_args, args, stack) + +class Macros(dict): + def load(self, filename): + filedata = clippy.parse(filename) + for entry in filedata['data']: + if entry['type'] != 'PREPROC': + continue + ppdir = entry['line'].lstrip().split(None, 1) + if ppdir[0] != 'define' or len(ppdir) != 2: + continue + ppdef = ppdir[1].split(None, 1) + name = ppdef[0] + if '(' in name: + continue + val = ppdef[1] if len(ppdef) == 2 else '' + + val = val.strip(' \t\n\\') + if name in self: + sys.stderr.write('warning: macro %s redefined!\n' % (name)) + self[name] = val + +def process_file(fn, ofd, dumpfd, all_defun, macros): + errors = 0 filedata = clippy.parse(fn) for entry in filedata['data']: if entry['type'].startswith('DEFPY') or (all_defun and entry['type'].startswith('DEFUN')): + if len(entry['args'][0]) != 1: + sys.stderr.write('%s:%d: DEFPY function name not parseable (%r)\n' % (fn, entry['lineno'], entry['args'][0])) + errors += 1 + continue + cmddef = entry['args'][2] - cmddef = ''.join([i[1:-1] for i in cmddef]) + cmddefx = [] + for i in cmddef: + while i in macros: + i = macros[i] + if i.startswith('"') and i.endswith('"'): + cmddefx.append(i[1:-1]) + continue + + sys.stderr.write('%s:%d: DEFPY command string not parseable (%r)\n' % (fn, entry['lineno'], cmddef)) + errors += 1 + cmddefx = None + break + if cmddefx is None: + continue + cmddef = ''.join([i for i in cmddefx]) graph = clippy.Graph(cmddef) args = OrderedDict() + always_args = set() for token, depth in clippy.graph_iterate(graph): if token.type not in handlers: continue @@ -199,6 +259,9 @@ def process_file(fn, ofd, dumpfd, all_defun): continue arg = args.setdefault(token.varname, []) arg.append(handlers[token.type](token)) + always_args.add(token.varname) + + get_always_args(graph.first(), always_args) #print('-' * 76) #pprint(entry) @@ -210,30 +273,36 @@ def process_file(fn, ofd, dumpfd, all_defun): argdecls = [] arglist = [] argblocks = [] + argassert = [] doc = [] canfail = 0 - def do_add(handler, varname, attr = ''): + def do_add(handler, basename, varname, attr = ''): argdefs.append(',\\\n\t%s %s%s' % (handler.argtype, varname, attr)) argdecls.append('\t%s\n' % (handler.decl.substitute({'varname': varname}).replace('\n', '\n\t'))) arglist.append(', %s%s' % (handler.deref, varname)) + if basename in always_args and handler.canassert: + argassert.append('''\tif (!%s) { +\t\tvty_out(vty, "Internal CLI error [%%s]\\n", "%s"); +\t\treturn CMD_WARNING; +\t}\n''' % (varname, varname)) if attr == '': at = handler.argtype if not at.startswith('const '): at = '. . . ' + at - doc.append('\t%-26s %s' % (at, varname)) + doc.append('\t%-26s %s %s' % (at, 'alw' if basename in always_args else 'opt', varname)) for varname in args.keys(): handler = mix_handlers(args[varname]) #print(varname, handler) if handler is None: continue - do_add(handler, varname) + do_add(handler, varname, varname) code = handler.code.substitute({'varname': varname}).replace('\n', '\n\t\t\t') if handler.canfail: canfail = 1 strblock = '' if not handler.drop_str: - do_add(StringHandler(None), '%s_str' % (varname), ' __attribute__ ((unused))') + do_add(StringHandler(None), varname, '%s_str' % (varname), ' __attribute__ ((unused))') strblock = '\n\t\t\t%s_str = argv[_i]->arg;' % (varname) argblocks.append(argblock.substitute({'varname': varname, 'strblock': strblock, 'code': code})) @@ -249,8 +318,11 @@ def process_file(fn, ofd, dumpfd, all_defun): params['argblocks'] = ''.join(argblocks) params['canfail'] = canfail params['nonempty'] = len(argblocks) + params['argassert'] = ''.join(argassert) ofd.write(templ.substitute(params)) + return errors + if __name__ == '__main__': import argparse @@ -274,7 +346,15 @@ if __name__ == '__main__': if args.show: dumpfd = sys.stderr - process_file(args.cfile, ofd, dumpfd, args.all_defun) + macros = Macros() + macros.load('lib/route_types.h') + macros.load('lib/command.h') + # sigh :( + macros['PROTO_REDIST_STR'] = 'FRR_REDIST_STR_ISISD' + + errors = process_file(args.cfile, ofd, dumpfd, args.all_defun, macros) + if errors != 0: + sys.exit(1) if args.o is not None: clippy.wrdiff(args.o, ofd, [args.cfile, os.path.realpath(__file__), sys.executable]) diff --git a/tests/.gitignore b/tests/.gitignore index 4c6a51d475..6252cea823 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -31,6 +31,7 @@ /lib/test_memory /lib/test_nexthop_iter /lib/test_ntop +/lib/test_prefix2str /lib/test_printfrr /lib/test_privs /lib/test_ringbuf diff --git a/tests/Makefile.in b/tests/Makefile.in deleted file mode 100644 index 29d903e70a..0000000000 --- a/tests/Makefile.in +++ /dev/null @@ -1,1338 +0,0 @@ -# Makefile.in generated by automake 1.15.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2017 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# -# Automake fragment intended to be shared by Makefile.am files in the -# tree. -# - -VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -check_PROGRAMS = lib/test_buffer$(EXEEXT) lib/test_checksum$(EXEEXT) \ - lib/test_heavy_thread$(EXEEXT) lib/test_heavy_wq$(EXEEXT) \ - lib/test_heavy$(EXEEXT) lib/test_memory$(EXEEXT) \ - lib/test_nexthop_iter$(EXEEXT) lib/test_privs$(EXEEXT) \ - lib/test_ringbuf$(EXEEXT) lib/test_srcdest_table$(EXEEXT) \ - lib/test_segv$(EXEEXT) lib/test_sig$(EXEEXT) \ - lib/test_stream$(EXEEXT) lib/test_table$(EXEEXT) \ - lib/test_timer_correctness$(EXEEXT) \ - lib/test_timer_performance$(EXEEXT) lib/test_ttable$(EXEEXT) \ - lib/cli/test_cli$(EXEEXT) lib/cli/test_commands$(EXEEXT) \ - $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ - $(am__EXEEXT_4) -@ZEROMQ_TRUE@am__append_1 = \ -@ZEROMQ_TRUE@ lib/test_zmq \ -@ZEROMQ_TRUE@ # end - -subdir = tests -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ - $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ - $(am__DIST_COMMON) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -@BGPD_TRUE@am__EXEEXT_1 = bgpd/test_aspath$(EXEEXT) \ -@BGPD_TRUE@ bgpd/test_capability$(EXEEXT) \ -@BGPD_TRUE@ bgpd/test_packet$(EXEEXT) \ -@BGPD_TRUE@ bgpd/test_ecommunity$(EXEEXT) \ -@BGPD_TRUE@ bgpd/test_mp_attr$(EXEEXT) bgpd/test_mpath$(EXEEXT) -@ISISD_TRUE@@SOLARIS_FALSE@am__EXEEXT_2 = \ -@ISISD_TRUE@@SOLARIS_FALSE@ isisd/test_fuzz_isis_tlv$(EXEEXT) \ -@ISISD_TRUE@@SOLARIS_FALSE@ isisd/test_isis_vertex_queue$(EXEEXT) -@OSPF6D_TRUE@am__EXEEXT_3 = ospf6d/test_lsdb$(EXEEXT) -@ZEROMQ_TRUE@am__EXEEXT_4 = lib/test_zmq$(EXEEXT) -am__dirstamp = $(am__leading_dot)dirstamp -am_bgpd_test_aspath_OBJECTS = bgpd/test_aspath.$(OBJEXT) -bgpd_test_aspath_OBJECTS = $(am_bgpd_test_aspath_OBJECTS) -@ENABLE_BGP_VNC_TRUE@am__DEPENDENCIES_1 = \ -@ENABLE_BGP_VNC_TRUE@ @top_builddir@/$(LIBRFP)/librfp.a -am__DEPENDENCIES_2 = ../lib/libfrr.la -am__DEPENDENCIES_3 = ../bgpd/libbgp.a $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_2) -bgpd_test_aspath_DEPENDENCIES = $(am__DEPENDENCIES_3) -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -am__v_lt_1 = -am_bgpd_test_capability_OBJECTS = bgpd/test_capability.$(OBJEXT) -bgpd_test_capability_OBJECTS = $(am_bgpd_test_capability_OBJECTS) -bgpd_test_capability_DEPENDENCIES = $(am__DEPENDENCIES_3) -am_bgpd_test_ecommunity_OBJECTS = bgpd/test_ecommunity.$(OBJEXT) -bgpd_test_ecommunity_OBJECTS = $(am_bgpd_test_ecommunity_OBJECTS) -bgpd_test_ecommunity_DEPENDENCIES = $(am__DEPENDENCIES_3) -am_bgpd_test_mp_attr_OBJECTS = bgpd/test_mp_attr.$(OBJEXT) -bgpd_test_mp_attr_OBJECTS = $(am_bgpd_test_mp_attr_OBJECTS) -bgpd_test_mp_attr_DEPENDENCIES = $(am__DEPENDENCIES_3) -am_bgpd_test_mpath_OBJECTS = bgpd/test_mpath.$(OBJEXT) -bgpd_test_mpath_OBJECTS = $(am_bgpd_test_mpath_OBJECTS) -bgpd_test_mpath_DEPENDENCIES = $(am__DEPENDENCIES_3) -am_bgpd_test_packet_OBJECTS = bgpd/test_packet.$(OBJEXT) -bgpd_test_packet_OBJECTS = $(am_bgpd_test_packet_OBJECTS) -bgpd_test_packet_DEPENDENCIES = $(am__DEPENDENCIES_3) -am_isisd_test_fuzz_isis_tlv_OBJECTS = \ - isisd/isisd_test_fuzz_isis_tlv-test_fuzz_isis_tlv.$(OBJEXT) -isisd_test_fuzz_isis_tlv_OBJECTS = \ - $(am_isisd_test_fuzz_isis_tlv_OBJECTS) -am__DEPENDENCIES_4 = ../isisd/libisis.a $(am__DEPENDENCIES_2) -isisd_test_fuzz_isis_tlv_DEPENDENCIES = $(am__DEPENDENCIES_4) -am_isisd_test_isis_vertex_queue_OBJECTS = \ - isisd/test_isis_vertex_queue.$(OBJEXT) -isisd_test_isis_vertex_queue_OBJECTS = \ - $(am_isisd_test_isis_vertex_queue_OBJECTS) -isisd_test_isis_vertex_queue_DEPENDENCIES = $(am__DEPENDENCIES_4) -am_lib_cli_test_cli_OBJECTS = lib/cli/test_cli.$(OBJEXT) \ - lib/cli/common_cli.$(OBJEXT) -lib_cli_test_cli_OBJECTS = $(am_lib_cli_test_cli_OBJECTS) -lib_cli_test_cli_DEPENDENCIES = $(am__DEPENDENCIES_2) -am_lib_cli_test_commands_OBJECTS = \ - lib/cli/test_commands_defun.$(OBJEXT) \ - lib/cli/test_commands.$(OBJEXT) helpers/c/prng.$(OBJEXT) -lib_cli_test_commands_OBJECTS = $(am_lib_cli_test_commands_OBJECTS) -lib_cli_test_commands_DEPENDENCIES = $(am__DEPENDENCIES_2) -am_lib_test_buffer_OBJECTS = lib/test_buffer.$(OBJEXT) -lib_test_buffer_OBJECTS = $(am_lib_test_buffer_OBJECTS) -lib_test_buffer_DEPENDENCIES = $(am__DEPENDENCIES_2) -am_lib_test_checksum_OBJECTS = lib/test_checksum.$(OBJEXT) -lib_test_checksum_OBJECTS = $(am_lib_test_checksum_OBJECTS) -lib_test_checksum_DEPENDENCIES = $(am__DEPENDENCIES_2) -am_lib_test_heavy_OBJECTS = lib/test_heavy.$(OBJEXT) \ - helpers/c/main.$(OBJEXT) -lib_test_heavy_OBJECTS = $(am_lib_test_heavy_OBJECTS) -lib_test_heavy_DEPENDENCIES = $(am__DEPENDENCIES_2) -am_lib_test_heavy_thread_OBJECTS = lib/test_heavy_thread.$(OBJEXT) \ - helpers/c/main.$(OBJEXT) -lib_test_heavy_thread_OBJECTS = $(am_lib_test_heavy_thread_OBJECTS) -lib_test_heavy_thread_DEPENDENCIES = $(am__DEPENDENCIES_2) -am_lib_test_heavy_wq_OBJECTS = lib/test_heavy_wq.$(OBJEXT) \ - helpers/c/main.$(OBJEXT) -lib_test_heavy_wq_OBJECTS = $(am_lib_test_heavy_wq_OBJECTS) -lib_test_heavy_wq_DEPENDENCIES = $(am__DEPENDENCIES_2) -am_lib_test_memory_OBJECTS = lib/test_memory.$(OBJEXT) -lib_test_memory_OBJECTS = $(am_lib_test_memory_OBJECTS) -lib_test_memory_DEPENDENCIES = $(am__DEPENDENCIES_2) -am_lib_test_nexthop_iter_OBJECTS = lib/test_nexthop_iter.$(OBJEXT) \ - helpers/c/prng.$(OBJEXT) -lib_test_nexthop_iter_OBJECTS = $(am_lib_test_nexthop_iter_OBJECTS) -lib_test_nexthop_iter_DEPENDENCIES = $(am__DEPENDENCIES_2) -am_lib_test_privs_OBJECTS = lib/test_privs.$(OBJEXT) -lib_test_privs_OBJECTS = $(am_lib_test_privs_OBJECTS) -lib_test_privs_DEPENDENCIES = $(am__DEPENDENCIES_2) -am_lib_test_ringbuf_OBJECTS = lib/test_ringbuf.$(OBJEXT) -lib_test_ringbuf_OBJECTS = $(am_lib_test_ringbuf_OBJECTS) -lib_test_ringbuf_DEPENDENCIES = $(am__DEPENDENCIES_2) -am_lib_test_segv_OBJECTS = lib/test_segv.$(OBJEXT) -lib_test_segv_OBJECTS = $(am_lib_test_segv_OBJECTS) -lib_test_segv_DEPENDENCIES = $(am__DEPENDENCIES_2) -am_lib_test_sig_OBJECTS = lib/test_sig.$(OBJEXT) -lib_test_sig_OBJECTS = $(am_lib_test_sig_OBJECTS) -lib_test_sig_DEPENDENCIES = $(am__DEPENDENCIES_2) -am_lib_test_srcdest_table_OBJECTS = lib/test_srcdest_table.$(OBJEXT) \ - helpers/c/prng.$(OBJEXT) -lib_test_srcdest_table_OBJECTS = $(am_lib_test_srcdest_table_OBJECTS) -lib_test_srcdest_table_DEPENDENCIES = $(am__DEPENDENCIES_2) -am_lib_test_stream_OBJECTS = lib/test_stream.$(OBJEXT) -lib_test_stream_OBJECTS = $(am_lib_test_stream_OBJECTS) -lib_test_stream_DEPENDENCIES = $(am__DEPENDENCIES_2) -am_lib_test_table_OBJECTS = lib/test_table.$(OBJEXT) -lib_test_table_OBJECTS = $(am_lib_test_table_OBJECTS) -lib_test_table_DEPENDENCIES = $(am__DEPENDENCIES_2) -am_lib_test_timer_correctness_OBJECTS = \ - lib/test_timer_correctness.$(OBJEXT) helpers/c/prng.$(OBJEXT) -lib_test_timer_correctness_OBJECTS = \ - $(am_lib_test_timer_correctness_OBJECTS) -lib_test_timer_correctness_DEPENDENCIES = $(am__DEPENDENCIES_2) -am_lib_test_timer_performance_OBJECTS = \ - lib/test_timer_performance.$(OBJEXT) helpers/c/prng.$(OBJEXT) -lib_test_timer_performance_OBJECTS = \ - $(am_lib_test_timer_performance_OBJECTS) -lib_test_timer_performance_DEPENDENCIES = $(am__DEPENDENCIES_2) -am_lib_test_ttable_OBJECTS = lib/test_ttable.$(OBJEXT) -lib_test_ttable_OBJECTS = $(am_lib_test_ttable_OBJECTS) -lib_test_ttable_DEPENDENCIES = $(am__DEPENDENCIES_2) -am_lib_test_zmq_OBJECTS = lib/lib_test_zmq-test_zmq.$(OBJEXT) -lib_test_zmq_OBJECTS = $(am_lib_test_zmq_OBJECTS) -am__DEPENDENCIES_5 = -lib_test_zmq_DEPENDENCIES = ../lib/libfrrzmq.la $(am__DEPENDENCIES_2) \ - $(am__DEPENDENCIES_5) -lib_test_zmq_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(lib_test_zmq_CFLAGS) \ - $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -am_ospf6d_test_lsdb_OBJECTS = ospf6d/test_lsdb.$(OBJEXT) \ - lib/cli/common_cli.$(OBJEXT) -ospf6d_test_lsdb_OBJECTS = $(am_ospf6d_test_lsdb_OBJECTS) -am__DEPENDENCIES_6 = ../ospf6d/libospf6.a $(am__DEPENDENCIES_2) -ospf6d_test_lsdb_DEPENDENCIES = $(am__DEPENDENCIES_6) -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_@AM_V@) -am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -am__v_CC_1 = -CCLD = $(CC) -LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_@AM_V@) -am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -am__v_CCLD_1 = -SOURCES = $(bgpd_test_aspath_SOURCES) $(bgpd_test_capability_SOURCES) \ - $(bgpd_test_ecommunity_SOURCES) $(bgpd_test_mp_attr_SOURCES) \ - $(bgpd_test_mpath_SOURCES) $(bgpd_test_packet_SOURCES) \ - $(isisd_test_fuzz_isis_tlv_SOURCES) \ - $(isisd_test_isis_vertex_queue_SOURCES) \ - $(lib_cli_test_cli_SOURCES) $(lib_cli_test_commands_SOURCES) \ - $(lib_test_buffer_SOURCES) $(lib_test_checksum_SOURCES) \ - $(lib_test_heavy_SOURCES) $(lib_test_heavy_thread_SOURCES) \ - $(lib_test_heavy_wq_SOURCES) $(lib_test_memory_SOURCES) \ - $(lib_test_nexthop_iter_SOURCES) $(lib_test_privs_SOURCES) \ - $(lib_test_ringbuf_SOURCES) $(lib_test_segv_SOURCES) \ - $(lib_test_sig_SOURCES) $(lib_test_srcdest_table_SOURCES) \ - $(lib_test_stream_SOURCES) $(lib_test_table_SOURCES) \ - $(lib_test_timer_correctness_SOURCES) \ - $(lib_test_timer_performance_SOURCES) \ - $(lib_test_ttable_SOURCES) $(lib_test_zmq_SOURCES) \ - $(ospf6d_test_lsdb_SOURCES) -DIST_SOURCES = $(bgpd_test_aspath_SOURCES) \ - $(bgpd_test_capability_SOURCES) \ - $(bgpd_test_ecommunity_SOURCES) $(bgpd_test_mp_attr_SOURCES) \ - $(bgpd_test_mpath_SOURCES) $(bgpd_test_packet_SOURCES) \ - $(isisd_test_fuzz_isis_tlv_SOURCES) \ - $(isisd_test_isis_vertex_queue_SOURCES) \ - $(lib_cli_test_cli_SOURCES) $(lib_cli_test_commands_SOURCES) \ - $(lib_test_buffer_SOURCES) $(lib_test_checksum_SOURCES) \ - $(lib_test_heavy_SOURCES) $(lib_test_heavy_thread_SOURCES) \ - $(lib_test_heavy_wq_SOURCES) $(lib_test_memory_SOURCES) \ - $(lib_test_nexthop_iter_SOURCES) $(lib_test_privs_SOURCES) \ - $(lib_test_ringbuf_SOURCES) $(lib_test_segv_SOURCES) \ - $(lib_test_sig_SOURCES) $(lib_test_srcdest_table_SOURCES) \ - $(lib_test_stream_SOURCES) $(lib_test_table_SOURCES) \ - $(lib_test_timer_correctness_SOURCES) \ - $(lib_test_timer_performance_SOURCES) \ - $(lib_test_ttable_SOURCES) $(lib_test_zmq_SOURCES) \ - $(ospf6d_test_lsdb_SOURCES) -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -HEADERS = $(noinst_HEADERS) -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -am__DIST_COMMON = $(srcdir)/../common.am $(srcdir)/Makefile.in \ - $(top_srcdir)/depcomp -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BGPD = @BGPD@ -BISON_CLOSEBRACE = @BISON_CLOSEBRACE@ -BISON_OPENBRACE = @BISON_OPENBRACE@ -BISON_VERBOSE = @BISON_VERBOSE@ -CARES_CFLAGS = @CARES_CFLAGS@ -CARES_LIBS = @CARES_LIBS@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFG_MODULE = @CFG_MODULE@ -CFG_SBIN = @CFG_SBIN@ -CFG_STATE = @CFG_STATE@ -CFG_SYSCONF = @CFG_SYSCONF@ -CFLAGS = @CFLAGS@ -CONFDATE = @CONFDATE@ -CONFIG_ARGS = @CONFIG_ARGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CURSES = @CURSES@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ $(LOCAL_OPTS) -DSYSCONFDIR=\"$(sysconfdir)/\" -DEPDIR = @DEPDIR@ -DFLT_NAME = @DFLT_NAME@ -DLLTOOL = @DLLTOOL@ -DOC = @DOC@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GREP = @GREP@ -HAVE_LIBPCREPOSIX = @HAVE_LIBPCREPOSIX@ -HOSTTOOLS = @HOSTTOOLS@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LEX = @LEX@ -LEXLIB = @LEXLIB@ -LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIBCAP = @LIBCAP@ -LIBM = @LIBM@ -LIBOBJS = @LIBOBJS@ -LIBPAM = @LIBPAM@ -LIBREADLINE = @LIBREADLINE@ -LIBRFP = @LIBRFP@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -NETSNMP_CONFIG = @NETSNMP_CONFIG@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_EXTRAVERSION = @PACKAGE_EXTRAVERSION@ -PACKAGE_FULLNAME = @PACKAGE_FULLNAME@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -PROTOBUF_C_CFLAGS = @PROTOBUF_C_CFLAGS@ -PROTOBUF_C_LIBS = @PROTOBUF_C_LIBS@ -PROTOC_C = @PROTOC_C@ -PTHREAD_CC = @PTHREAD_CC@ -PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ -PTHREAD_LIBS = @PTHREAD_LIBS@ -PYTHONCONFIG = @PYTHONCONFIG@ -PYTHON_CFLAGS = @PYTHON_CFLAGS@ -PYTHON_LIBS = @PYTHON_LIBS@ -RANLIB = @RANLIB@ -RFPINC = @RFPINC@ -RFPTEST = @RFPTEST@ -RTRLIB_CFLAGS = @RTRLIB_CFLAGS@ -RTRLIB_LIBS = @RTRLIB_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SNMP_CFLAGS = @SNMP_CFLAGS@ -SNMP_LIBS = @SNMP_LIBS@ -SOLARIS = @SOLARIS@ -STRIP = @STRIP@ -VERSION = @VERSION@ -VNC_RFP_PATH = @VNC_RFP_PATH@ -VTYSH = @VTYSH@ -WERROR = @WERROR@ -YACC = @YACC@ -YFLAGS = @YFLAGS@ -ZEROMQ_CFLAGS = @ZEROMQ_CFLAGS@ -ZEROMQ_LIBS = @ZEROMQ_LIBS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -ac_ct_PYTHONCONFIG = @ac_ct_PYTHONCONFIG@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -ax_pthread_config = @ax_pthread_config@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_group = @enable_group@ -enable_user = @enable_user@ -enable_vty_group = @enable_vty_group@ -exampledir = @exampledir@ -exec_prefix = @exec_prefix@ -frr_statedir = @frr_statedir@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -moduledir = @moduledir@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -pkgsrcrcdir = @pkgsrcrcdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -runstatedir = @runstatedir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -AM_V_CLIPPY = $(am__v_CLIPPY_$(V)) -am__v_CLIPPY_ = $(am__v_CLIPPY_$(AM_DEFAULT_VERBOSITY)) -am__v_CLIPPY_0 = @echo " CLIPPY " $@; -am__v_CLIPPY_1 = -CLIPPY_DEPS = $(HOSTTOOLS)lib/clippy $(top_srcdir)/python/clidef.py -SUFFIXES = _clippy.c .proto .pb-c.c .pb-c.h .pb.h - -# Uncomment to use an non-system version of libprotobuf-c. -# -# Q_PROTOBUF_C_CLIENT_INCLUDES = -I$(top_srcdir)/third-party/protobuf-c/src -# Q_PROTOBUF_C_CLIENT_LDOPTS = $(top_builddir)/third-party/protobuf-c/src/libprotobuf-c.la -@HAVE_PROTOBUF_TRUE@Q_PROTOBUF_C_CLIENT_INCLUDES = -@HAVE_PROTOBUF_TRUE@Q_PROTOBUF_C_CLIENT_LDOPTS = -lprotobuf-c -@HAVE_PROTOBUF_TRUE@Q_PROTOC = protoc -@HAVE_PROTOBUF_TRUE@Q_PROTOC_C = protoc-c -@HAVE_PROTOBUF_TRUE@AM_V_PROTOC_C = $(am__v_PROTOC_C_$(V)) -@HAVE_PROTOBUF_TRUE@am__v_PROTOC_C_ = $(am__v_PROTOC_C_$(AM_DEFAULT_VERBOSITY)) -@HAVE_PROTOBUF_TRUE@am__v_PROTOC_C_0 = @echo " PROTOC_C" $@; -@HAVE_PROTOBUF_TRUE@am__v_PROTOC_C_1 = - -# -# Information about how to link to various libraries. -# -@HAVE_PROTOBUF_TRUE@Q_FRR_PB_CLIENT_LDOPTS = $(top_srcdir)/qpb/libfrr_pb.la $(Q_PROTOBUF_C_CLIENT_LDOPTS) -@HAVE_PROTOBUF_TRUE@Q_FPM_PB_CLIENT_LDOPTS = $(top_srcdir)/fpm/libfrrfpm_pb.la $(Q_FRR_PB_CLIENT_LDOPTS) -AUTOMAKE_OPTIONS = subdir-objects -AM_CPPFLAGS = \ - -I.. \ - -I$(top_srcdir) \ - -I$(top_srcdir)/lib \ - -I$(top_builddir)/lib \ - -I$(top_srcdir)/tests/helpers/c \ - -I$(top_builddir)/tests/helpers/c \ - -O - -@BGPD_FALSE@TESTS_BGPD = -@BGPD_TRUE@TESTS_BGPD = \ -@BGPD_TRUE@ bgpd/test_aspath \ -@BGPD_TRUE@ bgpd/test_capability \ -@BGPD_TRUE@ bgpd/test_packet \ -@BGPD_TRUE@ bgpd/test_ecommunity \ -@BGPD_TRUE@ bgpd/test_mp_attr \ -@BGPD_TRUE@ bgpd/test_mpath - -@ISISD_FALSE@TESTS_ISISD = -@ISISD_TRUE@@SOLARIS_FALSE@TESTS_ISISD = \ -@ISISD_TRUE@@SOLARIS_FALSE@ isisd/test_fuzz_isis_tlv \ -@ISISD_TRUE@@SOLARIS_FALSE@ isisd/test_isis_vertex_queue \ -@ISISD_TRUE@@SOLARIS_FALSE@ # end - -@ISISD_TRUE@@SOLARIS_TRUE@TESTS_ISISD = -@OSPF6D_FALSE@TESTS_OSPF6D = -@OSPF6D_TRUE@TESTS_OSPF6D = \ -@OSPF6D_TRUE@ ospf6d/test_lsdb \ -@OSPF6D_TRUE@ # end - -@ENABLE_BGP_VNC_FALSE@BGP_VNC_RFP_LIB = -@ENABLE_BGP_VNC_TRUE@BGP_VNC_RFP_LIB = @top_builddir@/$(LIBRFP)/librfp.a -noinst_HEADERS = \ - ./helpers/c/prng.h \ - ./helpers/c/tests.h \ - ./lib/cli/common_cli.h - -lib_test_buffer_SOURCES = lib/test_buffer.c -lib_test_checksum_SOURCES = lib/test_checksum.c -lib_test_heavy_thread_SOURCES = lib/test_heavy_thread.c helpers/c/main.c -lib_test_heavy_wq_SOURCES = lib/test_heavy_wq.c helpers/c/main.c -lib_test_heavy_SOURCES = lib/test_heavy.c helpers/c/main.c -lib_test_memory_SOURCES = lib/test_memory.c -lib_test_nexthop_iter_SOURCES = lib/test_nexthop_iter.c helpers/c/prng.c -lib_test_privs_SOURCES = lib/test_privs.c -lib_test_srcdest_table_SOURCES = lib/test_srcdest_table.c \ - helpers/c/prng.c - -lib_test_ringbuf_SOURCES = lib/test_ringbuf.c -lib_test_segv_SOURCES = lib/test_segv.c -lib_test_sig_SOURCES = lib/test_sig.c -lib_test_stream_SOURCES = lib/test_stream.c -lib_test_table_SOURCES = lib/test_table.c -lib_test_timer_correctness_SOURCES = lib/test_timer_correctness.c \ - helpers/c/prng.c - -lib_test_timer_performance_SOURCES = lib/test_timer_performance.c \ - helpers/c/prng.c - -lib_test_ttable_SOURCES = lib/test_ttable.c -lib_test_zmq_SOURCES = lib/test_zmq.c -lib_test_zmq_CFLAGS = $(AM_CFLAGS) $(ZEROMQ_CFLAGS) -lib_cli_test_cli_SOURCES = lib/cli/test_cli.c lib/cli/common_cli.c -lib_cli_test_commands_SOURCES = lib/cli/test_commands_defun.c \ - lib/cli/test_commands.c \ - helpers/c/prng.c - -bgpd_test_aspath_SOURCES = bgpd/test_aspath.c -bgpd_test_capability_SOURCES = bgpd/test_capability.c -bgpd_test_packet_SOURCES = bgpd/test_packet.c -bgpd_test_ecommunity_SOURCES = bgpd/test_ecommunity.c -bgpd_test_mp_attr_SOURCES = bgpd/test_mp_attr.c -bgpd_test_mpath_SOURCES = bgpd/test_mpath.c -isisd_test_fuzz_isis_tlv_SOURCES = isisd/test_fuzz_isis_tlv.c -isisd_test_fuzz_isis_tlv_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_builddir)/tests/isisd -isisd_test_isis_vertex_queue_SOURCES = isisd/test_isis_vertex_queue.c -ospf6d_test_lsdb_SOURCES = ospf6d/test_lsdb.c lib/cli/common_cli.c -ALL_TESTS_LDADD = ../lib/libfrr.la @LIBCAP@ -BGP_TEST_LDADD = ../bgpd/libbgp.a $(BGP_VNC_RFP_LIB) $(ALL_TESTS_LDADD) -lm -ISISD_TEST_LDADD = ../isisd/libisis.a $(ALL_TESTS_LDADD) -OSPF6_TEST_LDADD = ../ospf6d/libospf6.a $(ALL_TESTS_LDADD) -lib_test_buffer_LDADD = $(ALL_TESTS_LDADD) -lib_test_checksum_LDADD = $(ALL_TESTS_LDADD) -lib_test_heavy_thread_LDADD = $(ALL_TESTS_LDADD) -lm -lib_test_heavy_wq_LDADD = $(ALL_TESTS_LDADD) -lm -lib_test_heavy_LDADD = $(ALL_TESTS_LDADD) -lm -lib_test_memory_LDADD = $(ALL_TESTS_LDADD) -lib_test_nexthop_iter_LDADD = $(ALL_TESTS_LDADD) -lib_test_privs_LDADD = $(ALL_TESTS_LDADD) -lib_test_ringbuf_LDADD = $(ALL_TESTS_LDADD) -lib_test_srcdest_table_LDADD = $(ALL_TESTS_LDADD) -lib_test_segv_LDADD = $(ALL_TESTS_LDADD) -lib_test_sig_LDADD = $(ALL_TESTS_LDADD) -lib_test_stream_LDADD = $(ALL_TESTS_LDADD) -lib_test_table_LDADD = $(ALL_TESTS_LDADD) -lm -lib_test_timer_correctness_LDADD = $(ALL_TESTS_LDADD) -lib_test_timer_performance_LDADD = $(ALL_TESTS_LDADD) -lib_test_ttable_LDADD = $(ALL_TESTS_LDADD) -lib_test_zmq_LDADD = ../lib/libfrrzmq.la $(ALL_TESTS_LDADD) $(ZEROMQ_LIBS) -lib_cli_test_cli_LDADD = $(ALL_TESTS_LDADD) -lib_cli_test_commands_LDADD = $(ALL_TESTS_LDADD) -bgpd_test_aspath_LDADD = $(BGP_TEST_LDADD) -bgpd_test_capability_LDADD = $(BGP_TEST_LDADD) -bgpd_test_packet_LDADD = $(BGP_TEST_LDADD) -bgpd_test_ecommunity_LDADD = $(BGP_TEST_LDADD) -bgpd_test_mp_attr_LDADD = $(BGP_TEST_LDADD) -bgpd_test_mpath_LDADD = $(BGP_TEST_LDADD) -isisd_test_fuzz_isis_tlv_LDADD = $(ISISD_TEST_LDADD) -isisd_test_isis_vertex_queue_LDADD = $(ISISD_TEST_LDADD) -ospf6d_test_lsdb_LDADD = $(OSPF6_TEST_LDADD) -EXTRA_DIST = \ - runtests.py \ - bgpd/test_aspath.py \ - bgpd/test_capability.py \ - bgpd/test_ecommunity.py \ - bgpd/test_mp_attr.py \ - bgpd/test_mpath.py \ - helpers/python/frrsix.py \ - helpers/python/frrtest.py \ - isisd/test_fuzz_isis_tlv.py \ - isisd/test_fuzz_isis_tlv_tests.h.gz \ - isisd/test_isis_vertex_queue.py \ - lib/cli/test_commands.in \ - lib/cli/test_commands.py \ - lib/cli/test_commands.refout \ - lib/cli/test_cli.in \ - lib/cli/test_cli.py \ - lib/cli/test_cli.refout \ - lib/test_nexthop_iter.py \ - lib/test_ringbuf.py \ - lib/test_srcdest_table.py \ - lib/test_stream.py \ - lib/test_stream.refout \ - lib/test_table.py \ - lib/test_timer_correctness.py \ - lib/test_ttable.py \ - lib/test_ttable.refout \ - ospf6d/test_lsdb.py \ - ospf6d/test_lsdb.in \ - ospf6d/test_lsdb.refout \ - # end - -all: all-am - -.SUFFIXES: -.SUFFIXES: _clippy.c .proto .pb-c.c .pb-c.h .pb.h .c .l .lo .o .obj .y -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/../common.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu tests/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; -$(srcdir)/../common.am $(am__empty): - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -clean-checkPROGRAMS: - @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ - echo " rm -f" $$list; \ - rm -f $$list || exit $$?; \ - test -n "$(EXEEXT)" || exit 0; \ - list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f" $$list; \ - rm -f $$list -bgpd/$(am__dirstamp): - @$(MKDIR_P) bgpd - @: > bgpd/$(am__dirstamp) -bgpd/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) bgpd/$(DEPDIR) - @: > bgpd/$(DEPDIR)/$(am__dirstamp) -bgpd/test_aspath.$(OBJEXT): bgpd/$(am__dirstamp) \ - bgpd/$(DEPDIR)/$(am__dirstamp) - -bgpd/test_aspath$(EXEEXT): $(bgpd_test_aspath_OBJECTS) $(bgpd_test_aspath_DEPENDENCIES) $(EXTRA_bgpd_test_aspath_DEPENDENCIES) bgpd/$(am__dirstamp) - @rm -f bgpd/test_aspath$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(bgpd_test_aspath_OBJECTS) $(bgpd_test_aspath_LDADD) $(LIBS) -bgpd/test_capability.$(OBJEXT): bgpd/$(am__dirstamp) \ - bgpd/$(DEPDIR)/$(am__dirstamp) - -bgpd/test_capability$(EXEEXT): $(bgpd_test_capability_OBJECTS) $(bgpd_test_capability_DEPENDENCIES) $(EXTRA_bgpd_test_capability_DEPENDENCIES) bgpd/$(am__dirstamp) - @rm -f bgpd/test_capability$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(bgpd_test_capability_OBJECTS) $(bgpd_test_capability_LDADD) $(LIBS) -bgpd/test_ecommunity.$(OBJEXT): bgpd/$(am__dirstamp) \ - bgpd/$(DEPDIR)/$(am__dirstamp) - -bgpd/test_ecommunity$(EXEEXT): $(bgpd_test_ecommunity_OBJECTS) $(bgpd_test_ecommunity_DEPENDENCIES) $(EXTRA_bgpd_test_ecommunity_DEPENDENCIES) bgpd/$(am__dirstamp) - @rm -f bgpd/test_ecommunity$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(bgpd_test_ecommunity_OBJECTS) $(bgpd_test_ecommunity_LDADD) $(LIBS) -bgpd/test_mp_attr.$(OBJEXT): bgpd/$(am__dirstamp) \ - bgpd/$(DEPDIR)/$(am__dirstamp) - -bgpd/test_mp_attr$(EXEEXT): $(bgpd_test_mp_attr_OBJECTS) $(bgpd_test_mp_attr_DEPENDENCIES) $(EXTRA_bgpd_test_mp_attr_DEPENDENCIES) bgpd/$(am__dirstamp) - @rm -f bgpd/test_mp_attr$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(bgpd_test_mp_attr_OBJECTS) $(bgpd_test_mp_attr_LDADD) $(LIBS) -bgpd/test_mpath.$(OBJEXT): bgpd/$(am__dirstamp) \ - bgpd/$(DEPDIR)/$(am__dirstamp) - -bgpd/test_mpath$(EXEEXT): $(bgpd_test_mpath_OBJECTS) $(bgpd_test_mpath_DEPENDENCIES) $(EXTRA_bgpd_test_mpath_DEPENDENCIES) bgpd/$(am__dirstamp) - @rm -f bgpd/test_mpath$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(bgpd_test_mpath_OBJECTS) $(bgpd_test_mpath_LDADD) $(LIBS) -bgpd/test_packet.$(OBJEXT): bgpd/$(am__dirstamp) \ - bgpd/$(DEPDIR)/$(am__dirstamp) - -bgpd/test_packet$(EXEEXT): $(bgpd_test_packet_OBJECTS) $(bgpd_test_packet_DEPENDENCIES) $(EXTRA_bgpd_test_packet_DEPENDENCIES) bgpd/$(am__dirstamp) - @rm -f bgpd/test_packet$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(bgpd_test_packet_OBJECTS) $(bgpd_test_packet_LDADD) $(LIBS) -isisd/$(am__dirstamp): - @$(MKDIR_P) isisd - @: > isisd/$(am__dirstamp) -isisd/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) isisd/$(DEPDIR) - @: > isisd/$(DEPDIR)/$(am__dirstamp) -isisd/isisd_test_fuzz_isis_tlv-test_fuzz_isis_tlv.$(OBJEXT): \ - isisd/$(am__dirstamp) isisd/$(DEPDIR)/$(am__dirstamp) - -isisd/test_fuzz_isis_tlv$(EXEEXT): $(isisd_test_fuzz_isis_tlv_OBJECTS) $(isisd_test_fuzz_isis_tlv_DEPENDENCIES) $(EXTRA_isisd_test_fuzz_isis_tlv_DEPENDENCIES) isisd/$(am__dirstamp) - @rm -f isisd/test_fuzz_isis_tlv$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(isisd_test_fuzz_isis_tlv_OBJECTS) $(isisd_test_fuzz_isis_tlv_LDADD) $(LIBS) -isisd/test_isis_vertex_queue.$(OBJEXT): isisd/$(am__dirstamp) \ - isisd/$(DEPDIR)/$(am__dirstamp) - -isisd/test_isis_vertex_queue$(EXEEXT): $(isisd_test_isis_vertex_queue_OBJECTS) $(isisd_test_isis_vertex_queue_DEPENDENCIES) $(EXTRA_isisd_test_isis_vertex_queue_DEPENDENCIES) isisd/$(am__dirstamp) - @rm -f isisd/test_isis_vertex_queue$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(isisd_test_isis_vertex_queue_OBJECTS) $(isisd_test_isis_vertex_queue_LDADD) $(LIBS) -lib/cli/$(am__dirstamp): - @$(MKDIR_P) lib/cli - @: > lib/cli/$(am__dirstamp) -lib/cli/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) lib/cli/$(DEPDIR) - @: > lib/cli/$(DEPDIR)/$(am__dirstamp) -lib/cli/test_cli.$(OBJEXT): lib/cli/$(am__dirstamp) \ - lib/cli/$(DEPDIR)/$(am__dirstamp) -lib/cli/common_cli.$(OBJEXT): lib/cli/$(am__dirstamp) \ - lib/cli/$(DEPDIR)/$(am__dirstamp) - -lib/cli/test_cli$(EXEEXT): $(lib_cli_test_cli_OBJECTS) $(lib_cli_test_cli_DEPENDENCIES) $(EXTRA_lib_cli_test_cli_DEPENDENCIES) lib/cli/$(am__dirstamp) - @rm -f lib/cli/test_cli$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(lib_cli_test_cli_OBJECTS) $(lib_cli_test_cli_LDADD) $(LIBS) -lib/cli/test_commands_defun.$(OBJEXT): lib/cli/$(am__dirstamp) \ - lib/cli/$(DEPDIR)/$(am__dirstamp) -lib/cli/test_commands.$(OBJEXT): lib/cli/$(am__dirstamp) \ - lib/cli/$(DEPDIR)/$(am__dirstamp) -helpers/c/$(am__dirstamp): - @$(MKDIR_P) helpers/c - @: > helpers/c/$(am__dirstamp) -helpers/c/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) helpers/c/$(DEPDIR) - @: > helpers/c/$(DEPDIR)/$(am__dirstamp) -helpers/c/prng.$(OBJEXT): helpers/c/$(am__dirstamp) \ - helpers/c/$(DEPDIR)/$(am__dirstamp) - -lib/cli/test_commands$(EXEEXT): $(lib_cli_test_commands_OBJECTS) $(lib_cli_test_commands_DEPENDENCIES) $(EXTRA_lib_cli_test_commands_DEPENDENCIES) lib/cli/$(am__dirstamp) - @rm -f lib/cli/test_commands$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(lib_cli_test_commands_OBJECTS) $(lib_cli_test_commands_LDADD) $(LIBS) -lib/$(am__dirstamp): - @$(MKDIR_P) lib - @: > lib/$(am__dirstamp) -lib/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) lib/$(DEPDIR) - @: > lib/$(DEPDIR)/$(am__dirstamp) -lib/test_buffer.$(OBJEXT): lib/$(am__dirstamp) \ - lib/$(DEPDIR)/$(am__dirstamp) - -lib/test_buffer$(EXEEXT): $(lib_test_buffer_OBJECTS) $(lib_test_buffer_DEPENDENCIES) $(EXTRA_lib_test_buffer_DEPENDENCIES) lib/$(am__dirstamp) - @rm -f lib/test_buffer$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(lib_test_buffer_OBJECTS) $(lib_test_buffer_LDADD) $(LIBS) -lib/test_checksum.$(OBJEXT): lib/$(am__dirstamp) \ - lib/$(DEPDIR)/$(am__dirstamp) - -lib/test_checksum$(EXEEXT): $(lib_test_checksum_OBJECTS) $(lib_test_checksum_DEPENDENCIES) $(EXTRA_lib_test_checksum_DEPENDENCIES) lib/$(am__dirstamp) - @rm -f lib/test_checksum$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(lib_test_checksum_OBJECTS) $(lib_test_checksum_LDADD) $(LIBS) -lib/test_heavy.$(OBJEXT): lib/$(am__dirstamp) \ - lib/$(DEPDIR)/$(am__dirstamp) -helpers/c/main.$(OBJEXT): helpers/c/$(am__dirstamp) \ - helpers/c/$(DEPDIR)/$(am__dirstamp) - -lib/test_heavy$(EXEEXT): $(lib_test_heavy_OBJECTS) $(lib_test_heavy_DEPENDENCIES) $(EXTRA_lib_test_heavy_DEPENDENCIES) lib/$(am__dirstamp) - @rm -f lib/test_heavy$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(lib_test_heavy_OBJECTS) $(lib_test_heavy_LDADD) $(LIBS) -lib/test_heavy_thread.$(OBJEXT): lib/$(am__dirstamp) \ - lib/$(DEPDIR)/$(am__dirstamp) - -lib/test_heavy_thread$(EXEEXT): $(lib_test_heavy_thread_OBJECTS) $(lib_test_heavy_thread_DEPENDENCIES) $(EXTRA_lib_test_heavy_thread_DEPENDENCIES) lib/$(am__dirstamp) - @rm -f lib/test_heavy_thread$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(lib_test_heavy_thread_OBJECTS) $(lib_test_heavy_thread_LDADD) $(LIBS) -lib/test_heavy_wq.$(OBJEXT): lib/$(am__dirstamp) \ - lib/$(DEPDIR)/$(am__dirstamp) - -lib/test_heavy_wq$(EXEEXT): $(lib_test_heavy_wq_OBJECTS) $(lib_test_heavy_wq_DEPENDENCIES) $(EXTRA_lib_test_heavy_wq_DEPENDENCIES) lib/$(am__dirstamp) - @rm -f lib/test_heavy_wq$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(lib_test_heavy_wq_OBJECTS) $(lib_test_heavy_wq_LDADD) $(LIBS) -lib/test_memory.$(OBJEXT): lib/$(am__dirstamp) \ - lib/$(DEPDIR)/$(am__dirstamp) - -lib/test_memory$(EXEEXT): $(lib_test_memory_OBJECTS) $(lib_test_memory_DEPENDENCIES) $(EXTRA_lib_test_memory_DEPENDENCIES) lib/$(am__dirstamp) - @rm -f lib/test_memory$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(lib_test_memory_OBJECTS) $(lib_test_memory_LDADD) $(LIBS) -lib/test_nexthop_iter.$(OBJEXT): lib/$(am__dirstamp) \ - lib/$(DEPDIR)/$(am__dirstamp) - -lib/test_nexthop_iter$(EXEEXT): $(lib_test_nexthop_iter_OBJECTS) $(lib_test_nexthop_iter_DEPENDENCIES) $(EXTRA_lib_test_nexthop_iter_DEPENDENCIES) lib/$(am__dirstamp) - @rm -f lib/test_nexthop_iter$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(lib_test_nexthop_iter_OBJECTS) $(lib_test_nexthop_iter_LDADD) $(LIBS) -lib/test_privs.$(OBJEXT): lib/$(am__dirstamp) \ - lib/$(DEPDIR)/$(am__dirstamp) - -lib/test_privs$(EXEEXT): $(lib_test_privs_OBJECTS) $(lib_test_privs_DEPENDENCIES) $(EXTRA_lib_test_privs_DEPENDENCIES) lib/$(am__dirstamp) - @rm -f lib/test_privs$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(lib_test_privs_OBJECTS) $(lib_test_privs_LDADD) $(LIBS) -lib/test_ringbuf.$(OBJEXT): lib/$(am__dirstamp) \ - lib/$(DEPDIR)/$(am__dirstamp) - -lib/test_ringbuf$(EXEEXT): $(lib_test_ringbuf_OBJECTS) $(lib_test_ringbuf_DEPENDENCIES) $(EXTRA_lib_test_ringbuf_DEPENDENCIES) lib/$(am__dirstamp) - @rm -f lib/test_ringbuf$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(lib_test_ringbuf_OBJECTS) $(lib_test_ringbuf_LDADD) $(LIBS) -lib/test_segv.$(OBJEXT): lib/$(am__dirstamp) \ - lib/$(DEPDIR)/$(am__dirstamp) - -lib/test_segv$(EXEEXT): $(lib_test_segv_OBJECTS) $(lib_test_segv_DEPENDENCIES) $(EXTRA_lib_test_segv_DEPENDENCIES) lib/$(am__dirstamp) - @rm -f lib/test_segv$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(lib_test_segv_OBJECTS) $(lib_test_segv_LDADD) $(LIBS) -lib/test_sig.$(OBJEXT): lib/$(am__dirstamp) \ - lib/$(DEPDIR)/$(am__dirstamp) - -lib/test_sig$(EXEEXT): $(lib_test_sig_OBJECTS) $(lib_test_sig_DEPENDENCIES) $(EXTRA_lib_test_sig_DEPENDENCIES) lib/$(am__dirstamp) - @rm -f lib/test_sig$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(lib_test_sig_OBJECTS) $(lib_test_sig_LDADD) $(LIBS) -lib/test_srcdest_table.$(OBJEXT): lib/$(am__dirstamp) \ - lib/$(DEPDIR)/$(am__dirstamp) - -lib/test_srcdest_table$(EXEEXT): $(lib_test_srcdest_table_OBJECTS) $(lib_test_srcdest_table_DEPENDENCIES) $(EXTRA_lib_test_srcdest_table_DEPENDENCIES) lib/$(am__dirstamp) - @rm -f lib/test_srcdest_table$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(lib_test_srcdest_table_OBJECTS) $(lib_test_srcdest_table_LDADD) $(LIBS) -lib/test_stream.$(OBJEXT): lib/$(am__dirstamp) \ - lib/$(DEPDIR)/$(am__dirstamp) - -lib/test_stream$(EXEEXT): $(lib_test_stream_OBJECTS) $(lib_test_stream_DEPENDENCIES) $(EXTRA_lib_test_stream_DEPENDENCIES) lib/$(am__dirstamp) - @rm -f lib/test_stream$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(lib_test_stream_OBJECTS) $(lib_test_stream_LDADD) $(LIBS) -lib/test_table.$(OBJEXT): lib/$(am__dirstamp) \ - lib/$(DEPDIR)/$(am__dirstamp) - -lib/test_table$(EXEEXT): $(lib_test_table_OBJECTS) $(lib_test_table_DEPENDENCIES) $(EXTRA_lib_test_table_DEPENDENCIES) lib/$(am__dirstamp) - @rm -f lib/test_table$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(lib_test_table_OBJECTS) $(lib_test_table_LDADD) $(LIBS) -lib/test_timer_correctness.$(OBJEXT): lib/$(am__dirstamp) \ - lib/$(DEPDIR)/$(am__dirstamp) - -lib/test_timer_correctness$(EXEEXT): $(lib_test_timer_correctness_OBJECTS) $(lib_test_timer_correctness_DEPENDENCIES) $(EXTRA_lib_test_timer_correctness_DEPENDENCIES) lib/$(am__dirstamp) - @rm -f lib/test_timer_correctness$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(lib_test_timer_correctness_OBJECTS) $(lib_test_timer_correctness_LDADD) $(LIBS) -lib/test_timer_performance.$(OBJEXT): lib/$(am__dirstamp) \ - lib/$(DEPDIR)/$(am__dirstamp) - -lib/test_timer_performance$(EXEEXT): $(lib_test_timer_performance_OBJECTS) $(lib_test_timer_performance_DEPENDENCIES) $(EXTRA_lib_test_timer_performance_DEPENDENCIES) lib/$(am__dirstamp) - @rm -f lib/test_timer_performance$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(lib_test_timer_performance_OBJECTS) $(lib_test_timer_performance_LDADD) $(LIBS) -lib/test_ttable.$(OBJEXT): lib/$(am__dirstamp) \ - lib/$(DEPDIR)/$(am__dirstamp) - -lib/test_ttable$(EXEEXT): $(lib_test_ttable_OBJECTS) $(lib_test_ttable_DEPENDENCIES) $(EXTRA_lib_test_ttable_DEPENDENCIES) lib/$(am__dirstamp) - @rm -f lib/test_ttable$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(lib_test_ttable_OBJECTS) $(lib_test_ttable_LDADD) $(LIBS) -lib/lib_test_zmq-test_zmq.$(OBJEXT): lib/$(am__dirstamp) \ - lib/$(DEPDIR)/$(am__dirstamp) - -lib/test_zmq$(EXEEXT): $(lib_test_zmq_OBJECTS) $(lib_test_zmq_DEPENDENCIES) $(EXTRA_lib_test_zmq_DEPENDENCIES) lib/$(am__dirstamp) - @rm -f lib/test_zmq$(EXEEXT) - $(AM_V_CCLD)$(lib_test_zmq_LINK) $(lib_test_zmq_OBJECTS) $(lib_test_zmq_LDADD) $(LIBS) -ospf6d/$(am__dirstamp): - @$(MKDIR_P) ospf6d - @: > ospf6d/$(am__dirstamp) -ospf6d/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) ospf6d/$(DEPDIR) - @: > ospf6d/$(DEPDIR)/$(am__dirstamp) -ospf6d/test_lsdb.$(OBJEXT): ospf6d/$(am__dirstamp) \ - ospf6d/$(DEPDIR)/$(am__dirstamp) - -ospf6d/test_lsdb$(EXEEXT): $(ospf6d_test_lsdb_OBJECTS) $(ospf6d_test_lsdb_DEPENDENCIES) $(EXTRA_ospf6d_test_lsdb_DEPENDENCIES) ospf6d/$(am__dirstamp) - @rm -f ospf6d/test_lsdb$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(ospf6d_test_lsdb_OBJECTS) $(ospf6d_test_lsdb_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -rm -f bgpd/*.$(OBJEXT) - -rm -f helpers/c/*.$(OBJEXT) - -rm -f isisd/*.$(OBJEXT) - -rm -f lib/*.$(OBJEXT) - -rm -f lib/cli/*.$(OBJEXT) - -rm -f ospf6d/*.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@bgpd/$(DEPDIR)/test_aspath.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@bgpd/$(DEPDIR)/test_capability.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@bgpd/$(DEPDIR)/test_ecommunity.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@bgpd/$(DEPDIR)/test_mp_attr.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@bgpd/$(DEPDIR)/test_mpath.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@bgpd/$(DEPDIR)/test_packet.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@helpers/c/$(DEPDIR)/main.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@helpers/c/$(DEPDIR)/prng.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@isisd/$(DEPDIR)/isisd_test_fuzz_isis_tlv-test_fuzz_isis_tlv.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@isisd/$(DEPDIR)/test_isis_vertex_queue.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/lib_test_zmq-test_zmq.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/test_buffer.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/test_checksum.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/test_heavy.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/test_heavy_thread.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/test_heavy_wq.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/test_memory.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/test_nexthop_iter.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/test_privs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/test_ringbuf.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/test_segv.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/test_sig.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/test_srcdest_table.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/test_stream.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/test_table.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/test_timer_correctness.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/test_timer_performance.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/test_ttable.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@lib/cli/$(DEPDIR)/common_cli.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@lib/cli/$(DEPDIR)/test_cli.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@lib/cli/$(DEPDIR)/test_commands.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@lib/cli/$(DEPDIR)/test_commands_defun.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@ospf6d/$(DEPDIR)/test_lsdb.Po@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< - -.c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< - -isisd/isisd_test_fuzz_isis_tlv-test_fuzz_isis_tlv.o: isisd/test_fuzz_isis_tlv.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(isisd_test_fuzz_isis_tlv_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT isisd/isisd_test_fuzz_isis_tlv-test_fuzz_isis_tlv.o -MD -MP -MF isisd/$(DEPDIR)/isisd_test_fuzz_isis_tlv-test_fuzz_isis_tlv.Tpo -c -o isisd/isisd_test_fuzz_isis_tlv-test_fuzz_isis_tlv.o `test -f 'isisd/test_fuzz_isis_tlv.c' || echo '$(srcdir)/'`isisd/test_fuzz_isis_tlv.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) isisd/$(DEPDIR)/isisd_test_fuzz_isis_tlv-test_fuzz_isis_tlv.Tpo isisd/$(DEPDIR)/isisd_test_fuzz_isis_tlv-test_fuzz_isis_tlv.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='isisd/test_fuzz_isis_tlv.c' object='isisd/isisd_test_fuzz_isis_tlv-test_fuzz_isis_tlv.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(isisd_test_fuzz_isis_tlv_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o isisd/isisd_test_fuzz_isis_tlv-test_fuzz_isis_tlv.o `test -f 'isisd/test_fuzz_isis_tlv.c' || echo '$(srcdir)/'`isisd/test_fuzz_isis_tlv.c - -isisd/isisd_test_fuzz_isis_tlv-test_fuzz_isis_tlv.obj: isisd/test_fuzz_isis_tlv.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(isisd_test_fuzz_isis_tlv_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT isisd/isisd_test_fuzz_isis_tlv-test_fuzz_isis_tlv.obj -MD -MP -MF isisd/$(DEPDIR)/isisd_test_fuzz_isis_tlv-test_fuzz_isis_tlv.Tpo -c -o isisd/isisd_test_fuzz_isis_tlv-test_fuzz_isis_tlv.obj `if test -f 'isisd/test_fuzz_isis_tlv.c'; then $(CYGPATH_W) 'isisd/test_fuzz_isis_tlv.c'; else $(CYGPATH_W) '$(srcdir)/isisd/test_fuzz_isis_tlv.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) isisd/$(DEPDIR)/isisd_test_fuzz_isis_tlv-test_fuzz_isis_tlv.Tpo isisd/$(DEPDIR)/isisd_test_fuzz_isis_tlv-test_fuzz_isis_tlv.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='isisd/test_fuzz_isis_tlv.c' object='isisd/isisd_test_fuzz_isis_tlv-test_fuzz_isis_tlv.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(isisd_test_fuzz_isis_tlv_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o isisd/isisd_test_fuzz_isis_tlv-test_fuzz_isis_tlv.obj `if test -f 'isisd/test_fuzz_isis_tlv.c'; then $(CYGPATH_W) 'isisd/test_fuzz_isis_tlv.c'; else $(CYGPATH_W) '$(srcdir)/isisd/test_fuzz_isis_tlv.c'; fi` - -lib/lib_test_zmq-test_zmq.o: lib/test_zmq.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_test_zmq_CFLAGS) $(CFLAGS) -MT lib/lib_test_zmq-test_zmq.o -MD -MP -MF lib/$(DEPDIR)/lib_test_zmq-test_zmq.Tpo -c -o lib/lib_test_zmq-test_zmq.o `test -f 'lib/test_zmq.c' || echo '$(srcdir)/'`lib/test_zmq.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) lib/$(DEPDIR)/lib_test_zmq-test_zmq.Tpo lib/$(DEPDIR)/lib_test_zmq-test_zmq.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='lib/test_zmq.c' object='lib/lib_test_zmq-test_zmq.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_test_zmq_CFLAGS) $(CFLAGS) -c -o lib/lib_test_zmq-test_zmq.o `test -f 'lib/test_zmq.c' || echo '$(srcdir)/'`lib/test_zmq.c - -lib/lib_test_zmq-test_zmq.obj: lib/test_zmq.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_test_zmq_CFLAGS) $(CFLAGS) -MT lib/lib_test_zmq-test_zmq.obj -MD -MP -MF lib/$(DEPDIR)/lib_test_zmq-test_zmq.Tpo -c -o lib/lib_test_zmq-test_zmq.obj `if test -f 'lib/test_zmq.c'; then $(CYGPATH_W) 'lib/test_zmq.c'; else $(CYGPATH_W) '$(srcdir)/lib/test_zmq.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) lib/$(DEPDIR)/lib_test_zmq-test_zmq.Tpo lib/$(DEPDIR)/lib_test_zmq-test_zmq.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='lib/test_zmq.c' object='lib/lib_test_zmq-test_zmq.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_test_zmq_CFLAGS) $(CFLAGS) -c -o lib/lib_test_zmq-test_zmq.obj `if test -f 'lib/test_zmq.c'; then $(CYGPATH_W) 'lib/test_zmq.c'; else $(CYGPATH_W) '$(srcdir)/lib/test_zmq.c'; fi` - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -rm -rf bgpd/.libs bgpd/_libs - -rm -rf isisd/.libs isisd/_libs - -rm -rf lib/.libs lib/_libs - -rm -rf lib/cli/.libs lib/cli/_libs - -rm -rf ospf6d/.libs ospf6d/_libs - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-am -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: ctags-am - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-am - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) -check: check-am -all-am: Makefile $(HEADERS) -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -rm -f bgpd/$(DEPDIR)/$(am__dirstamp) - -rm -f bgpd/$(am__dirstamp) - -rm -f helpers/c/$(DEPDIR)/$(am__dirstamp) - -rm -f helpers/c/$(am__dirstamp) - -rm -f isisd/$(DEPDIR)/$(am__dirstamp) - -rm -f isisd/$(am__dirstamp) - -rm -f lib/$(DEPDIR)/$(am__dirstamp) - -rm -f lib/$(am__dirstamp) - -rm -f lib/cli/$(DEPDIR)/$(am__dirstamp) - -rm -f lib/cli/$(am__dirstamp) - -rm -f ospf6d/$(DEPDIR)/$(am__dirstamp) - -rm -f ospf6d/$(am__dirstamp) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ - mostlyclean-am - -distclean: distclean-am - -rm -rf bgpd/$(DEPDIR) helpers/c/$(DEPDIR) isisd/$(DEPDIR) lib/$(DEPDIR) lib/cli/$(DEPDIR) ospf6d/$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf bgpd/$(DEPDIR) helpers/c/$(DEPDIR) isisd/$(DEPDIR) lib/$(DEPDIR) lib/cli/$(DEPDIR) ospf6d/$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: check-am install-am install-strip - -.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \ - clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \ - ctags ctags-am distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-am uninstall uninstall-am - -.PRECIOUS: Makefile - -.c_clippy.c: - @{ test -x $(top_builddir)/$(HOSTTOOLS)lib/clippy || $(MAKE) -C $(top_builddir)/$(HOSTTOOLS) lib/clippy; } - $(AM_V_CLIPPY)$(top_builddir)/$(HOSTTOOLS)lib/clippy $(top_srcdir)/python/clidef.py -o $@ $< - -.l.c: - $(AM_V_LEX)$(am__skiplex) $(LEXCOMPILE) $< -.y.c: - $(AM_V_YACC)$(am__skipyacc) $(YACCCOMPILE) $< - -# Rules -@HAVE_PROTOBUF_TRUE@.proto.pb.h: -@HAVE_PROTOBUF_TRUE@ $(Q_PROTOC) -I$(top_srcdir) --cpp_out=$(top_srcdir) $(top_srcdir)/$^ - -@HAVE_PROTOBUF_TRUE@.proto.pb-c.c: -@HAVE_PROTOBUF_TRUE@ $(AM_V_PROTOC_C)$(Q_PROTOC_C) -I$(top_srcdir) --c_out=$(top_srcdir) $(top_srcdir)/$^ -@HAVE_PROTOBUF_TRUE@.pb-c.c.pb-c.h: -@HAVE_PROTOBUF_TRUE@ @/bin/true - -PYTHON ?= python - -lib/cli/test_cli.o: lib/cli/test_cli_clippy.c -ospf6d/test_lsdb.o: ospf6d/test_lsdb_clippy.c - -../vtysh/vtysh_cmd.c: - $(MAKE) -C ../vtysh vtysh_cmd.c - -lib/cli/test_commands_defun.c: ../vtysh/vtysh_cmd.c - sed \ - -e 's/"vtysh\.h"/"tests.h"/' \ - -e 's/vtysh_init_cmd/test_init_cmd/' \ - -e 's/VTYSH_[A-Z][A-Z_0-9]*/0/g' \ - < ../vtysh/vtysh_cmd.c \ - > "$@" - -isisd/test_fuzz_isis_tlv_tests.h: $(top_srcdir)/tests/isisd/test_fuzz_isis_tlv_tests.h.gz - gzip -d < $(top_srcdir)/tests/isisd/test_fuzz_isis_tlv_tests.h.gz > "$@" -isisd/isisd_test_fuzz_isis_tlv-test_fuzz_isis_tlv.$(OBJEXT): \ - isisd/test_fuzz_isis_tlv_tests.h - -.PHONY: tests.xml -tests.xml: $(check_PROGRAMS) - $(PYTHON) $(srcdir)/runtests.py --junitxml=$@ -v $(srcdir) -check: tests.xml - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/tests/lib/cxxcompat.c b/tests/lib/cxxcompat.c index 48fa0ec8a9..6624de7386 100644 --- a/tests/lib/cxxcompat.c +++ b/tests/lib/cxxcompat.c @@ -17,6 +17,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#define test__cplusplus + #include "lib/zebra.h" #include "lib/agg_table.h" @@ -107,6 +109,17 @@ #include "lib/zassert.h" #include "lib/zclient.h" +PREDECL_RBTREE_UNIQ(footree) +struct foo { + int dummy; + struct footree_item item; +}; +static int foocmp(const struct foo *a, const struct foo *b) +{ + return memcmp(&a->dummy, &b->dummy, sizeof(a->dummy)); +} +DECLARE_RBTREE_UNIQ(footree, struct foo, item, foocmp) + int main(int argc, char **argv) { return 0; diff --git a/tests/lib/test_prefix2str.c b/tests/lib/test_prefix2str.c new file mode 100644 index 0000000000..cbfc20a797 --- /dev/null +++ b/tests/lib/test_prefix2str.c @@ -0,0 +1,80 @@ +/* + * prefix2str() unit test + * Copyright (C) 2019 David Lamparter + * Portions: + * Copyright (C) 2019 Cumulus Networks, Inc + * Quentin Young + * + * 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 + */ +#include <zebra.h> + +#include "lib/prefix.h" + +#include "tests/helpers/c/prng.h" + +int main(int argc, char **argv) +{ + size_t i, j, k, l; + struct in6_addr i6; + char buf1[64], buf2[64], ntopbuf[64]; + struct prng *prng; + struct prefix p = {}; + + prng = prng_new(0); + /* IPv4 */ + p.family = AF_INET; + for (i = 0; i < 1000; i++) { + p.u.prefix = prng_rand(prng); + p.prefixlen = prng_rand(prng) >> 26; + snprintf(buf1, sizeof(buf1), "%s/%d", + inet_ntop(AF_INET, &p.u.prefix4, ntopbuf, + sizeof(ntopbuf)), + p.prefixlen); + prefix2str(&p, buf2, sizeof(buf2)); + assert(!strcmp(buf1, buf2)); + fprintf(stdout, "%s\n", buf1); + } + + /* IPv6 */ + p.family = AF_INET6; + for (i = 0; i < 10000; i++) { + uint16_t *i6w = (uint16_t *)&i6; + for (j = 0; j < 8; j++) + i6w[j] = prng_rand(prng); + + /* clear some words */ + l = prng_rand(prng) & 7; + for (j = 0; j < l; j++) { + uint32_t num = __builtin_ctz(prng_rand(prng)); + uint32_t where = prng_rand(prng) & 7; + + for (k = where; k < where + num && k < 8; k++) + i6w[k] = 0; + } + + p.prefixlen = prng_rand(prng) >> 24; + memcpy(&p.u.prefix, &i6, sizeof(i6)); + snprintf(buf1, sizeof(buf1), "%s/%d", + inet_ntop(AF_INET6, &p.u.prefix6, ntopbuf, + sizeof(ntopbuf)), + p.prefixlen); + prefix2str(&p, buf2, sizeof(buf2)); + assert(!strcmp(buf1, buf2)); + fprintf(stdout, "%s\n", buf1); + } + + return 0; +} diff --git a/tests/lib/test_prefix2str.py b/tests/lib/test_prefix2str.py new file mode 100644 index 0000000000..6e26d1b409 --- /dev/null +++ b/tests/lib/test_prefix2str.py @@ -0,0 +1,6 @@ +import frrtest + +class TestPrefix2str(frrtest.TestMultiOut): + program = './test_prefix2str' + +TestPrefix2str.exit_cleanly() diff --git a/tests/lib/test_printfrr.c b/tests/lib/test_printfrr.c index c8ef150b07..24de3fa88d 100644 --- a/tests/lib/test_printfrr.c +++ b/tests/lib/test_printfrr.c @@ -27,6 +27,7 @@ static int errors; +static void printcmp(const char *fmt, ...) PRINTFRR(1, 2); static void printcmp(const char *fmt, ...) { va_list ap; @@ -58,6 +59,7 @@ static void printcmp(const char *fmt, ...) errors++; } +static void printchk(const char *ref, const char *fmt, ...) PRINTFRR(2, 3); static void printchk(const char *ref, const char *fmt, ...) { va_list ap; diff --git a/tests/subdir.am b/tests/subdir.am index 41f1a4873b..270c0811b4 100644 --- a/tests/subdir.am +++ b/tests/subdir.am @@ -55,6 +55,7 @@ check_PROGRAMS = \ tests/lib/test_memory \ tests/lib/test_nexthop_iter \ tests/lib/test_ntop \ + tests/lib/test_prefix2str \ tests/lib/test_printfrr \ tests/lib/test_privs \ tests/lib/test_ringbuf \ @@ -236,6 +237,10 @@ tests_lib_test_ntop_CFLAGS = $(TESTS_CFLAGS) tests_lib_test_ntop_CPPFLAGS = $(TESTS_CPPFLAGS) tests_lib_test_ntop_LDADD = # none tests_lib_test_ntop_SOURCES = tests/lib/test_ntop.c tests/helpers/c/prng.c +tests_lib_test_prefix2str_CFLAGS = $(TESTS_CFLAGS) +tests_lib_test_prefix2str_CPPFLAGS = $(TESTS_CPPFLAGS) +tests_lib_test_prefix2str_LDADD = $(ALL_TESTS_LDADD) +tests_lib_test_prefix2str_SOURCES = tests/lib/test_prefix2str.c tests/helpers/c/prng.c tests_lib_test_printfrr_CFLAGS = $(TESTS_CFLAGS) tests_lib_test_printfrr_CPPFLAGS = $(TESTS_CPPFLAGS) tests_lib_test_printfrr_LDADD = $(ALL_TESTS_LDADD) @@ -328,6 +333,7 @@ EXTRA_DIST += \ tests/lib/test_atomlist.py \ tests/lib/test_nexthop_iter.py \ tests/lib/test_ntop.py \ + tests/lib/test_prefix2str.py \ tests/lib/test_printfrr.py \ tests/lib/test_ringbuf.py \ tests/lib/test_srcdest_table.py \ diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/scale_down.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/scale_down.py index 897fc48436..c17bf1168c 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/scale_down.py +++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/scale_down.py @@ -6,7 +6,7 @@ if ret != False and found != None: luCommand('ce3', 'vtysh -c "show bgp sum"', '.', 'pass', 'See %s sharp routes' % num) if num > 0: - wait = num/500 + wait = 2*num/500 luCommand('ce1', 'vtysh -c "sharp remove routes 10.0.0.0 {}"'.format(num),'.','none','Removing {} routes'.format(num)) luCommand('ce2', 'vtysh -c "sharp remove routes 10.0.0.0 {}"'.format(num),'.','none','Removing {} routes'.format(num)) rtrs = ['ce1', 'ce2', 'ce3'] diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/scale_up.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/scale_up.py index 3b3aac5fbe..7f114d10df 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/scale_up.py +++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/scale_up.py @@ -10,7 +10,7 @@ if c > 0: d = r - c * 256 - 1 else: d = r -wait = num/1000 +wait = 2*num/1000 mem = {} rtrs = ['ce1', 'ce2', 'ce3', 'r1', 'r2', 'r3', 'r4'] for rtr in rtrs: diff --git a/tests/topotests/lib/topotest.py b/tests/topotests/lib/topotest.py index 2acb04fb0e..86993665ce 100644 --- a/tests/topotests/lib/topotest.py +++ b/tests/topotests/lib/topotest.py @@ -38,6 +38,11 @@ import time from lib.topolog import logger +if sys.version_info[0] > 2: + import configparser +else: + import ConfigParser as configparser + from mininet.topo import Topo from mininet.net import Mininet from mininet.node import Node, OVSSwitch, Host @@ -624,6 +629,20 @@ class Router(Node): super(Router, self).__init__(name, **params) self.logdir = params.get('logdir') + # Backward compatibility: + # Load configuration defaults like topogen. + self.config_defaults = configparser.ConfigParser({ + 'verbosity': 'info', + 'frrdir': '/usr/lib/frr', + 'quaggadir': '/usr/lib/quagga', + 'routertype': 'frr', + 'memleak_path': None, + }) + self.config_defaults.read( + os.path.join(os.path.dirname(os.path.realpath(__file__)), + '../pytest.ini') + ) + # If this topology is using old API and doesn't have logdir # specified, then attempt to generate an unique logdir. if self.logdir is None: @@ -652,7 +671,7 @@ class Router(Node): "Configure FRR binaries" self.daemondir = params.get('frrdir') if self.daemondir is None: - self.daemondir = '/usr/lib/frr' + self.daemondir = self.config_defaults.get('topogen', 'frrdir') zebra_path = os.path.join(self.daemondir, 'zebra') if not os.path.isfile(zebra_path): @@ -662,7 +681,7 @@ class Router(Node): "Configure Quagga binaries" self.daemondir = params.get('quaggadir') if self.daemondir is None: - self.daemondir = '/usr/lib/quagga' + self.daemondir = self.config_defaults.get('topogen', 'quaggadir') zebra_path = os.path.join(self.daemondir, 'zebra') if not os.path.isfile(zebra_path): @@ -676,7 +695,10 @@ class Router(Node): # User did not specify the daemons directory, try to autodetect it. self.daemondir = params.get('daemondir') if self.daemondir is None: - self.routertype = params.get('routertype', 'frr') + self.routertype = params.get('routertype', + self.config_defaults.get( + 'topogen', + 'routertype')) if self.routertype == 'quagga': self._config_quagga(**params) else: @@ -688,7 +710,7 @@ class Router(Node): raise Exception('No zebra binary found in {}'.format(zpath)) # Allow user to specify routertype when the path was specified. if params.get('routertype') is not None: - self.routertype = self.params.get('routertype') + self.routertype = params.get('routertype') self.cmd('ulimit -c unlimited') # Set ownership of config files diff --git a/tools/frr.vim b/tools/frr.vim new file mode 100644 index 0000000000..86aa0c0e3f --- /dev/null +++ b/tools/frr.vim @@ -0,0 +1,36 @@ +" settings & syntax hilighting for FRR codebase +" 2019 by David Lamparter, placed in public domain + +let c_gnu=1 + +function! CStyleFRR() + syn clear cFormat + syn match cFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlLjzt]\|ll\|hh\)\=\([aAbiuoxXDOUfFeEgGcCsSn]\|[pd]\([A-Z][A-Z0-9]*[a-z]*\|\)\|\[\^\=.[^]]*\]\)" contained + syn match cFormat display "%%" contained + + syn keyword cIterator frr_each frr_each_safe frr_each_from + syn keyword cMacroOp offsetof container_of container_of_null array_size + + syn keyword cStorageClass atomic + syn keyword cFormatConst PRId64 PRIu64 PRIx64 + syn keyword cFormatConst PRId32 PRIu32 PRIx32 + syn keyword cFormatConst PRId16 PRIu16 PRIx16 + syn keyword cFormatConst PRId8 PRIu8 PRIx8 + + " you can unlink these by just giving them their own hilighting / color + hi link cFormatConst cFormat + hi link cIterator cRepeat + hi link cMacroOp cOperator + + " indentation + setlocal cindent + setlocal cinoptions=:0,(0,u4,w1,W8 + setlocal shiftwidth=8 + setlocal softtabstop=0 + setlocal textwidth=0 + setlocal fo=croql + setlocal noet +endfunction + +" auto-apply the above based on path rules +"autocmd BufRead,BufNewFile /home/.../frr/*.[ch] call CStyleFRR() diff --git a/zebra/interface.c b/zebra/interface.c index 13582008a7..b24edc577a 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -1517,7 +1517,6 @@ static void if_dump_vty(struct vty *vty, struct interface *ifp) #endif /* HAVE_PROC_NET_DEV */ #ifdef HAVE_NET_RT_IFLIST -#if defined(__bsdi__) || defined(__NetBSD__) /* Statistics print out using sysctl (). */ vty_out(vty, " input packets %llu, bytes %llu, dropped %llu," @@ -1542,25 +1541,6 @@ static void if_dump_vty(struct vty *vty, struct interface *ifp) vty_out(vty, " collisions %llu\n", (unsigned long long)ifp->stats.ifi_collisions); -#else - /* Statistics print out using sysctl (). */ - vty_out(vty, - " input packets %lu, bytes %lu, dropped %lu," - " multicast packets %lu\n", - ifp->stats.ifi_ipackets, ifp->stats.ifi_ibytes, - ifp->stats.ifi_iqdrops, ifp->stats.ifi_imcasts); - - vty_out(vty, " input errors %lu\n", ifp->stats.ifi_ierrors); - - vty_out(vty, - " output packets %lu, bytes %lu, multicast packets %lu\n", - ifp->stats.ifi_opackets, ifp->stats.ifi_obytes, - ifp->stats.ifi_omcasts); - - vty_out(vty, " output errors %lu\n", ifp->stats.ifi_oerrors); - - vty_out(vty, " collisions %lu\n", ifp->stats.ifi_collisions); -#endif /* __bsdi__ || __NetBSD__ */ #endif /* HAVE_NET_RT_IFLIST */ } diff --git a/zebra/kernel_netlink.c b/zebra/kernel_netlink.c index 387a3531bd..4971994346 100644 --- a/zebra/kernel_netlink.c +++ b/zebra/kernel_netlink.c @@ -23,6 +23,7 @@ #if defined(HANDLE_NETLINK_FUZZING) #include <stdio.h> #include <string.h> +#include "libfrr.h" #endif /* HANDLE_NETLINK_FUZZING */ #ifdef HAVE_NETLINK diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 257fb168d2..1f8eec9cad 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -2172,7 +2172,7 @@ DEFPY (show_evpn_mac_vni_all_dad, DEFPY (show_evpn_mac_vni_dad, show_evpn_mac_vni_dad_cmd, - "show evpn mac vni " CMD_VNI_RANGE " duplicate" "[json]", + "show evpn mac vni " CMD_VNI_RANGE " duplicate [json]", SHOW_STR "EVPN\n" "MAC addresses\n" @@ -2182,10 +2182,8 @@ DEFPY (show_evpn_mac_vni_dad, JSON_STR) { struct zebra_vrf *zvrf; - vni_t vni; bool uj = use_json(argc, argv); - vni = strtoul(argv[4]->arg, NULL, 10); zvrf = zebra_vrf_get_evpn(); zebra_vxlan_print_macs_vni_dad(vty, zvrf, vni, uj); @@ -2195,7 +2193,7 @@ DEFPY (show_evpn_mac_vni_dad, DEFPY (show_evpn_neigh_vni_dad, show_evpn_neigh_vni_dad_cmd, - "show evpn arp-cache vni " CMD_VNI_RANGE "duplicate" "[json]", + "show evpn arp-cache vni " CMD_VNI_RANGE "duplicate [json]", SHOW_STR "EVPN\n" "ARP and ND cache\n" @@ -2205,10 +2203,8 @@ DEFPY (show_evpn_neigh_vni_dad, JSON_STR) { struct zebra_vrf *zvrf; - vni_t vni; bool uj = use_json(argc, argv); - vni = strtoul(argv[4]->arg, NULL, 10); zvrf = zebra_vrf_get_evpn(); zebra_vxlan_print_neigh_vni_dad(vty, zvrf, vni, uj); return CMD_SUCCESS; @@ -2387,7 +2383,7 @@ DEFUN (show_pbr_iptable, DEFPY (clear_evpn_dup_addr, clear_evpn_dup_addr_cmd, - "clear evpn dup-addr vni <all$vni_all |" CMD_VNI_RANGE"$vni_val [mac M:A:C$mac_val | ip <A.B.C.D|X:X::X:X>]>", + "clear evpn dup-addr vni <all$vni_all |" CMD_VNI_RANGE"$vni [mac M:A:C$mac_val | ip <A.B.C.D|X:X::X:X>]>", CLEAR_STR "EVPN\n" "Duplicate address \n" @@ -2401,15 +2397,12 @@ DEFPY (clear_evpn_dup_addr, "IPv6 address\n") { struct zebra_vrf *zvrf; - vni_t vni = 0; struct ipaddr host_ip = {.ipa_type = IPADDR_NONE }; struct ethaddr mac_addr; int ret = CMD_SUCCESS; zvrf = zebra_vrf_get_evpn(); - if (vni_val) { - vni = strtoul(vni_val, NULL, 10); - + if (vni_str) { if (mac_val) { prefix_str2mac(mac_val, &mac_addr); ret = zebra_vxlan_clear_dup_detect_vni_mac(vty, zvrf, diff --git a/zebra/zserv.c b/zebra/zserv.c index 49fb302ba8..cb9ca6578b 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -1067,10 +1067,8 @@ DEFUN (show_zebra_client_summary, void zserv_read_file(char *input) { int fd; - struct thread t; fd = open(input, O_RDONLY | O_NONBLOCK); - t.u.fd = fd; zserv_client_create(fd); } |
