mirror of
https://github.com/systemd/systemd.git
synced 2025-01-12 13:18:14 +03:00
network: introduce callback called when an address becomes ready
This commit is contained in:
parent
c9d223e803
commit
97f000744f
@ -359,15 +359,21 @@ int address_update(
|
|||||||
link_update_operstate(address->link, true);
|
link_update_operstate(address->link, true);
|
||||||
link_check_ready(address->link);
|
link_check_ready(address->link);
|
||||||
|
|
||||||
if (!ready &&
|
if (!ready && address_is_ready(address)) {
|
||||||
address_is_ready(address) &&
|
if (address->callback) {
|
||||||
address->family == AF_INET6 &&
|
r = address->callback(address);
|
||||||
in_addr_is_link_local(AF_INET6, &address->in_addr) > 0 &&
|
if (r < 0)
|
||||||
in_addr_is_null(AF_INET6, (const union in_addr_union*) &address->link->ipv6ll_address) > 0) {
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
r = link_ipv6ll_gained(address->link, &address->in_addr.in6);
|
if (address->family == AF_INET6 &&
|
||||||
if (r < 0)
|
in_addr_is_link_local(AF_INET6, &address->in_addr) > 0 &&
|
||||||
return r;
|
IN6_IS_ADDR_UNSPECIFIED(&address->link->ipv6ll_address) > 0) {
|
||||||
|
|
||||||
|
r = link_ipv6ll_gained(address->link, &address->in_addr.in6);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -20,6 +20,7 @@ typedef struct Address Address;
|
|||||||
typedef struct Network Network;
|
typedef struct Network Network;
|
||||||
typedef struct Link Link;
|
typedef struct Link Link;
|
||||||
typedef struct NetworkConfigSection NetworkConfigSection;
|
typedef struct NetworkConfigSection NetworkConfigSection;
|
||||||
|
typedef int (*address_ready_callback_t)(Address *address);
|
||||||
|
|
||||||
struct Address {
|
struct Address {
|
||||||
Network *network;
|
Network *network;
|
||||||
@ -47,6 +48,9 @@ struct Address {
|
|||||||
bool autojoin:1;
|
bool autojoin:1;
|
||||||
AddressFamily duplicate_address_detection;
|
AddressFamily duplicate_address_detection;
|
||||||
|
|
||||||
|
/* Called when address become ready */
|
||||||
|
address_ready_callback_t callback;
|
||||||
|
|
||||||
sd_ipv4acd *acd;
|
sd_ipv4acd *acd;
|
||||||
|
|
||||||
LIST_FIELDS(Address, addresses);
|
LIST_FIELDS(Address, addresses);
|
||||||
|
Loading…
Reference in New Issue
Block a user