diff options
Diffstat (limited to 'sys/netinet6')
-rw-r--r-- | sys/netinet6/in6_pcb.c | 16 | ||||
-rw-r--r-- | sys/netinet6/in6_pcb.h | 6 | ||||
-rw-r--r-- | sys/netinet6/in6_src.c | 6 | ||||
-rw-r--r-- | sys/netinet6/udp6_output.c | 3 | ||||
-rw-r--r-- | sys/netinet6/udp6_usrreq.c | 10 |
5 files changed, 22 insertions, 19 deletions
diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index 1c7278c..15ef659 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -123,10 +123,10 @@ struct in6_addr zeroin6_addr; int -in6_pcbbind(inp, nam, td) +in6_pcbbind(inp, nam, cred) register struct inpcb *inp; struct sockaddr *nam; - struct thread *td; + struct ucred *cred; { struct socket *so = inp->inp_socket; struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)NULL; @@ -190,8 +190,8 @@ in6_pcbbind(inp, nam, td) struct inpcb *t; /* GROSS */ - if (ntohs(lport) < IPV6PORT_RESERVED && td && - suser_cred(td->td_ucred, PRISON_ROOT)) + if (ntohs(lport) < IPV6PORT_RESERVED && + suser_cred(cred, PRISON_ROOT)) return (EACCES); if (so->so_cred->cr_uid != 0 && !IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) { @@ -274,7 +274,7 @@ in6_pcbbind(inp, nam, td) } if (lport == 0) { int e; - if ((e = in6_pcbsetport(&inp->in6p_laddr, inp, td)) != 0) + if ((e = in6_pcbsetport(&inp->in6p_laddr, inp, cred)) != 0) return (e); } else { @@ -360,10 +360,10 @@ in6_pcbladdr(inp, nam, plocal_addr6) * then pick one. */ int -in6_pcbconnect(inp, nam, td) +in6_pcbconnect(inp, nam, cred) register struct inpcb *inp; struct sockaddr *nam; - struct thread *td; + struct ucred *cred; { struct in6_addr *addr6; register struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)nam; @@ -385,7 +385,7 @@ in6_pcbconnect(inp, nam, td) } if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr)) { if (inp->inp_lport == 0) { - error = in6_pcbbind(inp, (struct sockaddr *)0, td); + error = in6_pcbbind(inp, (struct sockaddr *)0, cred); if (error) return (error); } diff --git a/sys/netinet6/in6_pcb.h b/sys/netinet6/in6_pcb.h index 1a9fb35..07217b0 100644 --- a/sys/netinet6/in6_pcb.h +++ b/sys/netinet6/in6_pcb.h @@ -76,8 +76,8 @@ void in6_pcbpurgeif0 __P((struct in6pcb *, struct ifnet *)); void in6_losing __P((struct inpcb *)); -int in6_pcbbind __P((struct inpcb *, struct sockaddr *, struct thread *)); -int in6_pcbconnect __P((struct inpcb *, struct sockaddr *, struct thread *)); +int in6_pcbbind __P((struct inpcb *, struct sockaddr *, struct ucred *)); +int in6_pcbconnect __P((struct inpcb *, struct sockaddr *, struct ucred *)); void in6_pcbdetach __P((struct inpcb *)); void in6_pcbdisconnect __P((struct inpcb *)); int in6_pcbladdr __P((struct inpcb *, struct sockaddr *, @@ -103,7 +103,7 @@ int in6_setsockaddr __P((struct socket *so, struct sockaddr **nam)); int in6_mapped_sockaddr __P((struct socket *so, struct sockaddr **nam)); int in6_mapped_peeraddr __P((struct socket *so, struct sockaddr **nam)); int in6_selecthlim __P((struct in6pcb *, struct ifnet *)); -int in6_pcbsetport __P((struct in6_addr *, struct inpcb *, struct thread *)); +int in6_pcbsetport __P((struct in6_addr *, struct inpcb *, struct ucred *)); void init_sin6 __P((struct sockaddr_in6 *sin6, struct mbuf *m)); #endif /* _KERNEL */ diff --git a/sys/netinet6/in6_src.c b/sys/netinet6/in6_src.c index 24fa3d7..f6d9668 100644 --- a/sys/netinet6/in6_src.c +++ b/sys/netinet6/in6_src.c @@ -742,10 +742,10 @@ in6_selecthlim(in6p, ifp) * share this function by all *bsd*... */ int -in6_pcbsetport(laddr, inp, td) +in6_pcbsetport(laddr, inp, cred) struct in6_addr *laddr; struct inpcb *inp; - struct thread *td; + struct ucred *cred; { struct socket *so = inp->inp_socket; u_int16_t lport = 0, first, last, *lastport; @@ -763,7 +763,7 @@ in6_pcbsetport(laddr, inp, td) last = ipport_hilastauto; lastport = &pcbinfo->lasthi; } else if (inp->inp_flags & INP_LOWPORT) { - if (td && (error = suser(td))) + if ((error = suser_cred(cred, 0))) return error; first = ipport_lowfirstauto; /* 1023 */ last = ipport_lowlastauto; /* 600 */ diff --git a/sys/netinet6/udp6_output.c b/sys/netinet6/udp6_output.c index 5de9188..29789e2 100644 --- a/sys/netinet6/udp6_output.c +++ b/sys/netinet6/udp6_output.c @@ -70,6 +70,7 @@ #include "opt_inet6.h" #include <sys/param.h> +#include <sys/proc.h> #include <sys/malloc.h> #include <sys/mbuf.h> #include <sys/protosw.h> @@ -213,7 +214,7 @@ udp6_output(in6p, m, addr6, control, td) goto release; } if (in6p->in6p_lport == 0 && - (error = in6_pcbsetport(laddr, in6p, td)) != 0) + (error = in6_pcbsetport(laddr, in6p, td->td_ucred)) != 0) goto release; } else { if (IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_faddr)) { diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c index 780b917..4ab9b35 100644 --- a/sys/netinet6/udp6_usrreq.c +++ b/sys/netinet6/udp6_usrreq.c @@ -572,14 +572,15 @@ udp6_bind(struct socket *so, struct sockaddr *nam, struct thread *td) inp->inp_vflag |= INP_IPV4; inp->inp_vflag &= ~INP_IPV6; s = splnet(); - error = in_pcbbind(inp, (struct sockaddr *)&sin, td); + error = in_pcbbind(inp, (struct sockaddr *)&sin, + td->td_ucred); splx(s); return error; } } s = splnet(); - error = in6_pcbbind(inp, nam, td); + error = in6_pcbbind(inp, nam, td->td_ucred); splx(s); return error; } @@ -605,7 +606,8 @@ udp6_connect(struct socket *so, struct sockaddr *nam, struct thread *td) return EISCONN; in6_sin6_2_sin(&sin, sin6_p); s = splnet(); - error = in_pcbconnect(inp, (struct sockaddr *)&sin, td); + error = in_pcbconnect(inp, (struct sockaddr *)&sin, + td->td_ucred); splx(s); if (error == 0) { inp->inp_vflag |= INP_IPV4; @@ -618,7 +620,7 @@ udp6_connect(struct socket *so, struct sockaddr *nam, struct thread *td) if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr)) return EISCONN; s = splnet(); - error = in6_pcbconnect(inp, nam, td); + error = in6_pcbconnect(inp, nam, td->td_ucred); splx(s); if (error == 0) { if (!ip6_v6only) { /* should be non mapped addr */ |