-/* $OpenBSD: rtable.c,v 1.63 2017/09/05 11:15:39 mpi Exp $ */
+/* $OpenBSD: rtable.c,v 1.64 2018/09/09 10:07:38 henning Exp $ */
/*
* Copyright (c) 2014-2016 Martin Pieuchot
return (0);
}
+int
+rtable_empty(unsigned int rtableid)
+{
+ struct domain *dp;
+ int i;
+ struct art_root *tbl;
+
+ for (i = 0; (dp = domains[i]) != NULL; i++) {
+ if (dp->dom_rtoffset == 0)
+ continue;
+
+ tbl = rtable_get(rtableid, dp->dom_family);
+ if (tbl == NULL)
+ continue;
+ if (tbl->ar_root.ref != NULL)
+ return (0);
+ }
+
+ return (1);
+}
+
unsigned int
rtable_l2(unsigned int rtableid)
{
-/* $OpenBSD: rtable.h,v 1.20 2017/08/02 08:38:28 mpi Exp $ */
+/* $OpenBSD: rtable.h,v 1.21 2018/09/09 10:07:38 henning Exp $ */
/*
* Copyright (c) 2014-2016 Martin Pieuchot
void rtable_init(void);
int rtable_exists(unsigned int);
+int rtable_empty(unsigned int);
int rtable_add(unsigned int);
unsigned int rtable_l2(unsigned int);
unsigned int rtable_loindex(unsigned int);