in_pcb.c (163606) | in_pcb.c (164033) |
---|---|
1/*- 2 * Copyright (c) 1982, 1986, 1991, 1993, 1995 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * @(#)in_pcb.c 8.4 (Berkeley) 5/24/95 | 1/*- 2 * Copyright (c) 1982, 1986, 1991, 1993, 1995 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * @(#)in_pcb.c 8.4 (Berkeley) 5/24/95 |
30 * $FreeBSD: head/sys/netinet/in_pcb.c 163606 2006-10-22 11:52:19Z rwatson $ | 30 * $FreeBSD: head/sys/netinet/in_pcb.c 164033 2006-11-06 13:42:10Z rwatson $ |
31 */ 32 33#include "opt_ipsec.h" 34#include "opt_inet6.h" 35#include "opt_mac.h" 36 37#include <sys/param.h> 38#include <sys/systm.h> 39#include <sys/malloc.h> 40#include <sys/mbuf.h> 41#include <sys/domain.h> 42#include <sys/protosw.h> 43#include <sys/socket.h> 44#include <sys/socketvar.h> | 31 */ 32 33#include "opt_ipsec.h" 34#include "opt_inet6.h" 35#include "opt_mac.h" 36 37#include <sys/param.h> 38#include <sys/systm.h> 39#include <sys/malloc.h> 40#include <sys/mbuf.h> 41#include <sys/domain.h> 42#include <sys/protosw.h> 43#include <sys/socket.h> 44#include <sys/socketvar.h> |
45#include <sys/priv.h> |
|
45#include <sys/proc.h> 46#include <sys/jail.h> 47#include <sys/kernel.h> 48#include <sys/sysctl.h> 49 50#include <vm/uma.h> 51 52#include <net/if.h> --- 273 unchanged lines hidden (view full) --- 326 laddr = sin->sin_addr; 327 if (lport) { 328 struct inpcb *t; 329 struct tcptw *tw; 330 331 /* GROSS */ 332 if (ntohs(lport) <= ipport_reservedhigh && 333 ntohs(lport) >= ipport_reservedlow && | 46#include <sys/proc.h> 47#include <sys/jail.h> 48#include <sys/kernel.h> 49#include <sys/sysctl.h> 50 51#include <vm/uma.h> 52 53#include <net/if.h> --- 273 unchanged lines hidden (view full) --- 327 laddr = sin->sin_addr; 328 if (lport) { 329 struct inpcb *t; 330 struct tcptw *tw; 331 332 /* GROSS */ 333 if (ntohs(lport) <= ipport_reservedhigh && 334 ntohs(lport) >= ipport_reservedlow && |
334 suser_cred(cred, SUSER_ALLOWJAIL)) | 335 priv_check_cred(cred, PRIV_NETINET_RESERVEDPORT, 336 SUSER_ALLOWJAIL)) |
335 return (EACCES); 336 if (jailed(cred)) 337 prison = 1; 338 if (!IN_MULTICAST(ntohl(sin->sin_addr.s_addr)) && 339 suser_cred(so->so_cred, SUSER_ALLOWJAIL) != 0) { 340 t = in_pcblookup_local(inp->inp_pcbinfo, 341 sin->sin_addr, lport, 342 prison ? 0 : INPLOOKUP_WILDCARD); --- 52 unchanged lines hidden (view full) --- 395 if (prison_ip(cred, 0, &laddr.s_addr)) 396 return (EINVAL); 397 398 if (inp->inp_flags & INP_HIGHPORT) { 399 first = ipport_hifirstauto; /* sysctl */ 400 last = ipport_hilastauto; 401 lastport = &pcbinfo->lasthi; 402 } else if (inp->inp_flags & INP_LOWPORT) { | 337 return (EACCES); 338 if (jailed(cred)) 339 prison = 1; 340 if (!IN_MULTICAST(ntohl(sin->sin_addr.s_addr)) && 341 suser_cred(so->so_cred, SUSER_ALLOWJAIL) != 0) { 342 t = in_pcblookup_local(inp->inp_pcbinfo, 343 sin->sin_addr, lport, 344 prison ? 0 : INPLOOKUP_WILDCARD); --- 52 unchanged lines hidden (view full) --- 397 if (prison_ip(cred, 0, &laddr.s_addr)) 398 return (EINVAL); 399 400 if (inp->inp_flags & INP_HIGHPORT) { 401 first = ipport_hifirstauto; /* sysctl */ 402 last = ipport_hilastauto; 403 lastport = &pcbinfo->lasthi; 404 } else if (inp->inp_flags & INP_LOWPORT) { |
403 if ((error = suser_cred(cred, SUSER_ALLOWJAIL)) != 0) | 405 error = priv_check_cred(cred, 406 PRIV_NETINET_RESERVEDPORT, SUSER_ALLOWJAIL); 407 if (error) |
404 return error; 405 first = ipport_lowfirstauto; /* 1023 */ 406 last = ipport_lowlastauto; /* 600 */ 407 lastport = &pcbinfo->lastlow; 408 } else { 409 first = ipport_firstauto; /* sysctl */ 410 last = ipport_lastauto; 411 lastport = &pcbinfo->lastport; --- 822 unchanged lines hidden --- | 408 return error; 409 first = ipport_lowfirstauto; /* 1023 */ 410 last = ipport_lowlastauto; /* 600 */ 411 lastport = &pcbinfo->lastlow; 412 } else { 413 first = ipport_firstauto; /* sysctl */ 414 last = ipport_lastauto; 415 lastport = &pcbinfo->lastport; --- 822 unchanged lines hidden --- |