/* dump cfg_nat trees: ktrees <nat_addr> */
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdint.h>
int main(int argc, char **argv)
{
	uint64_t nat = strtoull(argv[1], NULL, 16);
	int fd = open("/dev/kmem", O_RDONLY);
	uint64_t v;
	uint64_t offs[] = {16, 24, 32};
	const char *n[] = {"rb_tcp_out", "rb_udp_out", "rb_icmp_out"};
	int i;
	for (i = 0; i < 3; i++) {
		if (pread(fd, &v, 8, (off_t)(nat + offs[i])) != 8) v = 0xBAD;
		printf("%s root = 0x%016llx\n", n[i], (unsigned long long)v);
	}
	return 0;
}
