Deleted Added
full compact
raw_ip.c (109451) raw_ip.c (109623)
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

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

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)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

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

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)raw_ip.c 8.7 (Berkeley) 5/15/95
34 * $FreeBSD: head/sys/netinet/raw_ip.c 109451 2003-01-18 01:10:55Z hsu $
34 * $FreeBSD: head/sys/netinet/raw_ip.c 109623 2003-01-21 08:56:16Z alfred $
35 */
36
37#include "opt_inet6.h"
38#include "opt_ipsec.h"
39#include "opt_mac.h"
40#include "opt_random_ip_id.h"
41
42#include <sys/param.h>

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

282 * If the user handed us a complete IP packet, use it.
283 * Otherwise, allocate an mbuf for a header and fill it in.
284 */
285 if ((inp->inp_flags & INP_HDRINCL) == 0) {
286 if (m->m_pkthdr.len + sizeof(struct ip) > IP_MAXPACKET) {
287 m_freem(m);
288 return(EMSGSIZE);
289 }
35 */
36
37#include "opt_inet6.h"
38#include "opt_ipsec.h"
39#include "opt_mac.h"
40#include "opt_random_ip_id.h"
41
42#include <sys/param.h>

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

282 * If the user handed us a complete IP packet, use it.
283 * Otherwise, allocate an mbuf for a header and fill it in.
284 */
285 if ((inp->inp_flags & INP_HDRINCL) == 0) {
286 if (m->m_pkthdr.len + sizeof(struct ip) > IP_MAXPACKET) {
287 m_freem(m);
288 return(EMSGSIZE);
289 }
290 M_PREPEND(m, sizeof(struct ip), M_TRYWAIT);
290 M_PREPEND(m, sizeof(struct ip), 0);
291 ip = mtod(m, struct ip *);
292 ip->ip_tos = inp->inp_ip_tos;
293 ip->ip_off = 0;
294 ip->ip_p = inp->inp_ip_p;
295 ip->ip_len = m->m_pkthdr.len;
296 ip->ip_src = inp->inp_laddr;
297 ip->ip_dst.s_addr = dst;
298 ip->ip_ttl = inp->inp_ip_ttl;

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

693 xig.xig_len = sizeof xig;
694 xig.xig_count = n;
695 xig.xig_gen = gencnt;
696 xig.xig_sogen = so_gencnt;
697 error = SYSCTL_OUT(req, &xig, sizeof xig);
698 if (error)
699 return error;
700
291 ip = mtod(m, struct ip *);
292 ip->ip_tos = inp->inp_ip_tos;
293 ip->ip_off = 0;
294 ip->ip_p = inp->inp_ip_p;
295 ip->ip_len = m->m_pkthdr.len;
296 ip->ip_src = inp->inp_laddr;
297 ip->ip_dst.s_addr = dst;
298 ip->ip_ttl = inp->inp_ip_ttl;

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

693 xig.xig_len = sizeof xig;
694 xig.xig_count = n;
695 xig.xig_gen = gencnt;
696 xig.xig_sogen = so_gencnt;
697 error = SYSCTL_OUT(req, &xig, sizeof xig);
698 if (error)
699 return error;
700
701 inp_list = malloc(n * sizeof *inp_list, M_TEMP, M_WAITOK);
701 inp_list = malloc(n * sizeof *inp_list, M_TEMP, 0);
702 if (inp_list == 0)
703 return ENOMEM;
704
705 s = splnet();
706 for (inp = LIST_FIRST(ripcbinfo.listhead), i = 0; inp && i < n;
707 inp = LIST_NEXT(inp, inp_list)) {
708 if (inp->inp_gencnt <= gencnt) {
709 if (cr_canseesocket(req->td->td_ucred,

--- 71 unchanged lines hidden ---
702 if (inp_list == 0)
703 return ENOMEM;
704
705 s = splnet();
706 for (inp = LIST_FIRST(ripcbinfo.listhead), i = 0; inp && i < n;
707 inp = LIST_NEXT(inp, inp_list)) {
708 if (inp->inp_gencnt <= gencnt) {
709 if (cr_canseesocket(req->td->td_ucred,

--- 71 unchanged lines hidden ---