diff options
author | Bjoern A. Zeeb <bz@FreeBSD.org> | 2008-07-08 18:41:36 +0000 |
---|---|---|
committer | Bjoern A. Zeeb <bz@FreeBSD.org> | 2008-07-08 18:41:36 +0000 |
commit | f2f877d38c283c678eb420456635c2817d9483d8 (patch) | |
tree | cc4ffd912f153cf70830eb1ad609788e2d3190c8 /sys/netinet6/in6_src.c | |
parent | 7156132cd919e166337f86288b4a0356ed496e18 (diff) | |
download | src-f2f877d38c283c678eb420456635c2817d9483d8.tar.gz src-f2f877d38c283c678eb420456635c2817d9483d8.zip |
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
Notes
Notes:
svn path=/head/; revision=180371
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 b6e28567a339..934ff159c506 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 |