diff options
author | bz <bz@FreeBSD.org> | 2008-07-08 18:41:36 +0000 |
---|---|---|
committer | bz <bz@FreeBSD.org> | 2008-07-08 18:41:36 +0000 |
commit | 13896f2e515ce1d974657ebcd1f50dad4c106a06 (patch) | |
tree | cc4ffd912f153cf70830eb1ad609788e2d3190c8 /sys/netinet6/in6_src.c | |
parent | 2d2c0669861c1461f6afa4e816ec9902ac23f402 (diff) | |
download | FreeBSD-src-13896f2e515ce1d974657ebcd1f50dad4c106a06.zip FreeBSD-src-13896f2e515ce1d974657ebcd1f50dad4c106a06.tar.gz |
Change the parameters to in6_selectsrc():
- pass in the inp instead of both in6p_moptions and laddr.
- pass in cred for upcoming prison checks.
Reviewed by: rwatson
Diffstat (limited to 'sys/netinet6/in6_src.c')
-rw-r--r-- | sys/netinet6/in6_src.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/sys/netinet6/in6_src.c b/sys/netinet6/in6_src.c index b6e2856..934ff15 100644 --- a/sys/netinet6/in6_src.c +++ b/sys/netinet6/in6_src.c @@ -170,8 +170,8 @@ static struct in6_addrpolicy *match_addrsel_policy(struct sockaddr_in6 *); struct in6_addr * in6_selectsrc(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts, - struct ip6_moptions *mopts, struct route_in6 *ro, - struct in6_addr *laddr, struct ifnet **ifpp, int *errorp) + struct inpcb *inp, struct route_in6 *ro, struct ucred *cred, + struct ifnet **ifpp, int *errorp) { struct in6_addr dst; struct ifnet *ifp = NULL; @@ -181,12 +181,18 @@ in6_selectsrc(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts, struct in6_addrpolicy *dst_policy = NULL, *best_policy = NULL; u_int32_t odstzone; int prefer_tempaddr; + struct ip6_moptions *mopts; dst = dstsock->sin6_addr; /* make a copy for local operation */ *errorp = 0; if (ifpp) *ifpp = NULL; + if (inp != NULL) + mopts = inp->in6p_moptions; + else + mopts = NULL; + /* * If the source address is explicitly specified by the caller, * check if the requested source address is indeed a unicast address @@ -236,8 +242,9 @@ in6_selectsrc(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts, /* * Otherwise, if the socket has already bound the source, just use it. */ - if (laddr && !IN6_IS_ADDR_UNSPECIFIED(laddr)) - return (laddr); + if (inp != NULL && !IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr)) { + return (&inp->in6p_laddr); + } /* * If the address is not specified, choose the best one based on |