-# $OpenBSD: Makefile.inc,v 1.7 2020/11/07 09:53:21 denis Exp $
+# $OpenBSD: Makefile.inc,v 1.8 2021/04/13 08:21:12 claudio Exp $
TOPDIR= ${.CURDIR}/..
-.ifdef RADIX
-SRCS+= radix.c
-.else
SRCS+= art.c
-CFLAGS+= -DART
-.endif
CPPFLAGS+= -I${TOPDIR} -Wall
-/* $OpenBSD: main.c,v 1.6 2019/06/24 12:33:36 visa Exp $ */
+/* $OpenBSD: main.c,v 1.7 2021/04/13 08:21:12 claudio Exp $ */
/*
* Copyright (c) 2015 Martin Pieuchot
#include <sys/socket.h>
#include <net/route.h>
+#include <net/rtable.h>
+#include <net/art.h>
+#include <assert.h>
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include "util.h"
-#ifdef ART
-#include <net/rtable.h>
-#include <net/art.h>
-
-#include <assert.h>
-
extern void *rtable_get(unsigned int, sa_family_t);
-#endif /* ART */
__dead void
usage(void)
rtable_walk(0, AF_INET6, NULL, rtentry_dump, NULL);
-#ifdef ART
struct art_root *ar;
ar = rtable_get(0, AF_INET6);
assert(ar != NULL);
assert(ar->ar_root.ref == NULL);
-#endif /* ART */
return (0);
}
-/* $OpenBSD: main.c,v 1.4 2019/06/24 12:33:36 visa Exp $ */
+/* $OpenBSD: main.c,v 1.5 2021/04/13 08:21:12 claudio Exp $ */
/*
* Copyright (c) 2015 Martin Pieuchot
#include <sys/socket.h>
#include <net/route.h>
+#include <net/rtable.h>
#include <err.h>
#include <stdio.h>
-/* $OpenBSD: kern_compat.h,v 1.11 2020/11/07 09:53:21 denis Exp $ */
+/* $OpenBSD: kern_compat.h,v 1.12 2021/04/13 08:21:12 claudio Exp $ */
#ifndef _KERN_COMPAT_H_
#define _KERN_COMPAT_H_
#include <sys/domain.h>
#include <sys/queue.h>
#include <sys/mutex.h>
+#include <sys/rwlock.h>
#include <sys/task.h>
#include <sys/select.h>
#include <arpa/inet.h>
#include <assert.h>
#include <err.h>
#include <errno.h>
+#include <limits.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include "srp_compat.h"
+#define _KERNEL
#define DIAGNOSTIC
#define INET
#define INET6
#define nitems(_a) (sizeof((_a)) / sizeof((_a)[0]))
#endif
-#define rtref(_rt) ((_rt)->rt_refcnt++)
-#define rtfree(_rt) (assert(--(_rt)->rt_refcnt >= 0))
-
#ifndef IPL_NONE
#define IPL_NONE 0
#endif
-/* $OpenBSD: util.c,v 1.8 2018/12/03 18:39:42 bluhm Exp $ */
+/* $OpenBSD: util.c,v 1.9 2021/04/13 08:21:12 claudio Exp $ */
/*
* Copyright (c) 2015 Martin Pieuchot
#include <sys/srp.h>
#include <net/rtable.h>
+#define _KERNEL
#include <net/route.h>
+#undef _KERNEL
#include <netinet/in.h>
#include <arpa/inet.h>
memset(cp2, 0, (unsigned int)(cplim2 - cp2));
}
+void
+rtref(struct rtentry *rt)
+{
+ rt->rt_refcnt++;
+}
+
+void
+rtfree(struct rtentry *rt)
+{
+ assert(--(rt->rt_refcnt) >= 0);
+}
+
void
in_prefixlen2mask(struct in_addr *maskp, int plen)
{
struct sockaddr *
rt_plen2mask(struct rtentry *rt, struct sockaddr_in6 *sa_mask)
{
-#ifndef ART
- return (rt_mask(rt));
-#else
return (rt_plentosa(rt_key(rt)->sa_family, rt_plen(rt), sa_mask));
-#endif /* ART */
}