mirror of
https://github.com/systemd/systemd.git
synced 2025-01-26 14:04:03 +03:00
sd-icmp6-nd: fix namespacing
Prefix all exported constants by SD_ICMP6_ND_* to avoid any namespacing conflicts.
This commit is contained in:
parent
10c9ce615d
commit
575ac4c62e
@ -394,8 +394,8 @@ void serialize_in6_addrs(FILE *f, const struct in6_addr *addresses,
|
||||
assert(size);
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
fprintf(f, SD_ICMP6_ADDRESS_FORMAT_STR"%s",
|
||||
SD_ICMP6_ADDRESS_FORMAT_VAL(addresses[i]),
|
||||
fprintf(f, SD_ICMP6_ND_ADDRESS_FORMAT_STR"%s",
|
||||
SD_ICMP6_ND_ADDRESS_FORMAT_VAL(addresses[i]),
|
||||
(i < (size - 1)) ? " ": "");
|
||||
}
|
||||
|
||||
|
@ -274,15 +274,15 @@ static int icmp6_ra_prefix_timeout(sd_event_source *s, uint64_t usec,
|
||||
if (prefix->timeout_valid != s)
|
||||
continue;
|
||||
|
||||
log_icmp6_nd(nd, "Prefix expired "SD_ICMP6_ADDRESS_FORMAT_STR"/%d",
|
||||
SD_ICMP6_ADDRESS_FORMAT_VAL(prefix->addr),
|
||||
log_icmp6_nd(nd, "Prefix expired "SD_ICMP6_ND_ADDRESS_FORMAT_STR"/%d",
|
||||
SD_ICMP6_ND_ADDRESS_FORMAT_VAL(prefix->addr),
|
||||
prefix->len);
|
||||
|
||||
LIST_REMOVE(prefixes, nd->prefixes, prefix);
|
||||
|
||||
nd->expired_prefix = prefix;
|
||||
icmp6_nd_notify(nd,
|
||||
ICMP6_EVENT_ROUTER_ADVERTISMENT_PREFIX_EXPIRED);
|
||||
SD_ICMP6_ND_EVENT_ROUTER_ADVERTISMENT_PREFIX_EXPIRED);
|
||||
nd->expired_prefix = NULL;
|
||||
|
||||
prefix = icmp6_prefix_unref(prefix);
|
||||
@ -441,8 +441,8 @@ static int icmp6_ra_prefix_update(sd_icmp6_nd *nd, ssize_t len,
|
||||
memcpy(&prefix->addr, &prefix_opt->nd_opt_pi_prefix,
|
||||
sizeof(prefix->addr));
|
||||
|
||||
log_icmp6_nd(nd, "New prefix "SD_ICMP6_ADDRESS_FORMAT_STR"/%d lifetime %d expires in %s",
|
||||
SD_ICMP6_ADDRESS_FORMAT_VAL(prefix->addr),
|
||||
log_icmp6_nd(nd, "New prefix "SD_ICMP6_ND_ADDRESS_FORMAT_STR"/%d lifetime %d expires in %s",
|
||||
SD_ICMP6_ND_ADDRESS_FORMAT_VAL(prefix->addr),
|
||||
prefix->len, lifetime,
|
||||
format_timespan(time_string, FORMAT_TIMESPAN_MAX,
|
||||
lifetime * USEC_PER_SEC, 0));
|
||||
@ -463,8 +463,8 @@ static int icmp6_ra_prefix_update(sd_icmp6_nd *nd, ssize_t len,
|
||||
prefix->len = prefixlen;
|
||||
}
|
||||
|
||||
log_icmp6_nd(nd, "Update prefix "SD_ICMP6_ADDRESS_FORMAT_STR"/%d lifetime %d expires in %s",
|
||||
SD_ICMP6_ADDRESS_FORMAT_VAL(prefix->addr),
|
||||
log_icmp6_nd(nd, "Update prefix "SD_ICMP6_ND_ADDRESS_FORMAT_STR"/%d lifetime %d expires in %s",
|
||||
SD_ICMP6_ND_ADDRESS_FORMAT_VAL(prefix->addr),
|
||||
prefix->len, lifetime,
|
||||
format_timespan(time_string, FORMAT_TIMESPAN_MAX,
|
||||
lifetime * USEC_PER_SEC, 0));
|
||||
@ -541,7 +541,7 @@ static int icmp6_router_advertisment_recv(sd_event_source *s, int fd, uint32_t r
|
||||
int r, buflen = 0;
|
||||
ssize_t len;
|
||||
_cleanup_free_ struct nd_router_advert *ra = NULL;
|
||||
int event = ICMP6_EVENT_ROUTER_ADVERTISMENT_NONE;
|
||||
int event = SD_ICMP6_ND_EVENT_ROUTER_ADVERTISMENT_NONE;
|
||||
|
||||
assert(s);
|
||||
assert(nd);
|
||||
@ -572,16 +572,16 @@ static int icmp6_router_advertisment_recv(sd_event_source *s, int fd, uint32_t r
|
||||
nd->state = ICMP6_ROUTER_ADVERTISMENT_LISTEN;
|
||||
|
||||
if (ra->nd_ra_flags_reserved & ND_RA_FLAG_OTHER )
|
||||
event = ICMP6_EVENT_ROUTER_ADVERTISMENT_OTHER;
|
||||
event = SD_ICMP6_ND_EVENT_ROUTER_ADVERTISMENT_OTHER;
|
||||
|
||||
if (ra->nd_ra_flags_reserved & ND_RA_FLAG_MANAGED)
|
||||
event = ICMP6_EVENT_ROUTER_ADVERTISMENT_MANAGED;
|
||||
event = SD_ICMP6_ND_EVENT_ROUTER_ADVERTISMENT_MANAGED;
|
||||
|
||||
log_icmp6_nd(nd, "Received Router Advertisement flags %s/%s",
|
||||
ra->nd_ra_flags_reserved & ND_RA_FLAG_MANAGED? "MANAGED": "none",
|
||||
ra->nd_ra_flags_reserved & ND_RA_FLAG_OTHER? "OTHER": "none");
|
||||
|
||||
if (event != ICMP6_EVENT_ROUTER_ADVERTISMENT_NONE) {
|
||||
if (event != SD_ICMP6_ND_EVENT_ROUTER_ADVERTISMENT_NONE) {
|
||||
r = icmp6_ra_parse(nd, ra, len);
|
||||
if (r < 0) {
|
||||
log_icmp6_nd(nd, "Could not parse Router Advertisement: %s",
|
||||
@ -609,7 +609,7 @@ static int icmp6_router_solicitation_timeout(sd_event_source *s, uint64_t usec,
|
||||
nd->timeout = sd_event_source_unref(nd->timeout);
|
||||
|
||||
if (nd->nd_sent >= ICMP6_MAX_ROUTER_SOLICITATIONS) {
|
||||
icmp6_nd_notify(nd, ICMP6_EVENT_ROUTER_ADVERTISMENT_TIMEOUT);
|
||||
icmp6_nd_notify(nd, SD_ICMP6_ND_EVENT_ROUTER_ADVERTISMENT_TIMEOUT);
|
||||
nd->state = ICMP6_ROUTER_ADVERTISMENT_LISTEN;
|
||||
} else {
|
||||
if (memcmp(&nd->mac_addr, &unset, sizeof(struct ether_addr)))
|
||||
|
@ -277,9 +277,9 @@ static void test_rs_done(sd_icmp6_nd *nd, int event, void *userdata) {
|
||||
uint8_t flag;
|
||||
int event;
|
||||
} flag_event[] = {
|
||||
{ 0, ICMP6_EVENT_ROUTER_ADVERTISMENT_NONE },
|
||||
{ ND_RA_FLAG_OTHER, ICMP6_EVENT_ROUTER_ADVERTISMENT_OTHER },
|
||||
{ ND_RA_FLAG_MANAGED, ICMP6_EVENT_ROUTER_ADVERTISMENT_MANAGED }
|
||||
{ 0, SD_ICMP6_ND_EVENT_ROUTER_ADVERTISMENT_NONE },
|
||||
{ ND_RA_FLAG_OTHER, SD_ICMP6_ND_EVENT_ROUTER_ADVERTISMENT_OTHER },
|
||||
{ ND_RA_FLAG_MANAGED, SD_ICMP6_ND_EVENT_ROUTER_ADVERTISMENT_MANAGED }
|
||||
};
|
||||
uint32_t mtu;
|
||||
|
||||
|
@ -84,8 +84,8 @@ static int dhcp6_address_update(Link *link, struct in6_addr *ip6_addr,
|
||||
addr->cinfo.ifa_valid = lifetime_valid;
|
||||
|
||||
log_link_info(link,
|
||||
"DHCPv6 address "SD_ICMP6_ADDRESS_FORMAT_STR"/%d timeout preferred %d valid %d",
|
||||
SD_ICMP6_ADDRESS_FORMAT_VAL(addr->in_addr.in6),
|
||||
"DHCPv6 address "SD_ICMP6_ND_ADDRESS_FORMAT_STR"/%d timeout preferred %d valid %d",
|
||||
SD_ICMP6_ND_ADDRESS_FORMAT_VAL(addr->in_addr.in6),
|
||||
addr->prefixlen, lifetime_preferred, lifetime_valid);
|
||||
|
||||
r = address_update(addr, link, dhcp6_address_handler);
|
||||
@ -185,7 +185,7 @@ static int dhcp6_configure(Link *link, int event) {
|
||||
assert_return(link, -EINVAL);
|
||||
|
||||
if (link->dhcp6_client) {
|
||||
if (event != ICMP6_EVENT_ROUTER_ADVERTISMENT_MANAGED)
|
||||
if (event != SD_ICMP6_ND_EVENT_ROUTER_ADVERTISMENT_MANAGED)
|
||||
return 0;
|
||||
|
||||
r = sd_dhcp6_client_get_information_request(link->dhcp6_client,
|
||||
@ -254,7 +254,7 @@ static int dhcp6_configure(Link *link, int event) {
|
||||
return r;
|
||||
}
|
||||
|
||||
if (event == ICMP6_EVENT_ROUTER_ADVERTISMENT_OTHER) {
|
||||
if (event == SD_ICMP6_ND_EVENT_ROUTER_ADVERTISMENT_OTHER) {
|
||||
r = sd_dhcp6_client_set_information_request(link->dhcp6_client,
|
||||
true);
|
||||
if (r < 0) {
|
||||
@ -287,8 +287,8 @@ static int dhcp6_prefix_expired(Link *link) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
log_link_info(link, "IPv6 prefix "SD_ICMP6_ADDRESS_FORMAT_STR"/%d expired",
|
||||
SD_ICMP6_ADDRESS_FORMAT_VAL(*expired_prefix),
|
||||
log_link_info(link, "IPv6 prefix "SD_ICMP6_ND_ADDRESS_FORMAT_STR"/%d expired",
|
||||
SD_ICMP6_ND_ADDRESS_FORMAT_VAL(*expired_prefix),
|
||||
expired_prefixlen);
|
||||
|
||||
sd_dhcp6_lease_reset_address_iter(lease);
|
||||
@ -302,7 +302,7 @@ static int dhcp6_prefix_expired(Link *link) {
|
||||
if (r < 0)
|
||||
continue;
|
||||
|
||||
log_link_info(link, "IPv6 prefix length updated "SD_ICMP6_ADDRESS_FORMAT_STR"/%d", SD_ICMP6_ADDRESS_FORMAT_VAL(ip6_addr), 128);
|
||||
log_link_info(link, "IPv6 prefix length updated "SD_ICMP6_ND_ADDRESS_FORMAT_STR"/%d", SD_ICMP6_ND_ADDRESS_FORMAT_VAL(ip6_addr), 128);
|
||||
|
||||
dhcp6_address_update(link, &ip6_addr, 128, lifetime_preferred, lifetime_valid);
|
||||
}
|
||||
@ -321,17 +321,17 @@ static void icmp6_router_handler(sd_icmp6_nd *nd, int event, void *userdata) {
|
||||
return;
|
||||
|
||||
switch(event) {
|
||||
case ICMP6_EVENT_ROUTER_ADVERTISMENT_NONE:
|
||||
case SD_ICMP6_ND_EVENT_ROUTER_ADVERTISMENT_NONE:
|
||||
return;
|
||||
|
||||
case ICMP6_EVENT_ROUTER_ADVERTISMENT_TIMEOUT:
|
||||
case ICMP6_EVENT_ROUTER_ADVERTISMENT_OTHER:
|
||||
case ICMP6_EVENT_ROUTER_ADVERTISMENT_MANAGED:
|
||||
case SD_ICMP6_ND_EVENT_ROUTER_ADVERTISMENT_TIMEOUT:
|
||||
case SD_ICMP6_ND_EVENT_ROUTER_ADVERTISMENT_OTHER:
|
||||
case SD_ICMP6_ND_EVENT_ROUTER_ADVERTISMENT_MANAGED:
|
||||
dhcp6_configure(link, event);
|
||||
|
||||
break;
|
||||
|
||||
case ICMP6_EVENT_ROUTER_ADVERTISMENT_PREFIX_EXPIRED:
|
||||
case SD_ICMP6_ND_EVENT_ROUTER_ADVERTISMENT_PREFIX_EXPIRED:
|
||||
if (!link->rtnl_extended_attrs)
|
||||
dhcp6_prefix_expired(link);
|
||||
|
||||
|
@ -27,11 +27,11 @@
|
||||
#include "sd-event.h"
|
||||
|
||||
enum {
|
||||
ICMP6_EVENT_ROUTER_ADVERTISMENT_NONE = 0,
|
||||
ICMP6_EVENT_ROUTER_ADVERTISMENT_TIMEOUT = 1,
|
||||
ICMP6_EVENT_ROUTER_ADVERTISMENT_OTHER = 2,
|
||||
ICMP6_EVENT_ROUTER_ADVERTISMENT_MANAGED = 3,
|
||||
ICMP6_EVENT_ROUTER_ADVERTISMENT_PREFIX_EXPIRED = 4,
|
||||
SD_ICMP6_ND_EVENT_ROUTER_ADVERTISMENT_NONE = 0,
|
||||
SD_ICMP6_ND_EVENT_ROUTER_ADVERTISMENT_TIMEOUT = 1,
|
||||
SD_ICMP6_ND_EVENT_ROUTER_ADVERTISMENT_OTHER = 2,
|
||||
SD_ICMP6_ND_EVENT_ROUTER_ADVERTISMENT_MANAGED = 3,
|
||||
SD_ICMP6_ND_EVENT_ROUTER_ADVERTISMENT_PREFIX_EXPIRED = 4,
|
||||
};
|
||||
|
||||
typedef struct sd_icmp6_nd sd_icmp6_nd;
|
||||
@ -64,9 +64,9 @@ int sd_icmp6_ra_get_expired_prefix(sd_icmp6_nd *nd, struct in6_addr **addr,
|
||||
int sd_icmp6_nd_stop(sd_icmp6_nd *nd);
|
||||
int sd_icmp6_router_solicitation_start(sd_icmp6_nd *nd);
|
||||
|
||||
#define SD_ICMP6_ADDRESS_FORMAT_STR "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x"
|
||||
#define SD_ICMP6_ND_ADDRESS_FORMAT_STR "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x"
|
||||
|
||||
#define SD_ICMP6_ADDRESS_FORMAT_VAL(address) \
|
||||
#define SD_ICMP6_ND_ADDRESS_FORMAT_VAL(address) \
|
||||
be16toh((address).s6_addr16[0]), \
|
||||
be16toh((address).s6_addr16[1]), \
|
||||
be16toh((address).s6_addr16[2]), \
|
||||
|
Loading…
x
Reference in New Issue
Block a user