diff options
| author | Robert Watson <rwatson@FreeBSD.org> | 2010-06-03 09:02:53 +0000 |
|---|---|---|
| committer | Robert Watson <rwatson@FreeBSD.org> | 2010-06-03 09:02:53 +0000 |
| commit | 4b33228640da9deb51db93bb8e1e2c7f06ec33af (patch) | |
| tree | 9caf8fa9de5269e3e46a872af77860dd2a23d2b3 /sys/netinet/udp_usrreq.c | |
| parent | c00cb785e5254f63a91e8c24c119ada3e1110c26 (diff) | |
Notes
Diffstat (limited to 'sys/netinet/udp_usrreq.c')
| -rw-r--r-- | sys/netinet/udp_usrreq.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 505b09bdecb6..c89a3b4122bb 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -1439,7 +1439,7 @@ udp_attach(struct socket *so, int proto, struct thread *td) return (error); } - inp = (struct inpcb *)so->so_pcb; + inp = sotoinpcb(so); inp->inp_vflag |= INP_IPV4; inp->inp_ip_ttl = V_ip_defttl; @@ -1462,17 +1462,10 @@ udp_set_kernel_tunneling(struct socket *so, udp_tun_func_t f) struct inpcb *inp; struct udpcb *up; - KASSERT(so->so_type == SOCK_DGRAM, ("udp_set_kernel_tunneling: !dgram")); - KASSERT(so->so_pcb != NULL, ("udp_set_kernel_tunneling: NULL inp")); - if (so->so_type != SOCK_DGRAM) { - /* Not UDP socket... sorry! */ - return (ENOTSUP); - } - inp = (struct inpcb *)so->so_pcb; - if (inp == NULL) { - /* NULL INP? */ - return (EINVAL); - } + KASSERT(so->so_type == SOCK_DGRAM, + ("udp_set_kernel_tunneling: !dgram")); + inp = sotoinpcb(so); + KASSERT(inp != NULL, ("udp_set_kernel_tunneling: inp == NULL")); INP_WLOCK(inp); up = intoudpcb(inp); if (up->u_tun_func != NULL) { |
