diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/prefix.h | 2 | ||||
| -rwxr-xr-x[-rw-r--r--] | lib/resolver.c | 3 | ||||
| -rw-r--r-- | lib/routemap.c | 12 | ||||
| -rw-r--r-- | lib/routemap.h | 4 | ||||
| -rw-r--r-- | lib/typesafe.h | 19 |
5 files changed, 35 insertions, 5 deletions
diff --git a/lib/prefix.h b/lib/prefix.h index 3a768572c4..7b2f889874 100644 --- a/lib/prefix.h +++ b/lib/prefix.h @@ -352,7 +352,7 @@ union prefixconstptr { #define PREFIX_STRLEN 80 /* - * Longest possible length of a (S,G) string is 36 bytes + * Longest possible length of a (S,G) string is 34 bytes * 123.123.123.123 = 15 * 2 * (,) = 3 * NULL Character at end = 1 diff --git a/lib/resolver.c b/lib/resolver.c index 93fa84bbe9..0d64ad86e4 100644..100755 --- a/lib/resolver.c +++ b/lib/resolver.c @@ -245,6 +245,9 @@ void resolver_resolve(struct resolver_query *query, int af, vrf_id_t vrf_id, { int ret; + if (hostname == NULL) + return; + if (query->callback != NULL) { flog_err( EC_LIB_RESOLVER, diff --git a/lib/routemap.c b/lib/routemap.c index 7fd5a96e5b..9529b79419 100644 --- a/lib/routemap.c +++ b/lib/routemap.c @@ -2540,7 +2540,8 @@ void route_map_notify_pentry_dependencies(const char *affected_name, */ route_map_result_t route_map_apply_ext(struct route_map *map, const struct prefix *prefix, - void *match_object, void *set_object) + void *match_object, void *set_object, + int *pref) { static int recursion = 0; enum route_map_cmd_result_t match_ret = RMAP_NOMATCH; @@ -2676,7 +2677,7 @@ route_map_result_t route_map_apply_ext(struct route_map *map, ret = route_map_apply_ext( nextrm, prefix, match_object, - set_object); + set_object, NULL); recursion--; } @@ -2721,6 +2722,13 @@ route_map_apply_end: (map ? map->name : "null"), prefix, route_map_result_str(ret)); + if (pref) { + if (index != NULL && ret == RMAP_PERMITMATCH) + *pref = index->pref; + else + *pref = 65536; + } + return (ret); } diff --git a/lib/routemap.h b/lib/routemap.h index 13dafe6849..ad391981e0 100644 --- a/lib/routemap.h +++ b/lib/routemap.h @@ -482,9 +482,9 @@ struct route_map *route_map_lookup_warn_noexist(struct vty *vty, const char *nam extern route_map_result_t route_map_apply_ext(struct route_map *map, const struct prefix *prefix, void *match_object, - void *set_object); + void *set_object, int *pref); #define route_map_apply(map, prefix, object) \ - route_map_apply_ext(map, prefix, object, object) + route_map_apply_ext(map, prefix, object, object, NULL) extern void route_map_add_hook(void (*func)(const char *)); extern void route_map_delete_hook(void (*func)(const char *)); diff --git a/lib/typesafe.h b/lib/typesafe.h index 06fdc52e78..50c410ad24 100644 --- a/lib/typesafe.h +++ b/lib/typesafe.h @@ -308,6 +308,25 @@ struct dlist_head { static inline void typesafe_dlist_add(struct dlist_head *head, struct dlist_item *prev, struct dlist_item *item) { + /* SA on clang-11 thinks this can happen, but in reality -assuming no + * memory corruption- it can't. DLIST uses a "closed" ring, i.e. the + * termination at the end of the list is not NULL but rather a pointer + * back to the head. (This eliminates special-casing the first or last + * item.) + * + * Sadly, can't use assert() here since the libfrr assert / xref code + * uses typesafe lists itself... that said, if an assert tripped here + * we'd already be way past some memory corruption, so we might as + * well just take the SEGV. (In the presence of corruption, we'd see + * random SEGVs from places that make no sense at all anyway, an + * assert might actually be a red herring.) + * + * ("assume()" tells the compiler to produce code as if the condition + * will always hold; it doesn't have any actual effect here, it'll + * just SEGV out on "item->next->prev = item".) + */ + assume(prev->next != NULL); + item->next = prev->next; item->next->prev = item; item->prev = prev; |
