summaryrefslogtreecommitdiff
path: root/lib/plist.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/plist.c')
-rw-r--r--lib/plist.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/lib/plist.c b/lib/plist.c
index ebd628d724..da6406d334 100644
--- a/lib/plist.c
+++ b/lib/plist.c
@@ -679,7 +679,9 @@ static int prefix_list_entry_match(struct prefix_list_entry *pentry,
return 1;
}
-enum prefix_list_type prefix_list_apply(struct prefix_list *plist, void *object)
+enum prefix_list_type prefix_list_apply_which_prefix(struct prefix_list *plist,
+ struct prefix **which,
+ void *object)
{
struct prefix_list_entry *pentry, *pbest = NULL;
@@ -689,11 +691,17 @@ enum prefix_list_type prefix_list_apply(struct prefix_list *plist, void *object)
size_t validbits = p->prefixlen;
struct pltrie_table *table;
- if (plist == NULL)
+ if (plist == NULL) {
+ if (which)
+ *which = NULL;
return PREFIX_DENY;
+ }
- if (plist->count == 0)
+ if (plist->count == 0) {
+ if (which)
+ *which = NULL;
return PREFIX_PERMIT;
+ }
depth = plist->master->trie_depth;
table = plist->trie;
@@ -729,6 +737,13 @@ enum prefix_list_type prefix_list_apply(struct prefix_list *plist, void *object)
break;
}
+ if (which) {
+ if (pbest)
+ *which = &pbest->prefix;
+ else
+ *which = NULL;
+ }
+
if (pbest == NULL)
return PREFIX_DENY;