mirror of
https://github.com/systemd/systemd.git
synced 2024-12-25 01:34:28 +03:00
network: introduce radv_update_mac()
This commit is contained in:
parent
eebba6dc24
commit
be9363ccab
@ -3047,25 +3047,9 @@ int link_update(Link *link, sd_netlink_message *m) {
|
||||
if (r < 0)
|
||||
return log_link_warning_errno(link, r, "Could not update MAC address in DHCPv6 client: %m");
|
||||
|
||||
if (link->radv) {
|
||||
bool restart = sd_radv_is_running(link->radv);
|
||||
|
||||
if (restart) {
|
||||
r = sd_radv_stop(link->radv);
|
||||
if (r < 0)
|
||||
return log_link_warning_errno(link, r, "Could not stop Router Advertisement: %m");
|
||||
}
|
||||
|
||||
r = sd_radv_set_mac(link->radv, &link->mac);
|
||||
if (r < 0)
|
||||
return log_link_warning_errno(link, r, "Could not update MAC for Router Advertisement: %m");
|
||||
|
||||
if (restart) {
|
||||
r = sd_radv_start(link->radv);
|
||||
if (r < 0)
|
||||
return log_link_warning_errno(link, r, "Could not restart Router Advertisement: %m");
|
||||
}
|
||||
}
|
||||
r = dhcp6_update_mac(link);
|
||||
if (r < 0)
|
||||
return log_link_warning_errno(link, r, "Could not update MAC address for Router Advertisement: %m");
|
||||
|
||||
if (link->ndisc) {
|
||||
r = sd_ndisc_set_mac(link->ndisc, &link->mac);
|
||||
|
@ -686,6 +686,36 @@ int radv_configure(Link *link) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int radv_update_mac(Link *link) {
|
||||
bool restart;
|
||||
int r;
|
||||
|
||||
assert(link);
|
||||
|
||||
if (!link->radv)
|
||||
return 0;
|
||||
|
||||
restart = sd_radv_is_running(link->radv);
|
||||
|
||||
if (restart) {
|
||||
r = sd_radv_stop(link->radv);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
r = sd_radv_set_mac(link->radv, &link->mac);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (restart) {
|
||||
r = sd_radv_start(link->radv);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int radv_add_prefix(
|
||||
Link *link,
|
||||
const struct in6_addr *prefix,
|
||||
|
@ -50,6 +50,7 @@ void network_verify_route_prefixes(Network *network);
|
||||
|
||||
int radv_emit_dns(Link *link);
|
||||
int radv_configure(Link *link);
|
||||
int radv_update_mac(Link *link);
|
||||
int radv_add_prefix(Link *link, const struct in6_addr *prefix, uint8_t prefix_len,
|
||||
uint32_t lifetime_preferred, uint32_t lifetime_valid);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user