diff options
author | Patrik Flykt <patrik.flykt@linux.intel.com> | 2015-01-20 19:36:01 +0200 |
---|---|---|
committer | Patrik Flykt <patrik.flykt@linux.intel.com> | 2015-01-27 09:35:24 +0200 |
commit | d77bde34cfcf91246a075fd47919294894bf6f8a (patch) | |
tree | c91088873f965392e2404335e97661c305fe1e0f /src/systemd | |
parent | 8d7f2c6a47db4bdb753b9d523d3bcb1105827991 (diff) |
sd-icmp6-nd: Parse ICMPv6 prefix information
Save each new onlink IPv6 prefix and attach an expiry timer to it.
If the prefixes overlap, take the shorter prefix and write a debug
message about the event. Once the prefix is resent in a Router
Advertisement, update the timer. Add a new event for the expiring
prefix.
Add two helper functions, one for returning a prefix length given a
Router Advertisement and the other for generic prefix matching given
an IPv6 prefix and address.
Diffstat (limited to 'src/systemd')
-rw-r--r-- | src/systemd/sd-icmp6-nd.h | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/src/systemd/sd-icmp6-nd.h b/src/systemd/sd-icmp6-nd.h index 73ebccfed..86cf25aa2 100644 --- a/src/systemd/sd-icmp6-nd.h +++ b/src/systemd/sd-icmp6-nd.h @@ -27,10 +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_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, }; typedef struct sd_icmp6_nd sd_icmp6_nd; @@ -51,9 +52,26 @@ sd_icmp6_nd *sd_icmp6_nd_ref(sd_icmp6_nd *nd); sd_icmp6_nd *sd_icmp6_nd_unref(sd_icmp6_nd *nd); int sd_icmp6_nd_new(sd_icmp6_nd **ret); +int sd_icmp6_prefix_match(struct in6_addr *prefix, uint8_t prefixlen, + struct in6_addr *addr); + int sd_icmp6_ra_get_mtu(sd_icmp6_nd *nd, uint32_t *mtu); +int sd_icmp6_ra_get_prefixlen(sd_icmp6_nd *nd, const struct in6_addr *addr, + uint8_t *prefixlen); 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_ADDRESS_FORMAT_VAL(address) \ + be16toh((address).s6_addr16[0]), \ + be16toh((address).s6_addr16[1]), \ + be16toh((address).s6_addr16[2]), \ + be16toh((address).s6_addr16[3]), \ + be16toh((address).s6_addr16[4]), \ + be16toh((address).s6_addr16[5]), \ + be16toh((address).s6_addr16[6]), \ + be16toh((address).s6_addr16[7]) + #endif |