diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2020-09-29 18:33:25 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2020-10-06 19:44:42 +0200 |
commit | fe2bc17ca7bd42218b147a7781ecf7313090a18c (patch) | |
tree | 3174ad2462475486981f38d5aefbc3f5eaad9f10 /src/network/networkd-address-label.c | |
parent | network: introduce network_verify_address_labels() (diff) | |
download | systemd-fe2bc17ca7bd42218b147a7781ecf7313090a18c.tar.xz systemd-fe2bc17ca7bd42218b147a7781ecf7313090a18c.zip |
network: introduce link_set_address_labels()
Diffstat (limited to 'src/network/networkd-address-label.c')
-rw-r--r-- | src/network/networkd-address-label.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/src/network/networkd-address-label.c b/src/network/networkd-address-label.c index c25ac0ae1e..b48e997782 100644 --- a/src/network/networkd-address-label.c +++ b/src/network/networkd-address-label.c @@ -93,12 +93,7 @@ static int address_label_handler(sd_netlink *rtnl, sd_netlink_message *m, Link * return 1; } -int address_label_configure( - AddressLabel *label, - Link *link, - link_netlink_message_handler_t callback, - bool update) { - +static int address_label_configure(AddressLabel *label, Link *link) { _cleanup_(sd_netlink_message_unrefp) sd_netlink_message *req = NULL; int r; @@ -126,7 +121,7 @@ int address_label_configure( return log_link_error_errno(link, r, "Could not append IFA_ADDRESS attribute: %m"); r = netlink_call_async(link->manager->rtnl, NULL, req, - callback ?: address_label_handler, + address_label_handler, link_netlink_destroy_callback, link); if (r < 0) return log_link_error_errno(link, r, "Could not send rtnetlink message: %m"); @@ -136,6 +131,24 @@ int address_label_configure( return 0; } +int link_set_address_labels(Link *link) { + AddressLabel *label; + int r; + + assert(link); + assert(link->network); + + HASHMAP_FOREACH(label, link->network->address_labels_by_section) { + r = address_label_configure(label, link); + if (r < 0) + return log_link_warning_errno(link, r, "Could not set address label: %m"); + + link->address_label_messages++; + } + + return 0; +} + void network_verify_address_labels(Network *network) { AddressLabel *label; |