+#ifdef FD_CLOEXEC
+ fcntl(device_fd, F_SETFD, FD_CLOEXEC);
+#endif
+
+ // Guess what the corresponding interface is called
+
+ char *realname;
+
+#if defined(HAVE_FDEVNAME)
+ realname = fdevname(device_fd) ? : device;
+#elif defined(HAVE_DEVNAME)
+ struct stat buf;
+ if(!fstat(device_fd, &buf))
+ realname = devname(buf.st_rdev, S_IFCHR) ? : device;
+#else
+ realname = device;
+#endif
+
+ if(!get_config_string(lookup_config(config_tree, "Interface"), &iface))
+ iface = xstrdup(strrchr(realname, '/') ? strrchr(realname, '/') + 1 : realname);
+ else if(strcmp(iface, strrchr(realname, '/') ? strrchr(realname, '/') + 1 : realname))
+ logger(DEBUG_ALWAYS, LOG_WARNING, "Warning: Interface does not match Device. $INTERFACE might be set incorrectly.");
+
+ // Configure the device as best as we can
+