mirror of
https://github.com/systemd/systemd.git
synced 2024-11-07 01:27:11 +03:00
networkd: rewind rtnl message between passing it to functions
This makes updating link status on netdev links work again.
This commit is contained in:
parent
689703f618
commit
208612034e
@ -1364,9 +1364,12 @@ int link_update(Link *link, sd_rtnl_message *m) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
r = sd_rtnl_message_read_ether_addr(m, IFLA_ADDRESS, &mac);
|
r = sd_rtnl_message_read_ether_addr(m, IFLA_ADDRESS, &mac);
|
||||||
if (r >= 0 && memcmp(&link->mac.ether_addr_octet, &mac.ether_addr_octet, ETH_ALEN)) {
|
if (r < 0)
|
||||||
|
log_debug_link(link, "Could not get MAC address: %s", strerror(-r));
|
||||||
|
else {
|
||||||
|
if (memcmp(link->mac.ether_addr_octet, mac.ether_addr_octet, ETH_ALEN)) {
|
||||||
|
|
||||||
memcpy(&link->mac.ether_addr_octet, &mac.ether_addr_octet, ETH_ALEN);
|
memcpy(link->mac.ether_addr_octet, mac.ether_addr_octet, ETH_ALEN);
|
||||||
|
|
||||||
log_debug_link(link, "MAC address: "
|
log_debug_link(link, "MAC address: "
|
||||||
"%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx",
|
"%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx",
|
||||||
@ -1397,6 +1400,7 @@ int link_update(Link *link, sd_rtnl_message *m) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
r = sd_rtnl_message_link_get_flags(m, &flags);
|
r = sd_rtnl_message_link_get_flags(m, &flags);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
|
@ -323,8 +323,14 @@ static int manager_rtnl_process_link(sd_rtnl *rtnl, sd_rtnl_message *message, vo
|
|||||||
NetDev *netdev;
|
NetDev *netdev;
|
||||||
|
|
||||||
r = netdev_get(m, name, &netdev);
|
r = netdev_get(m, name, &netdev);
|
||||||
if (r >= 0)
|
if (r >= 0) {
|
||||||
netdev_set_ifindex(netdev, message);
|
netdev_set_ifindex(netdev, message);
|
||||||
|
r = sd_rtnl_message_rewind(message);
|
||||||
|
if (r < 0) {
|
||||||
|
log_debug("could not rewind rtnl message");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
r = link_get(m, ifindex, &link);
|
r = link_get(m, ifindex, &link);
|
||||||
|
Loading…
Reference in New Issue
Block a user