Lines Matching refs:dst
250 #define INET_DEFAULT(dst) \
251 ((dst)->sa_family == AF_INET && SIN(dst)->sin_addr.s_addr == 0)
258 * route; dst typically comes from rt_key(rt) but may be coming from
262 rt_inet_default(struct rtentry *rt, struct sockaddr *dst)
264 return (INET_DEFAULT(dst) && !(rt->rt_flags & RTF_IFSCOPE));
310 * Copy a sockaddr_in src to dst and embed ifscope into dst.
313 sin_copy(struct sockaddr_in *src, struct sockaddr_in *dst, unsigned int ifscope)
315 *dst = *src;
316 sa_set_ifscope(SA(dst), ifscope);
318 return (SA(dst));
322 * Copy a mask from src to a sockaddr_in dst and embed ifscope into dst.
325 mask_copy(struct sockaddr *src, struct sockaddr_in *dst, unsigned int ifscope)
327 /* We know dst is at least the size of sockaddr{_in} */
328 bzero(dst, sizeof (*dst));
329 rt_maskedcopy(src, SA(dst), src);
340 SINIFSCOPE(dst)->sin_ifscope = ifscope;
341 SINIFSCOPE(dst)->sin_len =
343 sizeof (SINIFSCOPE(dst)->sin_ifscope);
345 return (SA(dst));
461 rtalloc1_locked(struct sockaddr *dst, int report, u_long ignflags)
463 return (rtalloc1_common_locked(dst, report, ignflags, IFSCOPE_NONE));
467 rtalloc1_scoped_locked(struct sockaddr *dst, int report, u_long ignflags,
470 return (rtalloc1_common_locked(dst, report, ignflags, ifscope));
478 rtalloc1_common_locked(struct sockaddr *dst, int report, u_long ignflags,
481 struct radix_node_head *rnh = rt_tables[dst->sa_family];
494 rt = rt_lookup(FALSE, dst, NULL, rnh, ifscope);
506 err = rtrequest_locked(RTM_RESOLVE, dst, NULL, NULL, 0, &newrt);
549 info.rti_info[RTAX_DST] = dst;
557 rtalloc1(struct sockaddr *dst, int report, u_long ignflags)
562 entry = rtalloc1_locked(dst, report, ignflags);
802 rtredirect(struct ifnet *ifp, struct sockaddr *dst, struct sockaddr *gateway,
828 rt = rtalloc1_scoped_locked(dst, 0, RTF_CLONING|RTF_PRCLONING, ifscope);
835 * If the redirect isn't from our current router for this dst,
882 error = rtrequest_scoped_locked(RTM_ADD, dst,
918 info.rti_info[RTAX_DST] = dst;
943 const struct sockaddr *dst,
949 ifa = ifa_ifwithroute_locked(flags, dst, gateway);
956 ifa_ifwithroute_locked(int flags, const struct sockaddr *dst,
959 return (ifa_ifwithroute_common_locked((flags & ~RTF_IFSCOPE), dst,
964 ifa_ifwithroute_scoped_locked(int flags, const struct sockaddr *dst,
972 return (ifa_ifwithroute_common_locked(flags, dst, gateway, ifscope));
976 ifa_ifwithroute_common_locked(int flags, const struct sockaddr *dst,
991 if (dst != NULL && dst->sa_family == AF_INET)
992 dst = sin_copy(SIN(dst), &dst_in, IFSCOPE_NONE);
1006 ifa = ifa_ifwithdstaddr(dst);
1022 rt = rtalloc1_scoped_locked((struct sockaddr *)(size_t)dst,
1032 if (ifa != NULL && ifa->ifa_addr->sa_family != dst->sa_family) {
1035 newifa = ifaof_ifpforaddr(dst, ifa->ifa_ifp);
1085 rtrequest_locked(int req, struct sockaddr *dst, struct sockaddr *gateway,
1088 return (rtrequest_common_locked(req, dst, gateway, netmask,
1093 rtrequest_scoped_locked(int req, struct sockaddr *dst,
1102 return (rtrequest_common_locked(req, dst, gateway, netmask,
1131 struct sockaddr *ndst, *dst = dst0;
1139 if ((rnh = rt_tables[dst->sa_family]) == 0)
1162 if (dst->sa_family != AF_INET ||
1170 dst = sin_copy(SIN(dst), &sin, ifscope);
1184 if ((rn = rnh->rnh_deladdr(dst, netmask, rnh)) == 0)
1208 rnh->rnh_walktree_from(rnh, dst, rt_mask(rt),
1273 if (!ip_doscopedroute || dst->sa_family != AF_INET)
1281 if (!IN_LINKLOCAL(ntohl(SIN(dst)->sin_addr.s_addr))) {
1294 dst = sin_copy(SIN(dst), &sin, ifscope);
1324 if ((error = rt_setgate(rt, dst, gateway)) != 0) {
1338 rt_maskedcopy(dst, ndst, netmask);
1340 Bcopy(dst, ndst, dst->sa_len);
1367 rt2 = rtalloc1_locked(dst, 0,
1463 struct sockaddr *dst,
1472 error = rtrequest_locked(req, dst, gateway, netmask, flags, ret_nrt);
1568 rt_setgate(struct rtentry *rt, struct sockaddr *dst, struct sockaddr *gate)
1570 int dlen = ROUNDUP(dst->sa_len), glen = ROUNDUP(gate->sa_len);
1571 struct radix_node_head *rnh = rt_tables[dst->sa_family];
1581 (RTF_HOST|RTF_GATEWAY)) && (dst->sa_len == gate->sa_len) &&
1582 (bcmp(dst, gate, dst->sa_len) == 0)) {
1601 ifscope = (dst->sa_family == AF_INET) ?
1602 sa_get_ifscope(dst) : IFSCOPE_NONE;
1644 if (rt_inet_default(rt, dst) && rt->rt_ifp != NULL)
1655 if ((dst->sa_family == AF_INET) &&
1663 * Prepare to store the gateway in rt_gateway. Both dst and gateway
1667 * the 'dst' address and point rt_gateway to the right place.
1682 * Copy from 'dst' and not rt_key(rt) because we can get
1686 Bcopy(dst, new, dlen);
1725 rt_maskedcopy(struct sockaddr *src, struct sockaddr *dst,
1729 u_char *cp2 = (u_char *)dst;
1749 node_lookup(struct sockaddr *dst, struct sockaddr *netmask,
1759 if (dst->sa_family != AF_INET)
1766 dst = sin_copy(SIN(dst), &sin, ifscope);
1775 rn = rnh->rnh_lookup_args(dst, netmask, rnh, f, w);
1816 rt_lookup(boolean_t lookup_only, struct sockaddr *dst, struct sockaddr *netmask,
1830 if (!ip_doscopedroute || dst->sa_family != AF_INET) {
1832 rn = rnh->rnh_lookup(dst, netmask, rnh);
1834 rn = rnh->rnh_matchaddr(dst, rnh);
1846 rn0 = rn = node_lookup(dst, netmask, IFSCOPE_NONE);
1901 rn = node_lookup(dst, netmask, ifscope);
1959 struct sockaddr *dst;
1965 dst = flags & RTF_HOST ? ifa->ifa_dstaddr : ifa->ifa_addr;
1983 rt_maskedcopy(dst, deldst, ifa->ifa_netmask);
1984 dst = deldst;
1992 rt = rtalloc1_locked(dst, 0, 0UL);
2031 error = rtrequest_locked(cmd, dst, ifa->ifa_addr, ifa->ifa_netmask,