+static FILE *natfp; /* File handle for NAT table */
+static int randfd; /* File descriptor for random data */
+
+/*----- Miscellaneous system services -------------------------------------*/
+
+/* Fill the buffer at P with SZ random bytes. The buffer will be moderately
+ * large: this is intended to be a low-level interface, not a general-purpose
+ * utility.
+ */
+void fill_random(void *p, size_t sz)
+{
+ ssize_t n;
+
+ n = read(randfd, p, sz);
+ if (n < 0) fatal("error reading `/dev/urandom': %s", strerror(errno));
+ else if (n < sz) fatal("unexpected short read from `/dev/urandom'");
+}