summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
457c67e)
Renaming network devices might delay events for the other device, which has
the same devpath in the meantime as the original event. Causing a delay until
the timout of the event is reached.
Look at the ifindex/devnum of the devices to check if they are really
the same devices.
# libudev
# ------------------------------------------------------------------------------
LIBUDEV_CURRENT=9
# libudev
# ------------------------------------------------------------------------------
LIBUDEV_CURRENT=9
LIBUDEV_AGE=9
SUBDIRS += libudev/docs
LIBUDEV_AGE=9
SUBDIRS += libudev/docs
int devlink_priority;
int refcount;
dev_t devnum;
int devlink_priority;
int refcount;
dev_t devnum;
int watch_handle;
int maj, min;
bool parent_set;
int watch_handle;
int maj, min;
bool parent_set;
udev_device_set_seqnum(udev_device, strtoull(&property[7], NULL, 10));
} else if (strncmp(property, "TIMEOUT=", 8) == 0) {
udev_device_set_timeout(udev_device, strtoull(&property[8], NULL, 10));
udev_device_set_seqnum(udev_device, strtoull(&property[7], NULL, 10));
} else if (strncmp(property, "TIMEOUT=", 8) == 0) {
udev_device_set_timeout(udev_device, strtoull(&property[8], NULL, 10));
+ } else if (strncmp(property, "IFINDEX=", 8) == 0) {
+ udev_device_set_ifindex(udev_device, strtoull(&property[8], NULL, 10));
} else {
udev_device_add_property_from_string(udev_device, property);
}
} else {
udev_device_add_property_from_string(udev_device, property);
}
maj = strtoull(&line[6], NULL, 10);
else if (strncmp(line, "MINOR=", 6) == 0)
min = strtoull(&line[6], NULL, 10);
maj = strtoull(&line[6], NULL, 10);
else if (strncmp(line, "MINOR=", 6) == 0)
min = strtoull(&line[6], NULL, 10);
+ else if (strncmp(line, "IFINDEX=", 8) == 0)
+ udev_device_set_ifindex(udev_device, strtoull(&line[8], NULL, 10));
else if (strncmp(line, "DEVNAME=", 8) == 0)
udev_device_set_knodename(udev_device, &line[8]);
else if (strncmp(line, "DEVNAME=", 8) == 0)
udev_device_set_knodename(udev_device, &line[8]);
udev_device->watch_handle = handle;
return 0;
}
udev_device->watch_handle = handle;
return 0;
}
+
+int udev_device_get_ifindex(struct udev_device *udev_device)
+{
+ return udev_device->ifindex;
+}
+
+int udev_device_set_ifindex(struct udev_device *udev_device, int ifindex)
+{
+ udev_device->ifindex = ifindex;
+ return 0;
+}
int udev_device_set_devlink_priority(struct udev_device *udev_device, int prio);
int udev_device_get_watch_handle(struct udev_device *udev_device);
int udev_device_set_watch_handle(struct udev_device *udev_device, int handle);
int udev_device_set_devlink_priority(struct udev_device *udev_device, int prio);
int udev_device_get_watch_handle(struct udev_device *udev_device);
int udev_device_set_watch_handle(struct udev_device *udev_device, int handle);
+int udev_device_get_ifindex(struct udev_device *udev_device);
+int udev_device_set_ifindex(struct udev_device *udev_device, int ifindex);
void udev_device_set_info_loaded(struct udev_device *device);
/* libudev-device-private.c */
void udev_device_set_info_loaded(struct udev_device *device);
/* libudev-device-private.c */
const char *devpath_old;
dev_t devnum;
bool is_block;
const char *devpath_old;
dev_t devnum;
bool is_block;
};
static struct event *node_to_event(struct udev_list_node *node)
};
static struct event *node_to_event(struct udev_list_node *node)
event->devpath_old = udev_device_get_devpath_old(dev);
event->devnum = udev_device_get_devnum(dev);
event->is_block = (strcmp("block", udev_device_get_subsystem(dev)) == 0);
event->devpath_old = udev_device_get_devpath_old(dev);
event->devnum = udev_device_get_devnum(dev);
event->is_block = (strcmp("block", udev_device_get_subsystem(dev)) == 0);
+ event->ifindex = udev_device_get_ifindex(dev);
udev_queue_export_device_queued(udev_queue_export, dev);
info(event->udev, "seq %llu queued, '%s' '%s'\n", udev_device_get_seqnum(dev),
udev_queue_export_device_queued(udev_queue_export, dev);
info(event->udev, "seq %llu queued, '%s' '%s'\n", udev_device_get_seqnum(dev),
if (major(event->devnum) != 0 && event->devnum == loop_event->devnum && event->is_block == loop_event->is_block)
return true;
if (major(event->devnum) != 0 && event->devnum == loop_event->devnum && event->is_block == loop_event->is_block)
return true;
+ /* check network device ifindex */
+ if (event->ifindex != 0 && event->ifindex == loop_event->ifindex)
+ return true;
+
/* check our old name */
if (event->devpath_old != NULL && strcmp(loop_event->devpath, event->devpath_old) == 0) {
event->delaying_seqnum = loop_event->seqnum;
/* check our old name */
if (event->devpath_old != NULL && strcmp(loop_event->devpath, event->devpath_old) == 0) {
event->delaying_seqnum = loop_event->seqnum;
/* identical device event found */
if (loop_event->devpath_len == event->devpath_len) {
/* identical device event found */
if (loop_event->devpath_len == event->devpath_len) {
+ /* devices names might have changed/swapped in the meantime */
+ if (major(event->devnum) != 0 && (event->devnum != loop_event->devnum || event->is_block != loop_event->is_block))
+ continue;
+ if (event->ifindex != 0 && event->ifindex != loop_event->ifindex)
+ continue;
event->delaying_seqnum = loop_event->seqnum;
return true;
}
event->delaying_seqnum = loop_event->seqnum;
return true;
}