static int ip6_select_srcif_debug = 0;
SYSCTL_INT(_net_inet6_ip6, OID_AUTO, select_srcif_debug,
static int ip6_select_srcif_debug = 0;
SYSCTL_INT(_net_inet6_ip6, OID_AUTO, select_srcif_debug,
- CTLFLAG_RW | CTLFLAG_LOCKED, &ip6_select_srcif_debug, 0,
- "log source interface selection debug info");
+ CTLFLAG_RW | CTLFLAG_LOCKED, &ip6_select_srcif_debug, 0,
+ "log source interface selection debug info");
static int ip6_select_srcaddr_debug = 0;
SYSCTL_INT(_net_inet6_ip6, OID_AUTO, select_srcaddr_debug,
static int ip6_select_srcaddr_debug = 0;
SYSCTL_INT(_net_inet6_ip6, OID_AUTO, select_srcaddr_debug,
- CTLFLAG_RW | CTLFLAG_LOCKED, &ip6_select_srcaddr_debug, 0,
- "log source address selection debug info");
+ CTLFLAG_RW | CTLFLAG_LOCKED, &ip6_select_srcaddr_debug, 0,
+ "log source address selection debug info");
static int ip6_select_src_expensive_secondary_if = 0;
SYSCTL_INT(_net_inet6_ip6, OID_AUTO, select_src_expensive_secondary_if,
static int ip6_select_src_expensive_secondary_if = 0;
SYSCTL_INT(_net_inet6_ip6, OID_AUTO, select_src_expensive_secondary_if,
- CTLFLAG_RW | CTLFLAG_LOCKED, &ip6_select_src_expensive_secondary_if, 0,
- "allow source interface selection to use expensive secondaries");
+ CTLFLAG_RW | CTLFLAG_LOCKED, &ip6_select_src_expensive_secondary_if, 0,
+ "allow source interface selection to use expensive secondaries");
static int ip6_select_src_strong_end = 1;
SYSCTL_INT(_net_inet6_ip6, OID_AUTO, select_src_strong_end,
static int ip6_select_src_strong_end = 1;
SYSCTL_INT(_net_inet6_ip6, OID_AUTO, select_src_strong_end,
- CTLFLAG_RW | CTLFLAG_LOCKED, &ip6_select_src_strong_end, 0,
- "limit source address selection to outgoing interface");
+ CTLFLAG_RW | CTLFLAG_LOCKED, &ip6_select_src_strong_end, 0,
+ "limit source address selection to outgoing interface");
struct in6_addrpolicy defaultaddrpolicy;
int ip6_prefer_tempaddr = 1;
#ifdef ENABLE_ADDRSEL
extern lck_mtx_t *addrsel_mutex;
struct in6_addrpolicy defaultaddrpolicy;
int ip6_prefer_tempaddr = 1;
#ifdef ENABLE_ADDRSEL
extern lck_mtx_t *addrsel_mutex;
-#define ADDRSEL_LOCK() lck_mtx_lock(addrsel_mutex)
-#define ADDRSEL_UNLOCK() lck_mtx_unlock(addrsel_mutex)
+#define ADDRSEL_LOCK() lck_mtx_lock(addrsel_mutex)
+#define ADDRSEL_UNLOCK() lck_mtx_unlock(addrsel_mutex)
- struct ip6_pktopts *, struct ip6_moptions *, struct in6_ifaddr **,
- struct route_in6 *, struct ifnet **, struct rtentry **, int, int,
- struct ip6_out_args *ip6oa);
+ struct ip6_pktopts *, struct ip6_moptions *, struct in6_ifaddr **,
+ struct route_in6 *, struct ifnet **, struct rtentry **, int, int,
+ struct ip6_out_args *ip6oa);
- struct ip6_moptions *, struct route_in6 *ro,
- struct ip6_out_args *, struct ifnet **);
+ struct ip6_moptions *, struct route_in6 *ro,
+ struct ip6_out_args *, struct ifnet **);
static void init_policy_queue(void);
static int add_addrsel_policyent(const struct in6_addrpolicy *);
#ifdef ENABLE_ADDRSEL
static int delete_addrsel_policyent(const struct in6_addrpolicy *);
#endif
static int walk_addrsel_policy(int (*)(const struct in6_addrpolicy *, void *),
static void init_policy_queue(void);
static int add_addrsel_policyent(const struct in6_addrpolicy *);
#ifdef ENABLE_ADDRSEL
static int delete_addrsel_policyent(const struct in6_addrpolicy *);
#endif
static int walk_addrsel_policy(int (*)(const struct in6_addrpolicy *, void *),
static int dump_addrsel_policyent(const struct in6_addrpolicy *, void *);
static struct in6_addrpolicy *match_addrsel_policy(struct sockaddr_in6 *);
void addrsel_policy_init(void);
static int dump_addrsel_policyent(const struct in6_addrpolicy *, void *);
static struct in6_addrpolicy *match_addrsel_policy(struct sockaddr_in6 *);
void addrsel_policy_init(void);
(ip6_select_srcaddr_debug && (inp) != NULL && \
(inp)->inp_socket != NULL && \
((inp)->inp_socket->so_options & SO_DEBUG))
(ip6_select_srcaddr_debug && (inp) != NULL && \
(inp)->inp_socket != NULL && \
((inp)->inp_socket->so_options & SO_DEBUG))
- printf("%s:%d " fmt "\n",\
- __FUNCTION__, __LINE__, ##__VA_ARGS__); \
+ printf("%s:%d " fmt "\n",\
+ __FUNCTION__, __LINE__, ##__VA_ARGS__); \
* If necessary, this function lookups the routing table and returns
* an entry to the caller for later use.
*/
* If necessary, this function lookups the routing table and returns
* an entry to the caller for later use.
*/
SASEL_LOG("REPLACE r %d ia %s ifp1 %s\n", \
(r), s_src, ifp1->if_xname); \
srcrule = (r); \
goto replace; \
} while (0)
SASEL_LOG("REPLACE r %d ia %s ifp1 %s\n", \
(r), s_src, ifp1->if_xname); \
srcrule = (r); \
goto replace; \
} while (0)
SASEL_LOG("NEXTSRC r %d ia %s ifp1 %s\n", \
(r), s_src, ifp1->if_xname); \
SASEL_LOG("NEXTSRC r %d ia %s ifp1 %s\n", \
(r), s_src, ifp1->if_xname); \
SASEL_LOG("BREAK r %d ia %s ifp1 %s\n", \
(r), s_src, ifp1->if_xname); \
srcrule = (r); \
SASEL_LOG("BREAK r %d ia %s ifp1 %s\n", \
(r), s_src, ifp1->if_xname); \
srcrule = (r); \
int err = 0;
struct ifnet *src_ifp = NULL;
struct in6_addr src_storage = {};
struct in6_addr *in6 = NULL;
struct ifaddr *ifa = NULL;
int err = 0;
struct ifnet *src_ifp = NULL;
struct in6_addr src_storage = {};
struct in6_addr *in6 = NULL;
struct ifaddr *ifa = NULL;
(ip6_prefer_tempaddr ? IPV6_SRCSEL_HINT_PREFER_TMPADDR : 0),
ifp, 0, &src_storage, &src_ifp, &err, &ifa)) == NULL) {
(ip6_prefer_tempaddr ? IPV6_SRCSEL_HINT_PREFER_TMPADDR : 0),
ifp, 0, &src_storage, &src_ifp, &err, &ifa)) == NULL) {
- (void) inet_ntop(AF_INET6, &dst, s_dst, sizeof (s_src));
+ (void) inet_ntop(AF_INET6, &dst, s_dst, sizeof(s_src));
- (void) inet_ntop(AF_INET6, tmp, s_src, sizeof (s_src));
+ (void) inet_ntop(AF_INET6, tmp, s_src, sizeof(s_src));
printf("%s out src %s dst %s ifp %s\n",
__func__, s_src, s_dst, ifp->if_xname);
}
printf("%s out src %s dst %s ifp %s\n",
__func__, s_src, s_dst, ifp->if_xname);
}
+ /*
+ * Simply skip addresses reserved for CLAT46
+ */
+ if (ia->ia6_flags & IN6_IFF_CLAT46) {
+ SASEL_LOG("NEXT ia %s address on ifp1 %s skipped as it is "
+ "reserved for CLAT46", s_src, ifp1->if_xname);
+ goto next;
+ }
+
/*
* XXX By default we are strong end system and will
* limit candidate set of source address to the ones
/*
* XXX By default we are strong end system and will
* limit candidate set of source address to the ones
new_scope = in6_addrscope(&ia->ia_addr.sin6_addr);
if (IN6_ARE_SCOPE_CMP(best_scope, new_scope) < 0) {
new_scope = in6_addrscope(&ia->ia_addr.sin6_addr);
if (IN6_ARE_SCOPE_CMP(best_scope, new_scope) < 0) {
* !ip6_use_deprecated is already rejected above.
*/
if (!IFA6_IS_DEPRECATED(ia_best, secs) &&
* !ip6_use_deprecated is already rejected above.
*/
if (!IFA6_IS_DEPRECATED(ia_best, secs) &&
/*
* RFC 4429 says that optimistic addresses are equivalent to
* deprecated addresses, so avoid them here.
*/
if ((ia_best->ia6_flags & IN6_IFF_OPTIMISTIC) == 0 &&
/*
* RFC 4429 says that optimistic addresses are equivalent to
* deprecated addresses, so avoid them here.
*/
if ((ia_best->ia6_flags & IN6_IFF_OPTIMISTIC) == 0 &&
if (dst_policy->label != ADDR_LABEL_NOTAPP) {
new_policy = in6_addrsel_lookup_policy(&ia->ia_addr);
if (dst_policy->label == best_policy->label &&
if (dst_policy->label != ADDR_LABEL_NOTAPP) {
new_policy = in6_addrsel_lookup_policy(&ia->ia_addr);
if (dst_policy->label == best_policy->label &&
/*
* Rule 8: Use longest matching prefix.
*/
new_matchlen = in6_matchlen(&ia->ia_addr.sin6_addr, &dst);
/*
* Rule 8: Use longest matching prefix.
*/
new_matchlen = in6_matchlen(&ia->ia_addr.sin6_addr, &dst);
s_src, ifp1->if_xname, best_scope, new_scope, dst_scope);
IFA_ADDREF_LOCKED(&ia->ia_ifa); /* for ia_best */
IFA_UNLOCK(&ia->ia_ifa);
s_src, ifp1->if_xname, best_scope, new_scope, dst_scope);
IFA_ADDREF_LOCKED(&ia->ia_ifa); /* for ia_best */
IFA_UNLOCK(&ia->ia_ifa);
- (void) inet_ntop(AF_INET6, &dst, s_dst, sizeof (s_src));
+ (void) inet_ntop(AF_INET6, &dst, s_dst, sizeof(s_src));
- (void) inet_ntop(AF_INET6, tmp, s_src, sizeof (s_src));
+ (void) inet_ntop(AF_INET6, tmp, s_src, sizeof(s_src));
printf("%s out src %s dst %s dst_scope %d best_scope %d\n",
__func__, s_src, s_dst, dst_scope, best_scope);
}
printf("%s out src %s dst %s dst_scope %d best_scope %d\n",
__func__, s_src, s_dst, dst_scope, best_scope);
}
* the interface must be specified; otherwise, ifa_ifwithaddr()
* will fail matching the address.
*/
* the interface must be specified; otherwise, ifa_ifwithaddr()
* will fail matching the address.
*/
srcsock.sin6_addr = pi->ipi6_addr;
if (ifp != NULL) {
*errorp = in6_setscope(&srcsock.sin6_addr, ifp, NULL);
srcsock.sin6_addr = pi->ipi6_addr;
if (ifp != NULL) {
*errorp = in6_setscope(&srcsock.sin6_addr, ifp, NULL);
(inp && inp_restricted_send(inp, ia6->ia_ifa.ifa_ifp))) {
IFA_UNLOCK(&ia6->ia_ifa);
IFA_REMREF(&ia6->ia_ifa);
(inp && inp_restricted_send(inp, ia6->ia_ifa.ifa_ifp))) {
IFA_UNLOCK(&ia6->ia_ifa);
IFA_REMREF(&ia6->ia_ifa);
prefer_tempaddr = ip6_prefer_tempaddr;
} else if (opts->ip6po_prefer_tempaddr == IP6PO_TEMPADDR_NOTPREFER) {
prefer_tempaddr = 0;
prefer_tempaddr = ip6_prefer_tempaddr;
} else if (opts->ip6po_prefer_tempaddr == IP6PO_TEMPADDR_NOTPREFER) {
prefer_tempaddr = 0;
if (in6_selectsrc_core(dstsock, hint_mask, ifp, inp_debug, src_storage,
&sifp, errorp, NULL) == NULL) {
if (in6_selectsrc_core(dstsock, hint_mask, ifp, inp_debug, src_storage,
&sifp, errorp, NULL) == NULL) {
- (void) inet_ntop(AF_INET6, &src, s_src, sizeof (s_src));
- (void) inet_ntop(AF_INET6, dst, s_dst, sizeof (s_dst));
+ (void) inet_ntop(AF_INET6, &src, s_src, sizeof(s_src));
+ (void) inet_ntop(AF_INET6, dst, s_dst, sizeof(s_dst));
* If the outgoing interface was not set via IPV6_BOUND_IF or
* IPV6_PKTINFO, use the scope ID in the destination address.
*/
* If the outgoing interface was not set via IPV6_BOUND_IF or
* IPV6_PKTINFO, use the scope ID in the destination address.
*/
if (scope == IFSCOPE_NONE) {
scope = rt_ifp->if_index;
if (scope != get_primary_ifscope(AF_INET6) &&
if (scope == IFSCOPE_NONE) {
scope = rt_ifp->if_index;
if (scope != get_primary_ifscope(AF_INET6) &&
if (ROUTE_UNUSABLE(ron) || (ron->ro_rt != NULL &&
(!(ron->ro_rt->rt_flags & RTF_LLINFO) ||
(select_srcif && (ifa == NULL ||
(ifa->ifa_ifp != ron->ro_rt->rt_ifp && !proxied_ifa))))) ||
!IN6_ARE_ADDR_EQUAL(&satosin6(&ron->ro_dst)->sin6_addr,
&sin6_next->sin6_addr)) {
if (ROUTE_UNUSABLE(ron) || (ron->ro_rt != NULL &&
(!(ron->ro_rt->rt_flags & RTF_LLINFO) ||
(select_srcif && (ifa == NULL ||
(ifa->ifa_ifp != ron->ro_rt->rt_ifp && !proxied_ifa))))) ||
!IN6_ARE_ADDR_EQUAL(&satosin6(&ron->ro_dst)->sin6_addr,
&sin6_next->sin6_addr)) {
ROUTE_RELEASE(ron);
*satosin6(&ron->ro_dst) = *sin6_next;
}
if (ron->ro_rt == NULL) {
rtalloc_scoped((struct route *)ron, ifscope);
ROUTE_RELEASE(ron);
*satosin6(&ron->ro_dst) = *sin6_next;
}
if (ron->ro_rt == NULL) {
rtalloc_scoped((struct route *)ron, ifscope);
if (ROUTE_UNUSABLE(ron) ||
!(ron->ro_rt->rt_flags & RTF_LLINFO) ||
!IN6_ARE_ADDR_EQUAL(&satosin6(rt_key(ron->ro_rt))->
sin6_addr, &sin6_next->sin6_addr)) {
if (ROUTE_UNUSABLE(ron) ||
!(ron->ro_rt->rt_flags & RTF_LLINFO) ||
!IN6_ARE_ADDR_EQUAL(&satosin6(rt_key(ron->ro_rt))->
sin6_addr, &sin6_next->sin6_addr)) {
* a new one. Note that we should check the address family of the
* cached destination, in case of sharing the cache with IPv4.
*/
* a new one. Note that we should check the address family of the
* cached destination, in case of sharing the cache with IPv4.
*/
if (ROUTE_UNUSABLE(ro) || (ro->ro_rt != NULL &&
(satosin6(&ro->ro_dst)->sin6_family != AF_INET6 ||
!IN6_ARE_ADDR_EQUAL(&satosin6(&ro->ro_dst)->sin6_addr, dst) ||
(select_srcif && (ifa == NULL ||
(ifa->ifa_ifp != ro->ro_rt->rt_ifp && !proxied_ifa)))))) {
if (ROUTE_UNUSABLE(ro) || (ro->ro_rt != NULL &&
(satosin6(&ro->ro_dst)->sin6_family != AF_INET6 ||
!IN6_ARE_ADDR_EQUAL(&satosin6(&ro->ro_dst)->sin6_addr, dst) ||
(select_srcif && (ifa == NULL ||
(ifa->ifa_ifp != ro->ro_rt->rt_ifp && !proxied_ifa)))))) {
- &((struct route *)ro)->ro_dst, 0, 0, ifscope);
+ &((struct route *)ro)->ro_dst, 0, 0, ifscope);
* explicitly specified (in case we're asked to clone.)
*/
if (opts != NULL && opts->ip6po_nexthop != NULL) {
* explicitly specified (in case we're asked to clone.)
*/
if (opts != NULL && opts->ip6po_nexthop != NULL) {
/*
* If there is a non-loopback route with the wrong interface,
* or if there is no interface configured with such an address,
/*
* If there is a non-loopback route with the wrong interface,
* or if there is no interface configured with such an address,
if (ifa != route->ro_srcia ||
!(route->ro_flags & ROF_SRCIF_SELECTED)) {
RT_CONVERT_LOCK(route->ro_rt);
if (ifa != route->ro_srcia ||
!(route->ro_flags & ROF_SRCIF_SELECTED)) {
RT_CONVERT_LOCK(route->ro_rt);
if (ifp != NULL && opts != NULL &&
opts->ip6po_pktinfo != NULL &&
opts->ip6po_pktinfo->ipi6_ifindex != 0) {
if (ifp != NULL && opts != NULL &&
opts->ip6po_pktinfo != NULL &&
opts->ip6po_pktinfo->ipi6_ifindex != 0) {
-#define CHECK_RESTRICTIONS(_ip6oa, _ifp) \
- ((((_ip6oa)->ip6oa_flags & IP6OAF_NO_CELLULAR) && \
- IFNET_IS_CELLULAR(_ifp)) || \
- (((_ip6oa)->ip6oa_flags & IP6OAF_NO_EXPENSIVE) && \
- IFNET_IS_EXPENSIVE(_ifp)) || \
- (!((_ip6oa)->ip6oa_flags & IP6OAF_INTCOPROC_ALLOWED) && \
- IFNET_IS_INTCOPROC(_ifp)) || \
- (!((_ip6oa)->ip6oa_flags & IP6OAF_AWDL_UNRESTRICTED) && \
+#define CHECK_RESTRICTIONS(_ip6oa, _ifp) \
+ ((((_ip6oa)->ip6oa_flags & IP6OAF_NO_CELLULAR) && \
+ IFNET_IS_CELLULAR(_ifp)) || \
+ (((_ip6oa)->ip6oa_flags & IP6OAF_NO_EXPENSIVE) && \
+ IFNET_IS_EXPENSIVE(_ifp)) || \
+ (!((_ip6oa)->ip6oa_flags & IP6OAF_INTCOPROC_ALLOWED) && \
+ IFNET_IS_INTCOPROC(_ifp)) || \
+ (!((_ip6oa)->ip6oa_flags & IP6OAF_AWDL_UNRESTRICTED) && \
}
if (ip6_select_srcif_debug) {
printf("%s %s->%s ifscope %d ifa_if %s ro_if %s (error=%d)\n",
}
if (ip6_select_srcif_debug) {
printf("%s %s->%s ifscope %d ifa_if %s ro_if %s (error=%d)\n",
ro = &sro;
}
if ((err = selectroute(NULL, dstsock, opts, mopts, NULL, ro, retifp,
ro = &sro;
}
if ((err = selectroute(NULL, dstsock, opts, mopts, NULL, ro, retifp,
- &rt, 0, 1, ip6oa)) != 0)
+ &rt, 0, 1, ip6oa)) != 0) {
if (rt != NULL && rt->rt_ifa != NULL && rt->rt_ifa->ifa_ifp != NULL &&
retifp != NULL) {
ifnet_reference(rt->rt_ifa->ifa_ifp);
if (rt != NULL && rt->rt_ifa != NULL && rt->rt_ifa->ifa_ifp != NULL &&
retifp != NULL) {
ifnet_reference(rt->rt_ifa->ifa_ifp);
* retifp might point to a valid ifp with a reference held;
* caller is responsible for releasing it if non-NULL.
*/
* retifp might point to a valid ifp with a reference held;
* caller is responsible for releasing it if non-NULL.
*/
struct in6_ifaddr **retsrcia, struct route_in6 *ro, struct ifnet **retifp,
struct rtentry **retrt, int clone, struct ip6_out_args *ip6oa)
{
struct in6_ifaddr **retsrcia, struct route_in6 *ro, struct ifnet **retifp,
struct rtentry **retrt, int clone, struct ip6_out_args *ip6oa)
{
-
- return (selectroute(srcsock, dstsock, opts, mopts, retsrcia, ro, retifp,
- retrt, clone, 0, ip6oa));
+ return selectroute(srcsock, dstsock, opts, mopts, retsrcia, ro, retifp,
+ retrt, clone, 0, ip6oa);
in6_selecthlim(struct in6pcb *in6p, struct ifnet *ifp)
{
if (in6p && in6p->in6p_hops >= 0) {
in6_selecthlim(struct in6pcb *in6p, struct ifnet *ifp)
{
if (in6p && in6p->in6p_hops >= 0) {
if (!locked) { /* Make sure we don't run into a deadlock: 4052373 */
if (!lck_rw_try_lock_exclusive(pcbinfo->ipi_lock)) {
socket_unlock(inp->inp_socket, 0);
if (!locked) { /* Make sure we don't run into a deadlock: 4052373 */
if (!lck_rw_try_lock_exclusive(pcbinfo->ipi_lock)) {
socket_unlock(inp->inp_socket, 0);
last = ipport_hilastauto;
lastport = &pcbinfo->ipi_lasthi;
} else if (inp->inp_flags & INP_LOWPORT) {
last = ipport_hilastauto;
lastport = &pcbinfo->ipi_lasthi;
} else if (inp->inp_flags & INP_LOWPORT) {
/*
* Undo any address bind that may have
* occurred above.
*/
inp->in6p_laddr = in6addr_any;
inp->in6p_last_outifp = NULL;
/*
* Undo any address bind that may have
* occurred above.
*/
inp->in6p_laddr = in6addr_any;
inp->in6p_last_outifp = NULL;
}
lport = htons(*lastport);
found = (in6_pcblookup_local(pcbinfo, &inp->in6p_laddr,
}
lport = htons(*lastport);
found = (in6_pcblookup_local(pcbinfo, &inp->in6p_laddr,
k = (u_char *)&key->sin6_addr;
p = (u_char *)&pol->addr.sin6_addr;
for (; mp < ep && *mp; mp++, k++, p++) {
m = *mp;
k = (u_char *)&key->sin6_addr;
p = (u_char *)&pol->addr.sin6_addr;
for (; mp < ep && *mp; mp++, k++, p++) {
m = *mp;
- MALLOC(new, struct addrsel_policyent *, sizeof (*new), M_IFADDR,
+ MALLOC(new, struct addrsel_policyent *, sizeof(*new), M_IFADDR,
TAILQ_FOREACH(pol, &addrsel_policytab, ape_entry) {
if ((error = (*callback)(&pol->ape_policy, w)) != 0) {
ADDRSEL_UNLOCK();
TAILQ_FOREACH(pol, &addrsel_policytab, ape_entry) {
if ((error = (*callback)(&pol->ape_policy, w)) != 0) {
ADDRSEL_UNLOCK();
}
static int
in6_src_sysctl SYSCTL_HANDLER_ARGS
{
#pragma unused(oidp, arg1, arg2)
}
static int
in6_src_sysctl SYSCTL_HANDLER_ARGS
{
#pragma unused(oidp, arg1, arg2)
}
SYSCTL_NODE(_net_inet6_ip6, IPV6CTL_ADDRCTLPOLICY, addrctlpolicy,
}
SYSCTL_NODE(_net_inet6_ip6, IPV6CTL_ADDRCTLPOLICY, addrctlpolicy,
int
in6_src_ioctl(u_long cmd, caddr_t data)
{
int i;
struct in6_addrpolicy ent0;
int
in6_src_ioctl(u_long cmd, caddr_t data)
{
int i;
struct in6_addrpolicy ent0;
- if (cmd != SIOCAADDRCTL_POLICY && cmd != SIOCDADDRCTL_POLICY)
- return (EOPNOTSUPP); /* check for safety */
-
- bcopy(data, &ent0, sizeof (ent0));
+ if (cmd != SIOCAADDRCTL_POLICY && cmd != SIOCDADDRCTL_POLICY) {
+ return EOPNOTSUPP; /* check for safety */
+ }
+ bcopy(data, &ent0, sizeof(ent0));
/* clear trailing garbages (if any) of the prefix address. */
for (i = 0; i < 4; i++) {
ent0.addr.sin6_addr.s6_addr32[i] &=
/* clear trailing garbages (if any) of the prefix address. */
for (i = 0; i < 4; i++) {
ent0.addr.sin6_addr.s6_addr32[i] &=