Deleted Added
full compact
raw_ip.c (167739) raw_ip.c (169154)
1/*-
2 * Copyright (c) 1982, 1986, 1988, 1993
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 * @(#)raw_ip.c 8.7 (Berkeley) 5/15/95
1/*-
2 * Copyright (c) 1982, 1986, 1988, 1993
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 * @(#)raw_ip.c 8.7 (Berkeley) 5/15/95
30 * $FreeBSD: head/sys/netinet/raw_ip.c 167739 2007-03-20 13:15:20Z bms $
30 * $FreeBSD: head/sys/netinet/raw_ip.c 169154 2007-04-30 23:12:05Z rwatson $
31 */
32
33#include "opt_inet6.h"
34#include "opt_ipsec.h"
35#include "opt_mac.h"
36
37#include <sys/param.h>
38#include <sys/jail.h>

--- 89 unchanged lines hidden (view full) ---

128 return (0);
129}
130
131void
132rip_init()
133{
134 INP_INFO_LOCK_INIT(&ripcbinfo, "rip");
135 LIST_INIT(&ripcb);
31 */
32
33#include "opt_inet6.h"
34#include "opt_ipsec.h"
35#include "opt_mac.h"
36
37#include <sys/param.h>
38#include <sys/jail.h>

--- 89 unchanged lines hidden (view full) ---

128 return (0);
129}
130
131void
132rip_init()
133{
134 INP_INFO_LOCK_INIT(&ripcbinfo, "rip");
135 LIST_INIT(&ripcb);
136 ripcbinfo.listhead = &ripcb;
136 ripcbinfo.ipi_listhead = &ripcb;
137 /*
138 * XXX We don't use the hash list for raw IP, but it's easier
139 * to allocate a one entry hash list than it is to check all
140 * over the place for hashbase == NULL.
141 */
137 /*
138 * XXX We don't use the hash list for raw IP, but it's easier
139 * to allocate a one entry hash list than it is to check all
140 * over the place for hashbase == NULL.
141 */
142 ripcbinfo.hashbase = hashinit(1, M_PCB, &ripcbinfo.hashmask);
143 ripcbinfo.porthashbase = hashinit(1, M_PCB, &ripcbinfo.porthashmask);
142 ripcbinfo.ipi_hashbase = hashinit(1, M_PCB, &ripcbinfo.ipi_hashmask);
143 ripcbinfo.ipi_porthashbase = hashinit(1, M_PCB,
144 &ripcbinfo.ipi_porthashmask);
144 ripcbinfo.ipi_zone = uma_zcreate("ripcb", sizeof(struct inpcb),
145 NULL, NULL, rip_inpcb_init, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
146 uma_zone_set_max(ripcbinfo.ipi_zone, maxsockets);
147 EVENTHANDLER_REGISTER(maxsockets_change, rip_zone_change,
148 NULL, EVENTHANDLER_PRI_ANY);
149}
150
151static struct sockaddr_in ripsrc = { sizeof(ripsrc), AF_INET };

--- 701 unchanged lines hidden (view full) ---

853 if (error)
854 return error;
855
856 inp_list = malloc(n * sizeof *inp_list, M_TEMP, M_WAITOK);
857 if (inp_list == 0)
858 return ENOMEM;
859
860 INP_INFO_RLOCK(&ripcbinfo);
145 ripcbinfo.ipi_zone = uma_zcreate("ripcb", sizeof(struct inpcb),
146 NULL, NULL, rip_inpcb_init, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
147 uma_zone_set_max(ripcbinfo.ipi_zone, maxsockets);
148 EVENTHANDLER_REGISTER(maxsockets_change, rip_zone_change,
149 NULL, EVENTHANDLER_PRI_ANY);
150}
151
152static struct sockaddr_in ripsrc = { sizeof(ripsrc), AF_INET };

--- 701 unchanged lines hidden (view full) ---

854 if (error)
855 return error;
856
857 inp_list = malloc(n * sizeof *inp_list, M_TEMP, M_WAITOK);
858 if (inp_list == 0)
859 return ENOMEM;
860
861 INP_INFO_RLOCK(&ripcbinfo);
861 for (inp = LIST_FIRST(ripcbinfo.listhead), i = 0; inp && i < n;
862 for (inp = LIST_FIRST(ripcbinfo.ipi_listhead), i = 0; inp && i < n;
862 inp = LIST_NEXT(inp, inp_list)) {
863 INP_LOCK(inp);
864 if (inp->inp_gencnt <= gencnt &&
865 cr_canseesocket(req->td->td_ucred, inp->inp_socket) == 0) {
866 /* XXX held references? */
867 inp_list[i++] = inp;
868 }
869 INP_UNLOCK(inp);

--- 79 unchanged lines hidden ---
863 inp = LIST_NEXT(inp, inp_list)) {
864 INP_LOCK(inp);
865 if (inp->inp_gencnt <= gencnt &&
866 cr_canseesocket(req->td->td_ucred, inp->inp_socket) == 0) {
867 /* XXX held references? */
868 inp_list[i++] = inp;
869 }
870 INP_UNLOCK(inp);

--- 79 unchanged lines hidden ---