mirror of
https://github.com/systemd/systemd
synced 2026-03-19 03:24:45 +01:00
Compare commits
No commits in common. "798d7d0a8afd08be7a6d03c51905abc326e453b8" and "ad64e3e8d649949a33be6daae6e9821e694b37c2" have entirely different histories.
798d7d0a8a
...
ad64e3e8d6
@ -1098,8 +1098,8 @@ IPv6Token=prefixstable:2002:da8:1::</programlisting></para>
|
|||||||
<listitem>
|
<listitem>
|
||||||
<para>Takes one of <literal>ipv4</literal>, <literal>ipv6</literal>,
|
<para>Takes one of <literal>ipv4</literal>, <literal>ipv6</literal>,
|
||||||
<literal>both</literal>, <literal>none</literal>. When <literal>ipv4</literal>,
|
<literal>both</literal>, <literal>none</literal>. When <literal>ipv4</literal>,
|
||||||
performs IPv4 Address Conflict Detection. See
|
performs IPv4 Duplicate Address Detection. See
|
||||||
<ulink url="https://tools.ietf.org/html/rfc5227">RFC 5227</ulink>.
|
<ulink url="https://tools.ietf.org/html/rfc5227">RFC 5224</ulink>.
|
||||||
When <literal>ipv6</literal>, performs IPv6 Duplicate Address Detection. See
|
When <literal>ipv6</literal>, performs IPv6 Duplicate Address Detection. See
|
||||||
<ulink url="https://tools.ietf.org/html/rfc4862">RFC 4862</ulink>.
|
<ulink url="https://tools.ietf.org/html/rfc4862">RFC 4862</ulink>.
|
||||||
Defaults to <literal>ipv6</literal>.</para>
|
Defaults to <literal>ipv6</literal>.</para>
|
||||||
|
|||||||
@ -107,7 +107,7 @@ int device_set_devmode(sd_device *device, const char *devmode);
|
|||||||
int device_set_devname(sd_device *device, const char *devname);
|
int device_set_devname(sd_device *device, const char *devname);
|
||||||
int device_set_devtype(sd_device *device, const char *devtype);
|
int device_set_devtype(sd_device *device, const char *devtype);
|
||||||
int device_set_devnum(sd_device *device, const char *major, const char *minor);
|
int device_set_devnum(sd_device *device, const char *major, const char *minor);
|
||||||
int device_set_subsystem(sd_device *device, const char *subsystem);
|
int device_set_subsystem(sd_device *device, const char *_subsystem);
|
||||||
int device_set_drivers_subsystem(sd_device *device);
|
int device_set_drivers_subsystem(sd_device *device);
|
||||||
int device_set_driver(sd_device *device, const char *driver);
|
int device_set_driver(sd_device *device, const char *_driver);
|
||||||
int device_set_usec_initialized(sd_device *device, usec_t when);
|
int device_set_usec_initialized(sd_device *device, usec_t when);
|
||||||
|
|||||||
@ -765,15 +765,18 @@ int device_shallow_clone(sd_device *old_device, sd_device **new_device) {
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
(void) sd_device_get_subsystem(old_device, &val);
|
if (sd_device_get_subsystem(old_device, &val) >= 0) {
|
||||||
r = device_set_subsystem(ret, val);
|
r = device_set_subsystem(ret, val);
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
if (streq_ptr(val, "drivers")) {
|
|
||||||
r = free_and_strdup(&ret->driver_subsystem, old_device->driver_subsystem);
|
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
}
|
|
||||||
|
if (streq(val, "drivers")) {
|
||||||
|
ret->driver_subsystem = strdup(old_device->driver_subsystem);
|
||||||
|
if (!ret->driver_subsystem)
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
ret->subsystem_set = true;
|
||||||
|
|
||||||
/* The device may be already removed. Let's copy minimal set of information to make
|
/* The device may be already removed. Let's copy minimal set of information to make
|
||||||
* device_get_device_id() work without uevent file. */
|
* device_get_device_id() work without uevent file. */
|
||||||
|
|||||||
@ -779,24 +779,23 @@ _public_ int sd_device_get_parent(sd_device *child, sd_device **ret) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int device_set_subsystem(sd_device *device, const char *subsystem) {
|
int device_set_subsystem(sd_device *device, const char *_subsystem) {
|
||||||
_cleanup_free_ char *s = NULL;
|
_cleanup_free_ char *subsystem = NULL;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(device);
|
assert(device);
|
||||||
|
assert(_subsystem);
|
||||||
|
|
||||||
if (subsystem) {
|
subsystem = strdup(_subsystem);
|
||||||
s = strdup(subsystem);
|
if (!subsystem)
|
||||||
if (!s)
|
return -ENOMEM;
|
||||||
return -ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
r = device_add_property_internal(device, "SUBSYSTEM", s);
|
r = device_add_property_internal(device, "SUBSYSTEM", subsystem);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
device->subsystem_set = true;
|
device->subsystem_set = true;
|
||||||
return free_and_replace(device->subsystem, s);
|
return free_and_replace(device->subsystem, subsystem);
|
||||||
}
|
}
|
||||||
|
|
||||||
int device_set_drivers_subsystem(sd_device *device) {
|
int device_set_drivers_subsystem(sd_device *device) {
|
||||||
@ -957,24 +956,23 @@ _public_ int sd_device_get_devnum(sd_device *device, dev_t *devnum) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int device_set_driver(sd_device *device, const char *driver) {
|
int device_set_driver(sd_device *device, const char *_driver) {
|
||||||
_cleanup_free_ char *d = NULL;
|
_cleanup_free_ char *driver = NULL;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(device);
|
assert(device);
|
||||||
|
assert(_driver);
|
||||||
|
|
||||||
if (driver) {
|
driver = strdup(_driver);
|
||||||
d = strdup(driver);
|
if (!driver)
|
||||||
if (!d)
|
return -ENOMEM;
|
||||||
return -ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
r = device_add_property_internal(device, "DRIVER", d);
|
r = device_add_property_internal(device, "DRIVER", driver);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
device->driver_set = true;
|
device->driver_set = true;
|
||||||
return free_and_replace(device->driver, d);
|
return free_and_replace(device->driver, driver);
|
||||||
}
|
}
|
||||||
|
|
||||||
_public_ int sd_device_get_driver(sd_device *device, const char **ret) {
|
_public_ int sd_device_get_driver(sd_device *device, const char **ret) {
|
||||||
@ -992,14 +990,14 @@ _public_ int sd_device_get_driver(sd_device *device, const char **ret) {
|
|||||||
|
|
||||||
path = strjoina(syspath, "/driver");
|
path = strjoina(syspath, "/driver");
|
||||||
r = readlink_value(path, &driver);
|
r = readlink_value(path, &driver);
|
||||||
if (r < 0 && r != -ENOENT)
|
if (r >= 0) {
|
||||||
return log_device_debug_errno(device, r,
|
r = device_set_driver(device, driver);
|
||||||
"sd-device: readlink(\"%s\") failed: %m", path);
|
if (r < 0)
|
||||||
|
return log_device_debug_errno(device, r, "sd-device: Failed to set driver for %s: %m", device->devpath);
|
||||||
r = device_set_driver(device, driver);
|
} else if (r == -ENOENT)
|
||||||
if (r < 0)
|
device->driver_set = true;
|
||||||
return log_device_debug_errno(device, r,
|
else
|
||||||
"sd-device: Failed to set driver \"%s\": %m", driver);
|
return log_device_debug_errno(device, r, "sd-device: Failed to set driver for %s: %m", device->devpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!device->driver)
|
if (!device->driver)
|
||||||
|
|||||||
@ -2111,17 +2111,9 @@ static int address_section_verify(Address *address) {
|
|||||||
address->scope = RT_SCOPE_HOST;
|
address->scope = RT_SCOPE_HOST;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (address->family == AF_INET6 &&
|
if (!FLAGS_SET(address->duplicate_address_detection, ADDRESS_FAMILY_IPV6))
|
||||||
!FLAGS_SET(address->duplicate_address_detection, ADDRESS_FAMILY_IPV6))
|
|
||||||
address->flags |= IFA_F_NODAD;
|
address->flags |= IFA_F_NODAD;
|
||||||
|
|
||||||
if (address->family == AF_INET && in4_addr_is_link_local(&address->in_addr.in) &&
|
|
||||||
!FLAGS_SET(address->duplicate_address_detection, ADDRESS_FAMILY_IPV4)) {
|
|
||||||
log_debug("%s: An IPv4 link-local address is specified, enabling IPv4 Address Conflict Detection (ACD).",
|
|
||||||
address->section->filename);
|
|
||||||
address->duplicate_address_detection |= ADDRESS_FAMILY_IPV4;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user