Deleted Added
sdiff udiff text old ( 163606 ) new ( 164033 )
full compact
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 $
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/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 &&
334 suser_cred(cred, 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) {
403 if ((error = suser_cred(cred, SUSER_ALLOWJAIL)) != 0)
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 ---