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)) ? " ": "");
}
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);
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));
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));
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);
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",
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)))
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;
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);
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,
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) {
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);
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);
}
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);
#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;
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]), \