Deleted Added
sdiff udiff text old ( 54952 ) new ( 55009 )
full compact
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

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

55 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
56 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
57 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
58 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
59 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
60 * SUCH DAMAGE.
61 *
62 * @(#)udp_var.h 8.1 (Berkeley) 6/10/93
63 * $FreeBSD: head/sys/netinet6/udp6_usrreq.c 54952 1999-12-21 11:14:12Z eivind $
64 */
65
66#include <sys/param.h>
67#include <sys/kernel.h>
68#include <sys/malloc.h>
69#include <sys/mbuf.h>
70#include <sys/protosw.h>
71#include <sys/socket.h>
72#include <sys/socketvar.h>
73#include <sys/sysctl.h>

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

93#include <netinet6/ip6_var.h>
94#include <netinet6/in6_pcb.h>
95#include <netinet6/icmp6.h>
96#include <netinet6/udp6_var.h>
97#include <netinet6/ip6protosw.h>
98
99#ifdef IPSEC
100#include <netinet6/ipsec.h>
101#endif /*IPSEC*/
102
103#include "faith.h"
104
105/*
106 * UDP protocol inplementation.
107 * Per RFC 768, August, 1980.
108 */

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

246
247 if (last != NULL) {
248 struct mbuf *n;
249
250#ifdef IPSEC
251 /*
252 * Check AH/ESP integrity.
253 */
254 if (last != NULL &&
255 ipsec6_in_reject_so(m, last->inp_socket)) {
256 ipsec6stat.in_polvio++;
257 /* do not inject data into pcb */
258 } else
259#endif /*IPSEC*/
260 if ((n = m_copy(m, 0, M_COPYALL)) != NULL) {
261 /*
262 * KAME NOTE: do not
263 * m_copy(m, offset, ...) above.
264 * sbappendaddr() expects M_PKTHDR,
265 * and m_copy() will copy M_PKTHDR
266 * only if offset is 0.

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

305 udpstat.udps_noport++;
306 udpstat.udps_noportmcast++;
307 goto bad;
308 }
309#ifdef IPSEC
310 /*
311 * Check AH/ESP integrity.
312 */
313 if (last != NULL && ipsec6_in_reject_so(m, last->inp_socket)) {
314 ipsec6stat.in_polvio++;
315 goto bad;
316 }
317#endif /*IPSEC*/
318 if (last->in6p_flags & IN6P_CONTROLOPTS
319 || last->in6p_socket->so_options & SO_TIMESTAMP)
320 ip6_savecontrol(last, &opts, ip6, m);
321

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

353 }
354 icmp6_error(m, ICMP6_DST_UNREACH, ICMP6_DST_UNREACH_NOPORT, 0);
355 return IPPROTO_DONE;
356 }
357#ifdef IPSEC
358 /*
359 * Check AH/ESP integrity.
360 */
361 if (in6p != NULL && ipsec6_in_reject_so(m, in6p->in6p_socket)) {
362 ipsec6stat.in_polvio++;
363 goto bad;
364 }
365#endif /*IPSEC*/
366
367 /*
368 * Construct sockaddr format source address.
369 * Stuff source address and datagram in user buffer.

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

470 error = SYSCTL_IN(req, addrs, sizeof(addrs));
471 if (error)
472 return (error);
473 s = splnet();
474 inp = in6_pcblookup_hash(&udbinfo, &addrs[1].sin6_addr,
475 addrs[1].sin6_port,
476 &addrs[0].sin6_addr, addrs[0].sin6_port,
477 1, NULL);
478 if (!inp || !inp->inp_socket || !inp->inp_socket->so_cred) {
479 error = ENOENT;
480 goto out;
481 }
482 error = SYSCTL_OUT(req, inp->inp_socket->so_cred,
483 sizeof(struct ucred));
484
485out:
486 splx(s);

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

551 splx(s);
552 goto release;
553 }
554
555 /*
556 * Stuff checksum and output datagram.
557 */
558 ip6 = mtod(m, struct ip6_hdr *);
559 ip6->ip6_flow = in6p->in6p_flowinfo & IPV6_FLOWINFO_MASK;
560 ip6->ip6_vfc = IPV6_VERSION;
561 /* ip6_plen will be filled in ip6_output. */
562 ip6->ip6_nxt = IPPROTO_UDP;
563 ip6->ip6_hlim = in6_selecthlim(in6p,
564 in6p->in6p_route.ro_rt ?
565 in6p->in6p_route.ro_rt->rt_ifp :
566 NULL);
567 ip6->ip6_src = in6p->in6p_laddr;
568 ip6->ip6_dst = in6p->in6p_faddr;

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

579 }
580
581 udpstat.udps_opackets++;
582
583#ifdef IPSEC
584 m->m_pkthdr.rcvif = (struct ifnet *)in6p->in6p_socket;
585#endif /*IPSEC*/
586 error = ip6_output(m, in6p->in6p_outputopts, &in6p->in6p_route,
587 0, in6p->in6p_moptions, NULL);
588
589 if (addr6) {
590 in6_pcbdisconnect(in6p);
591 in6p->in6p_laddr = laddr6;
592 splx(s);
593 }
594 goto releaseopt;
595

--- 241 unchanged lines hidden ---