-int odhcpd_setup_route(const struct in6_addr *addr, const int prefixlen,
- const struct interface *iface, const struct in6_addr *gw,
- const uint32_t metric, const bool add)
-{
- struct nl_msg *msg;
- struct rtmsg rtm = {
- .rtm_family = AF_INET6,
- .rtm_dst_len = prefixlen,
- .rtm_src_len = 0,
- .rtm_table = RT_TABLE_MAIN,
- .rtm_protocol = (add ? RTPROT_STATIC : RTPROT_UNSPEC),
- .rtm_scope = (add ? (gw ? RT_SCOPE_UNIVERSE : RT_SCOPE_LINK) : RT_SCOPE_NOWHERE),
- .rtm_type = (add ? RTN_UNICAST : RTN_UNSPEC),
- };
- int ret = 0;
-
- msg = nlmsg_alloc_simple(add ? RTM_NEWROUTE : RTM_DELROUTE,
- add ? NLM_F_CREATE | NLM_F_REPLACE : 0);
- if (!msg)
- return -1;
-
- nlmsg_append(msg, &rtm, sizeof(rtm), 0);
-
- nla_put(msg, RTA_DST, sizeof(*addr), addr);
- nla_put_u32(msg, RTA_OIF, iface->ifindex);
- nla_put_u32(msg, RTA_PRIORITY, metric);
-
- if (gw)
- nla_put(msg, RTA_GATEWAY, sizeof(*gw), gw);
-
- ret = nl_send_auto_complete(rtnl_socket, msg);
- nlmsg_free(msg);
-
- if (ret < 0)
- return ret;
-
- return nl_wait_for_ack(rtnl_socket);
-}
-
-int odhcpd_setup_proxy_neigh(const struct in6_addr *addr,
- const struct interface *iface, const bool add)
+/*
+ * DNS address selection criteria order :
+ * - use IPv6 address with valid lifetime if none is yet selected
+ * - use IPv6 address with a preferred lifetime if the already selected IPv6 address is deprecated
+ * - use an IPv6 ULA address if the already selected IPv6 address is not an ULA address
+ * - use the IPv6 address with the longest preferred lifetime
+ */
+int odhcpd_get_interface_dns_addr(const struct interface *iface, struct in6_addr *addr)