Remove spl use from IPv6 inpcb code.
In various inpcb methods for IPv6 sockets, don't check of so_pcb is NULL, assert it isn't. MFC after: 3 months
This commit is contained in:
parent
ecc538ef6d
commit
6f0c2ddcfa
@ -513,20 +513,15 @@ in6_setsockaddr(so, nam)
|
|||||||
struct socket *so;
|
struct socket *so;
|
||||||
struct sockaddr **nam;
|
struct sockaddr **nam;
|
||||||
{
|
{
|
||||||
int s;
|
|
||||||
register struct inpcb *inp;
|
register struct inpcb *inp;
|
||||||
struct in6_addr addr;
|
struct in6_addr addr;
|
||||||
in_port_t port;
|
in_port_t port;
|
||||||
|
|
||||||
s = splnet();
|
|
||||||
inp = sotoinpcb(so);
|
inp = sotoinpcb(so);
|
||||||
if (!inp) {
|
KASSERT(inp != NULL, ("in6_setsockaddr: inp == NULL"));
|
||||||
splx(s);
|
|
||||||
return EINVAL;
|
|
||||||
}
|
|
||||||
port = inp->inp_lport;
|
port = inp->inp_lport;
|
||||||
addr = inp->in6p_laddr;
|
addr = inp->in6p_laddr;
|
||||||
splx(s);
|
|
||||||
|
|
||||||
*nam = in6_sockaddr(port, &addr);
|
*nam = in6_sockaddr(port, &addr);
|
||||||
return 0;
|
return 0;
|
||||||
@ -537,20 +532,15 @@ in6_setpeeraddr(so, nam)
|
|||||||
struct socket *so;
|
struct socket *so;
|
||||||
struct sockaddr **nam;
|
struct sockaddr **nam;
|
||||||
{
|
{
|
||||||
int s;
|
|
||||||
struct inpcb *inp;
|
struct inpcb *inp;
|
||||||
struct in6_addr addr;
|
struct in6_addr addr;
|
||||||
in_port_t port;
|
in_port_t port;
|
||||||
|
|
||||||
s = splnet();
|
|
||||||
inp = sotoinpcb(so);
|
inp = sotoinpcb(so);
|
||||||
if (!inp) {
|
KASSERT(inp != NULL, ("in6_setpeeraddr: inp == NULL"));
|
||||||
splx(s);
|
|
||||||
return EINVAL;
|
|
||||||
}
|
|
||||||
port = inp->inp_fport;
|
port = inp->inp_fport;
|
||||||
addr = inp->in6p_faddr;
|
addr = inp->in6p_faddr;
|
||||||
splx(s);
|
|
||||||
|
|
||||||
*nam = in6_sockaddr(port, &addr);
|
*nam = in6_sockaddr(port, &addr);
|
||||||
return 0;
|
return 0;
|
||||||
@ -559,11 +549,12 @@ in6_setpeeraddr(so, nam)
|
|||||||
int
|
int
|
||||||
in6_mapped_sockaddr(struct socket *so, struct sockaddr **nam)
|
in6_mapped_sockaddr(struct socket *so, struct sockaddr **nam)
|
||||||
{
|
{
|
||||||
struct inpcb *inp = sotoinpcb(so);
|
struct inpcb *inp;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
if (inp == NULL)
|
inp = sotoinpcb(so);
|
||||||
return EINVAL;
|
KASSERT(inp != NULL, ("in6_mapped_sockaddr: inp == NULL"));
|
||||||
|
|
||||||
if ((inp->inp_vflag & (INP_IPV4 | INP_IPV6)) == INP_IPV4) {
|
if ((inp->inp_vflag & (INP_IPV4 | INP_IPV6)) == INP_IPV4) {
|
||||||
error = in_setsockaddr(so, nam, &tcbinfo);
|
error = in_setsockaddr(so, nam, &tcbinfo);
|
||||||
if (error == 0)
|
if (error == 0)
|
||||||
@ -579,11 +570,12 @@ in6_mapped_sockaddr(struct socket *so, struct sockaddr **nam)
|
|||||||
int
|
int
|
||||||
in6_mapped_peeraddr(struct socket *so, struct sockaddr **nam)
|
in6_mapped_peeraddr(struct socket *so, struct sockaddr **nam)
|
||||||
{
|
{
|
||||||
struct inpcb *inp = sotoinpcb(so);
|
struct inpcb *inp;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
if (inp == NULL)
|
inp = sotoinpcb(so);
|
||||||
return EINVAL;
|
KASSERT(inp != NULL, ("in6_mapped_peeraddr: inp == NULL"));
|
||||||
|
|
||||||
if ((inp->inp_vflag & (INP_IPV4 | INP_IPV6)) == INP_IPV4) {
|
if ((inp->inp_vflag & (INP_IPV4 | INP_IPV6)) == INP_IPV4) {
|
||||||
error = in_setpeeraddr(so, nam, &tcbinfo);
|
error = in_setpeeraddr(so, nam, &tcbinfo);
|
||||||
if (error == 0)
|
if (error == 0)
|
||||||
@ -603,8 +595,6 @@ in6_mapped_peeraddr(struct socket *so, struct sockaddr **nam)
|
|||||||
* cmds that are uninteresting (e.g., no error in the map).
|
* cmds that are uninteresting (e.g., no error in the map).
|
||||||
* Call the protocol specific routine (if any) to report
|
* Call the protocol specific routine (if any) to report
|
||||||
* any errors for each matching socket.
|
* any errors for each matching socket.
|
||||||
*
|
|
||||||
* Must be called at splnet.
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
in6_pcbnotify(pcbinfo, dst, fport_arg, src, lport_arg, cmd, cmdarg, notify)
|
in6_pcbnotify(pcbinfo, dst, fport_arg, src, lport_arg, cmd, cmdarg, notify)
|
||||||
@ -621,7 +611,7 @@ in6_pcbnotify(pcbinfo, dst, fport_arg, src, lport_arg, cmd, cmdarg, notify)
|
|||||||
struct sockaddr_in6 sa6_src, *sa6_dst;
|
struct sockaddr_in6 sa6_src, *sa6_dst;
|
||||||
u_short fport = fport_arg, lport = lport_arg;
|
u_short fport = fport_arg, lport = lport_arg;
|
||||||
u_int32_t flowinfo;
|
u_int32_t flowinfo;
|
||||||
int errno, s;
|
int errno;
|
||||||
|
|
||||||
if ((unsigned)cmd >= PRC_NCMDS || dst->sa_family != AF_INET6)
|
if ((unsigned)cmd >= PRC_NCMDS || dst->sa_family != AF_INET6)
|
||||||
return;
|
return;
|
||||||
@ -653,7 +643,6 @@ in6_pcbnotify(pcbinfo, dst, fport_arg, src, lport_arg, cmd, cmdarg, notify)
|
|||||||
notify = in6_rtchange;
|
notify = in6_rtchange;
|
||||||
}
|
}
|
||||||
errno = inet6ctlerrmap[cmd];
|
errno = inet6ctlerrmap[cmd];
|
||||||
s = splnet();
|
|
||||||
head = pcbinfo->listhead;
|
head = pcbinfo->listhead;
|
||||||
INP_INFO_WLOCK(pcbinfo);
|
INP_INFO_WLOCK(pcbinfo);
|
||||||
for (inp = LIST_FIRST(head); inp != NULL; inp = ninp) {
|
for (inp = LIST_FIRST(head); inp != NULL; inp = ninp) {
|
||||||
@ -714,7 +703,6 @@ in6_pcbnotify(pcbinfo, dst, fport_arg, src, lport_arg, cmd, cmdarg, notify)
|
|||||||
INP_UNLOCK(inp);
|
INP_UNLOCK(inp);
|
||||||
}
|
}
|
||||||
INP_INFO_WUNLOCK(pcbinfo);
|
INP_INFO_WUNLOCK(pcbinfo);
|
||||||
splx(s);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user