diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/command.c | 3 | ||||
| -rw-r--r-- | lib/log.c | 3 | ||||
| -rw-r--r-- | lib/routemap.c | 29 | ||||
| -rw-r--r-- | lib/routemap.h | 13 | ||||
| -rw-r--r-- | lib/sigevent.c | 2 | ||||
| -rw-r--r-- | lib/skiplist.c | 6 | ||||
| -rw-r--r-- | lib/thread.c | 7 | ||||
| -rw-r--r-- | lib/thread.h | 4 | ||||
| -rw-r--r-- | lib/vrf.h | 2 | ||||
| -rw-r--r-- | lib/zclient.c | 28 | ||||
| -rw-r--r-- | lib/zclient.h | 15 | ||||
| -rw-r--r-- | lib/zebra.h | 4 |
12 files changed, 72 insertions, 44 deletions
diff --git a/lib/command.c b/lib/command.c index 7d335e1c36..87110157f6 100644 --- a/lib/command.c +++ b/lib/command.c @@ -154,7 +154,8 @@ static bool vty_check_node_for_xpath_decrement(enum node_type target_node, || node == BGP_IPV4M_NODE || node == BGP_IPV6M_NODE || node == BGP_VPNV4_NODE || node == BGP_VPNV6_NODE || node == BGP_EVPN_NODE || node == BGP_IPV4L_NODE - || node == BGP_IPV6L_NODE )) + || node == BGP_IPV6L_NODE || node == BGP_FLOWSPECV4_NODE + || node == BGP_FLOWSPECV6_NODE)) return false; return true; @@ -455,7 +455,8 @@ static const struct zebra_desc_table command_types[] = { DESC_ENTRY(ZEBRA_NEIGH_DISCOVER), DESC_ENTRY(ZEBRA_NHG_ADD), DESC_ENTRY(ZEBRA_NHG_DEL), - DESC_ENTRY(ZEBRA_NHG_NOTIFY_OWNER)}; + DESC_ENTRY(ZEBRA_NHG_NOTIFY_OWNER), + DESC_ENTRY(ZEBRA_ROUTE_NOTIFY_REQUEST)}; #undef DESC_ENTRY static const struct zebra_desc_table unknown = {0, "unknown", '?'}; diff --git a/lib/routemap.c b/lib/routemap.c index 0eb54a4794..004beb3628 100644 --- a/lib/routemap.c +++ b/lib/routemap.c @@ -1530,8 +1530,7 @@ enum rmap_compile_rets route_map_delete_set(struct route_map_index *index, static enum route_map_cmd_result_t route_map_apply_match(struct route_map_rule_list *match_list, - const struct prefix *prefix, route_map_object_t type, - void *object) + const struct prefix *prefix, void *object) { enum route_map_cmd_result_t ret = RMAP_NOMATCH; struct route_map_rule *match; @@ -1555,7 +1554,7 @@ route_map_apply_match(struct route_map_rule_list *match_list, * If all result in NOOP, end-result is NOOP. */ ret = (*match->cmd->func_apply)(match->value, prefix, - type, object); + object); /* * If the consolidated result of func_apply is: @@ -1647,9 +1646,10 @@ static struct list *route_map_get_index_list(struct route_node **rn, /* * This function returns the route-map index that best matches the prefix. */ -static struct route_map_index * -route_map_get_index(struct route_map *map, const struct prefix *prefix, - route_map_object_t type, void *object, uint8_t *match_ret) +static struct route_map_index *route_map_get_index(struct route_map *map, + const struct prefix *prefix, + void *object, + uint8_t *match_ret) { int ret = 0; struct list *candidate_rmap_list = NULL; @@ -1695,7 +1695,7 @@ route_map_get_index(struct route_map *map, const struct prefix *prefix, break; ret = route_map_apply_match(&index->match_list, prefix, - type, object); + object); if (ret == RMAP_MATCH) { *match_ret = ret; @@ -2369,8 +2369,7 @@ void route_map_notify_pentry_dependencies(const char *affected_name, We need to make sure our route-map processing matches the above */ route_map_result_t route_map_apply(struct route_map *map, - const struct prefix *prefix, - route_map_object_t type, void *object) + const struct prefix *prefix, void *object) { static int recursion = 0; enum route_map_cmd_result_t match_ret = RMAP_NOMATCH; @@ -2397,7 +2396,7 @@ route_map_result_t route_map_apply(struct route_map *map, if ((!map->optimization_disabled) && (map->ipv4_prefix_table || map->ipv6_prefix_table)) { - index = route_map_get_index(map, prefix, type, object, + index = route_map_get_index(map, prefix, object, (uint8_t *)&match_ret); if (index) { if (rmap_debug) @@ -2431,7 +2430,7 @@ route_map_result_t route_map_apply(struct route_map *map, index->applied++; /* Apply this index. */ match_ret = route_map_apply_match(&index->match_list, - prefix, type, object); + prefix, object); if (rmap_debug) { zlog_debug( "Route-map: %s, sequence: %d, prefix: %pFX, result: %s", @@ -2489,9 +2488,8 @@ route_map_result_t route_map_apply(struct route_map *map, * set succeeded or not. So, ignore * return code. */ - (void) (*set->cmd->func_apply)( - set->value, prefix, type, - object); + (void)(*set->cmd->func_apply)( + set->value, prefix, object); /* Call another route-map if available */ if (index->nextrm) { @@ -2504,8 +2502,7 @@ route_map_result_t route_map_apply(struct route_map *map, { recursion++; ret = route_map_apply( - nextrm, prefix, type, - object); + nextrm, prefix, object); recursion--; } diff --git a/lib/routemap.h b/lib/routemap.h index 64da4b87ef..3e208c8cb5 100644 --- a/lib/routemap.h +++ b/lib/routemap.h @@ -68,17 +68,6 @@ enum route_map_cmd_result_t { RMAP_ERROR }; - -typedef enum { - RMAP_RIP, - RMAP_RIPNG, - RMAP_OSPF, - RMAP_OSPF6, - RMAP_BGP, - RMAP_ZEBRA, - RMAP_ISIS, -} route_map_object_t; - typedef enum { RMAP_EXIT, RMAP_GOTO, RMAP_NEXT } route_map_end_t; typedef enum { @@ -117,7 +106,6 @@ struct route_map_rule_cmd { /* Function for value set or match. */ enum route_map_cmd_result_t (*func_apply)(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object); /* Compile argument and return result as void *. */ @@ -299,7 +287,6 @@ struct route_map *route_map_lookup_warn_noexist(struct vty *vty, const char *nam /* Apply route map to the object. */ extern route_map_result_t route_map_apply(struct route_map *map, const struct prefix *prefix, - route_map_object_t object_type, void *object); extern void route_map_add_hook(void (*func)(const char *)); diff --git a/lib/sigevent.c b/lib/sigevent.c index de9e1f5410..8d583096f6 100644 --- a/lib/sigevent.c +++ b/lib/sigevent.c @@ -250,6 +250,8 @@ core_handler(int signo, siginfo_t *siginfo, void *context) /* dump memory stats on core */ log_memstats(stderr, "core_handler"); + + zlog_tls_buffer_fini(); abort(); } diff --git a/lib/skiplist.c b/lib/skiplist.c index 2bef18f525..b79dfa6772 100644 --- a/lib/skiplist.c +++ b/lib/skiplist.c @@ -74,7 +74,6 @@ DEFINE_MTYPE_STATIC(LIB, SKIP_LIST_NODE, "Skip Node") static int randomsLeft; static int randomBits; -static struct skiplist *skiplist_last_created; /* debugging hack */ #if 1 #define CHECKLAST(sl) \ @@ -150,8 +149,6 @@ struct skiplist *skiplist_new(int flags, if (del) new->del = del; - skiplist_last_created = new; /* debug */ - return new; } @@ -586,7 +583,8 @@ void skiplist_debug(struct vty *vty, struct skiplist *l) int i; if (!l) - l = skiplist_last_created; + return; + vty_out(vty, "Skiplist %p has max level %d\n", l, l->level); for (i = l->level; i >= 0; --i) vty_out(vty, " @%d: %ld\n", i, diff --git a/lib/thread.c b/lib/thread.c index db53e267f8..e71fd74bd9 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -115,10 +115,9 @@ static void vty_out_cpu_thread_history(struct vty *vty, struct cpu_thread_history *a) { vty_out(vty, "%5zu %10zu.%03zu %9zu %8zu %9zu %8zu %9zu", - (size_t)a->total_active, a->cpu.total / 1000, - a->cpu.total % 1000, (size_t)a->total_calls, - (size_t)(a->cpu.total / a->total_calls), a->cpu.max, - (size_t)(a->real.total / a->total_calls), a->real.max); + a->total_active, a->cpu.total / 1000, a->cpu.total % 1000, + a->total_calls, (a->cpu.total / a->total_calls), a->cpu.max, + (a->real.total / a->total_calls), a->real.max); vty_out(vty, " %c%c%c%c%c %s\n", a->types & (1 << THREAD_READ) ? 'R' : ' ', a->types & (1 << THREAD_WRITE) ? 'W' : ' ', diff --git a/lib/thread.h b/lib/thread.h index 682a17b9f3..eb1b107e7b 100644 --- a/lib/thread.h +++ b/lib/thread.h @@ -115,8 +115,8 @@ struct thread { struct cpu_thread_history { int (*func)(struct thread *); - atomic_uint_fast32_t total_calls; - atomic_uint_fast32_t total_active; + atomic_size_t total_calls; + atomic_size_t total_active; struct time_stats { atomic_size_t total, max; } real; @@ -43,7 +43,7 @@ enum { IFLA_VRF_UNSPEC, IFLA_VRF_TABLE, __IFLA_VRF_MAX }; #endif #define VRF_NAMSIZ 36 -#define NS_NAMSIZ 16 +#define NS_NAMSIZ 36 /* * The command strings diff --git a/lib/zclient.c b/lib/zclient.c index d0144279e5..bab1acf667 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -1494,9 +1494,12 @@ stream_failure: bool zapi_route_notify_decode(struct stream *s, struct prefix *p, uint32_t *tableid, - enum zapi_route_notify_owner *note) + enum zapi_route_notify_owner *note, + afi_t *afi, safi_t *safi) { uint32_t t; + afi_t afi_val; + safi_t safi_val; STREAM_GET(note, s, sizeof(*note)); @@ -1504,9 +1507,16 @@ bool zapi_route_notify_decode(struct stream *s, struct prefix *p, STREAM_GETC(s, p->prefixlen); STREAM_GET(&p->u.prefix, s, prefix_blen(p)); STREAM_GETL(s, t); + STREAM_GETC(s, afi_val); + STREAM_GETC(s, safi_val); *tableid = t; + if (afi) + *afi = afi_val; + if (safi) + *safi = safi_val; + return true; stream_failure: @@ -1815,6 +1825,22 @@ int zebra_redistribute_default_send(int command, struct zclient *zclient, return zclient_send_message(zclient); } +/* Send route notify request to zebra */ +int zebra_route_notify_send(int command, struct zclient *zclient, bool set) +{ + struct stream *s; + + s = zclient->obuf; + stream_reset(s); + + zclient_create_header(s, command, 0); + stream_putc(s, !!set); + + stream_putw_at(s, 0, stream_get_endp(s)); + + return zclient_send_message(zclient); +} + /* Get prefix in ZServ format; family should be filled in on prefix */ static int zclient_stream_get_prefix(struct stream *s, struct prefix *p) { diff --git a/lib/zclient.h b/lib/zclient.h index 80dca3fc56..3c80ba7efa 100644 --- a/lib/zclient.h +++ b/lib/zclient.h @@ -218,6 +218,7 @@ typedef enum { ZEBRA_OPAQUE_REGISTER, ZEBRA_OPAQUE_UNREGISTER, ZEBRA_NEIGH_DISCOVER, + ZEBRA_ROUTE_NOTIFY_REQUEST, } zebra_message_types_t; enum zebra_error_types { @@ -513,6 +514,13 @@ struct zapi_route { * offload situation. */ #define ZEBRA_FLAG_OFFLOADED 0x100 +/* + * This flag tells everyone that the route has + * failed offloading. + * This flag makes no sense unless you are in an asic + * offload situation. + */ +#define ZEBRA_FLAG_OFFLOAD_FAILED 0x200 /* The older XXX_MESSAGE flags live here */ uint32_t message; @@ -778,6 +786,10 @@ extern int zebra_redistribute_send(int command, struct zclient *, afi_t, extern int zebra_redistribute_default_send(int command, struct zclient *zclient, afi_t afi, vrf_id_t vrf_id); +/* Send route notify request to zebra */ +extern int zebra_route_notify_send(int command, struct zclient *zclient, + bool set); + /* If state has changed, update state and call zebra_redistribute_send. */ extern void zclient_redistribute(int command, struct zclient *, afi_t, int type, unsigned short instance, vrf_id_t vrf_id); @@ -910,7 +922,8 @@ bool zapi_nhg_notify_decode(struct stream *s, uint32_t *id, enum zapi_nhg_notify_owner *note); bool zapi_route_notify_decode(struct stream *s, struct prefix *p, uint32_t *tableid, - enum zapi_route_notify_owner *note); + enum zapi_route_notify_owner *note, + afi_t *afi, safi_t *safi); bool zapi_rule_notify_decode(struct stream *s, uint32_t *seqno, uint32_t *priority, uint32_t *unique, char *ifname, enum zapi_rule_notify_owner *note); diff --git a/lib/zebra.h b/lib/zebra.h index 14d66d6627..ded44ac636 100644 --- a/lib/zebra.h +++ b/lib/zebra.h @@ -359,6 +359,10 @@ typedef enum { SAFI_MAX = 8 } safi_t; +#define FOREACH_AFI_SAFI(afi, safi) \ + for (afi = AFI_IP; afi < AFI_MAX; afi++) \ + for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) + /* Default Administrative Distance of each protocol. */ #define ZEBRA_KERNEL_DISTANCE_DEFAULT 0 #define ZEBRA_CONNECT_DISTANCE_DEFAULT 0 |
