Deleted Added
full compact
raw_ip6.c (54263) raw_ip6.c (55009)
1/*
2 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
3 * 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

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

21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
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 *
1/*
2 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
3 * 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

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

21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
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 * $FreeBSD: head/sys/netinet6/raw_ip6.c 54263 1999-12-07 17:39:16Z shin $
29 * $FreeBSD: head/sys/netinet6/raw_ip6.c 55009 1999-12-22 19:13:38Z shin $
30 */
31
32/*
33 * Copyright (c) 1982, 1986, 1988, 1993
34 * The Regents of the University of California. All rights reserved.
35 *
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions

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

59 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
60 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
61 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
62 * SUCH DAMAGE.
63 *
64 * @(#)raw_ip.c 8.2 (Berkeley) 1/4/94
65 */
66
30 */
31
32/*
33 * Copyright (c) 1982, 1986, 1988, 1993
34 * The Regents of the University of California. All rights reserved.
35 *
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions

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

59 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
60 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
61 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
62 * SUCH DAMAGE.
63 *
64 * @(#)raw_ip.c 8.2 (Berkeley) 1/4/94
65 */
66
67#include "opt_ipsec.h"
68
67#include <stddef.h>
68
69#include <sys/param.h>
70#include <sys/malloc.h>
71#include <sys/proc.h>
72#include <sys/mbuf.h>
73#include <sys/socket.h>
74#include <sys/protosw.h>

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

135 m_freem(m);
136 return IPPROTO_DONE;
137 }
138 }
139#endif
140 init_sin6(&rip6src, m); /* general init */
141
142 LIST_FOREACH(in6p, &ripcb, inp_list) {
69#include <stddef.h>
70
71#include <sys/param.h>
72#include <sys/malloc.h>
73#include <sys/proc.h>
74#include <sys/mbuf.h>
75#include <sys/socket.h>
76#include <sys/protosw.h>

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

137 m_freem(m);
138 return IPPROTO_DONE;
139 }
140 }
141#endif
142 init_sin6(&rip6src, m); /* general init */
143
144 LIST_FOREACH(in6p, &ripcb, inp_list) {
143 if ((in6p->in6p_vflag & INP_IPV6) == NULL)
145 if ((in6p->in6p_vflag & INP_IPV6) == 0)
144 continue;
145 if (in6p->in6p_ip6_nxt &&
146 in6p->in6p_ip6_nxt != proto)
147 continue;
148 if (!IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_laddr) &&
149 !IN6_ARE_ADDR_EQUAL(&in6p->in6p_laddr, &ip6->ip6_dst))
150 continue;
151 if (!IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_faddr) &&

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

323 if (error == 0)
324 error = EADDRNOTAVAIL;
325 goto bad;
326 }
327 ip6->ip6_src = *in6a;
328 if (in6p->in6p_route.ro_rt)
329 oifp = ifindex2ifnet[in6p->in6p_route.ro_rt->rt_ifp->if_index];
330 }
146 continue;
147 if (in6p->in6p_ip6_nxt &&
148 in6p->in6p_ip6_nxt != proto)
149 continue;
150 if (!IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_laddr) &&
151 !IN6_ARE_ADDR_EQUAL(&in6p->in6p_laddr, &ip6->ip6_dst))
152 continue;
153 if (!IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_faddr) &&

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

325 if (error == 0)
326 error = EADDRNOTAVAIL;
327 goto bad;
328 }
329 ip6->ip6_src = *in6a;
330 if (in6p->in6p_route.ro_rt)
331 oifp = ifindex2ifnet[in6p->in6p_route.ro_rt->rt_ifp->if_index];
332 }
331
332 ip6->ip6_flow = in6p->in6p_flowinfo & IPV6_FLOWINFO_MASK;
333 ip6->ip6_vfc = IPV6_VERSION;
333 ip6->ip6_flow = (ip6->ip6_flow & ~IPV6_FLOWINFO_MASK) |
334 (in6p->in6p_flowinfo & IPV6_FLOWINFO_MASK);
335 ip6->ip6_vfc = (ip6->ip6_vfc & ~IPV6_VERSION_MASK) |
336 (IPV6_VERSION & IPV6_VERSION_MASK);
334 /* ip6_plen will be filled in ip6_output, so not fill it here. */
335 ip6->ip6_nxt = in6p->in6p_ip6_nxt;
336 ip6->ip6_hlim = in6_selecthlim(in6p, oifp);
337
338 if (so->so_proto->pr_protocol == IPPROTO_ICMPV6 ||
339 in6p->in6p_cksum != -1) {
340 struct mbuf *n;
341 int off;

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

365 *p = 0;
366 *p = in6_cksum(m, ip6->ip6_nxt, sizeof(*ip6), plen);
367 }
368
369#ifdef IPSEC
370 m->m_pkthdr.rcvif = (struct ifnet *)so;
371#endif /*IPSEC*/
372
337 /* ip6_plen will be filled in ip6_output, so not fill it here. */
338 ip6->ip6_nxt = in6p->in6p_ip6_nxt;
339 ip6->ip6_hlim = in6_selecthlim(in6p, oifp);
340
341 if (so->so_proto->pr_protocol == IPPROTO_ICMPV6 ||
342 in6p->in6p_cksum != -1) {
343 struct mbuf *n;
344 int off;

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

368 *p = 0;
369 *p = in6_cksum(m, ip6->ip6_nxt, sizeof(*ip6), plen);
370 }
371
372#ifdef IPSEC
373 m->m_pkthdr.rcvif = (struct ifnet *)so;
374#endif /*IPSEC*/
375
373 error = ip6_output(m, optp, &in6p->in6p_route, 0, in6p->in6p_moptions,
374 &oifp);
376 error = ip6_output(m, optp, &in6p->in6p_route, IPV6_SOCKINMRCVIF,
377 in6p->in6p_moptions, &oifp);
375 if (so->so_proto->pr_protocol == IPPROTO_ICMPV6) {
376 if (oifp)
377 icmp6_ifoutstat_inc(oifp, type, code);
378 icmp6stat.icp6s_outhist[type]++;
379 }
380
381 goto freectl;
382

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

441 int error, s;
442
443 inp = sotoinpcb(so);
444 if (inp)
445 panic("rip6_attach");
446 if (p && (error = suser(p)) != 0)
447 return error;
448
378 if (so->so_proto->pr_protocol == IPPROTO_ICMPV6) {
379 if (oifp)
380 icmp6_ifoutstat_inc(oifp, type, code);
381 icmp6stat.icp6s_outhist[type]++;
382 }
383
384 goto freectl;
385

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

444 int error, s;
445
446 inp = sotoinpcb(so);
447 if (inp)
448 panic("rip6_attach");
449 if (p && (error = suser(p)) != 0)
450 return error;
451
449 if (so->so_snd.sb_hiwat == 0 || so->so_rcv.sb_hiwat == 0) {
450 error = soreserve(so, rip_sendspace, rip_recvspace);
451 if (error)
452 return error;
453 }
452 error = soreserve(so, rip_sendspace, rip_recvspace);
453 if (error)
454 return error;
454 s = splnet();
455 error = in_pcballoc(so, &ripcbinfo, p);
456 splx(s);
457 if (error)
458 return error;
459 inp = (struct inpcb *)so->so_pcb;
460 inp->inp_vflag |= INP_IPV6;
461 inp->in6p_ip6_nxt = (long)proto;

--- 146 unchanged lines hidden ---
455 s = splnet();
456 error = in_pcballoc(so, &ripcbinfo, p);
457 splx(s);
458 if (error)
459 return error;
460 inp = (struct inpcb *)so->so_pcb;
461 inp->inp_vflag |= INP_IPV6;
462 inp->in6p_ip6_nxt = (long)proto;

--- 146 unchanged lines hidden ---