+#ifdef TUN_UNET
+
+struct tunnel {
+ const tunnel_ops *ops; /* Pointer to operations */
+ sel_file f; /* Selector for Usernet device */
+ struct peer *p; /* Pointer to my peer */
+};
+
+/* --- @t_ifname@ --- *
+ *
+ * Arguments: @tunnel *t@ = pointer to tunnel block
+ *
+ * Returns: A pointer to the tunnel's interface name.
+ */
+
+static const char *t_ifname(tunnel *t)
+{
+ static char b[UNET_NAMEMAX];
+ struct unet_info uni;
+ if (ioctl(t->f.fd, UNIOCGINFO, &uni)) {
+ a_warn("TUN - unet getinfo-error -- %s", strerror(errno));
+ return ("<error>");
+ }
+ if (strlen(uni.uni_ifname) + 1 > sizeof(b)) {
+ a_warn("TUN - unet ifname-too-long");
+ return ("<error>");
+ }
+ strcpy(b, uni.uni_ifname);
+ return (b);
+}