approach and remove the old and create a new one.
This simple change allows the the allow/deny rules to be followed.
subsystem = udev_device_get_subsystem(device);
ifname = udev_device_get_sysname(device);
action = udev_device_get_action(device);
- udev_device_unref(device);
/* udev filter documentation says "usually" so double check */
if (strcmp(subsystem, "net") == 0) {
- if (strcmp(action, "add") == 0)
+ syslog(LOG_DEBUG, "%s: libudev: %s", ifname, action);
+ if (strcmp(action, "add") == 0 || strcmp(action, "move") == 0)
handle_interface(1, ifname);
else if (strcmp(action, "remove") == 0)
handle_interface(-1, ifname);
}
+
+ udev_device_unref(device);
}
int
configure_interface1(ifp);
}
-int
-handle_rename(unsigned int ifindex, const char *ifname)
-{
- struct interface *ifp;
-
- TAILQ_FOREACH(ifp, ifaces, next) {
- if (ifp->index == ifindex && strcmp(ifp->name, ifname)) {
- syslog(LOG_INFO, "%s: renamed to %s",
- ifp->name, ifname);
- strlcpy(ifp->name, ifname, sizeof(ifp->name));
- return 1;
- }
- }
- return 0;
-}
-
void
handle_carrier(int carrier, int flags, const char *ifname)
{
int handle_args(struct fd_list *, int, char **);
void handle_carrier(int, int, const char *);
void handle_interface(int, const char *);
-int handle_rename(unsigned int, const char *);
void handle_hwaddr(const char *, const unsigned char *, size_t);
void drop_interface(struct interface *, const char *);
int select_profile(struct interface *, const char *);
}
}
+static int
+handle_rename(unsigned int ifindex, const char *ifname)
+{
+ struct interface *ifp;
+
+ TAILQ_FOREACH(ifp, ifaces, next) {
+ if (ifp->index == ifindex && strcmp(ifp->name, ifname)) {
+ handle_interface(-1, ifp->name);
+#ifdef LIBUDEV
+ /* Let udev announce the interface for renaming */
+ if (libudev_listening())
+ return 1;
+#endif
+ handle_interface(1, ifname);
+ return 1;
+ }
+ }
+ return 0;
+}
+
static int
link_netlink(struct nlmsghdr *nlm)
{