1 /** 2 * Copyright (C) 2013 Steven Barth <steven@midlink.org> 3 * Copyright (C) 2016 Hans Dedecker <dedeckeh@gmail.com> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License v2 as published by 7 * the Free Software Foundation. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 */ 15 16 #ifndef _DHCPV6_IA_H_ 17 #define _DHCPV6_IA_H_ 18 19 #define ADDR_ENTRY_VALID_IA_ADDR(iface, i, m, addrs) \ 20 ((iface)->dhcpv6_assignall || \ 21 (i) == (m) || \ 22 (addrs)[(i)].prefix > 64) 23 24 size_t get_preferred_addr(const struct odhcpd_ipaddr *addrs, const size_t addrlen); 25 26 struct in6_addr in6_from_prefix_and_iid(const struct odhcpd_ipaddr *prefix, uint64_t iid); 27 28 static inline bool valid_prefix_length(const struct dhcpv6_lease *a, const uint8_t prefix_length) 29 { 30 return a->length > prefix_length; 31 } 32 33 static inline bool valid_addr(const struct odhcpd_ipaddr *addr, time_t now) 34 { 35 return (addr->prefix <= 96 && addr->valid_lt > (uint32_t)now && addr->preferred_lt > (uint32_t)now); 36 } 37 38 #endif /* _DHCPV6_IA_H_ */ 39
This page was automatically generated by LXR 0.3.1. • OpenWrt