1/*- 2 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 3 * Copyright (c) 2010-2011 Juniper Networks, Inc. 4 * All rights reserved. 5 * 6 * Portions of this software were developed by Robert N. M. Watson under 7 * contract to Juniper Networks, Inc. 8 * --- 53 unchanged lines hidden (view full) --- 62 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 63 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 64 * SUCH DAMAGE. 65 * 66 * @(#)udp_usrreq.c 8.6 (Berkeley) 5/23/95 67 */ 68 69#include <sys/cdefs.h> |
70__FBSDID("$FreeBSD: head/sys/netinet6/udp6_usrreq.c 254889 2013-08-25 21:54:41Z markj $"); |
71 72#include "opt_inet.h" 73#include "opt_inet6.h" 74#include "opt_ipfw.h" 75#include "opt_ipsec.h" |
76#include "opt_kdtrace.h" |
77 78#include <sys/param.h> 79#include <sys/jail.h> 80#include <sys/kernel.h> 81#include <sys/lock.h> 82#include <sys/mbuf.h> 83#include <sys/priv.h> 84#include <sys/proc.h> 85#include <sys/protosw.h> |
86#include <sys/sdt.h> |
87#include <sys/signalvar.h> 88#include <sys/socket.h> 89#include <sys/socketvar.h> 90#include <sys/sx.h> 91#include <sys/sysctl.h> 92#include <sys/syslog.h> 93#include <sys/systm.h> 94 95#include <net/if.h> 96#include <net/if_types.h> 97#include <net/route.h> 98 99#include <netinet/in.h> |
100#include <netinet/in_kdtrace.h> |
101#include <netinet/in_pcb.h> 102#include <netinet/in_systm.h> 103#include <netinet/in_var.h> 104#include <netinet/ip.h> 105#include <netinet/ip_icmp.h> 106#include <netinet/ip6.h> 107#include <netinet/icmp_var.h> 108#include <netinet/icmp6.h> --- 266 unchanged lines hidden (view full) --- 375 */ 376 UDPSTAT_INC(udps_noport); 377 UDPSTAT_INC(udps_noportmcast); 378 goto badheadlocked; 379 } 380 INP_RLOCK(last); 381 INP_INFO_RUNLOCK(&V_udbinfo); 382 up = intoudpcb(last); |
383 UDP_PROBE(receive, NULL, last, ip6, last, uh); |
384 if (up->u_tun_func == NULL) { 385 udp6_append(last, m, off, &fromsa); 386 } else { 387 /* 388 * Engage the tunneling protocol. 389 */ 390 (*up->u_tun_func)(m, off, last); 391 } --- 62 unchanged lines hidden (view full) --- 454 goto badunlocked; 455 if (badport_bandlim(BANDLIM_ICMP6_UNREACH) < 0) 456 goto badunlocked; 457 icmp6_error(m, ICMP6_DST_UNREACH, ICMP6_DST_UNREACH_NOPORT, 0); 458 return (IPPROTO_DONE); 459 } 460 INP_RLOCK_ASSERT(inp); 461 up = intoudpcb(inp); |
462 UDP_PROBE(receive, NULL, inp, ip6, inp, uh); |
463 if (up->u_tun_func == NULL) { 464 udp6_append(inp, m, off, &fromsa); 465 } else { 466 /* 467 * Engage the tunneling protocol. 468 */ 469 470 (*up->u_tun_func)(m, off, inp); --- 300 unchanged lines hidden (view full) --- 771 udp6->uh_sum = 0; 772 773 switch (af) { 774 case AF_INET6: 775 ip6 = mtod(m, struct ip6_hdr *); 776 ip6->ip6_flow = inp->inp_flow & IPV6_FLOWINFO_MASK; 777 ip6->ip6_vfc &= ~IPV6_VERSION_MASK; 778 ip6->ip6_vfc |= IPV6_VERSION; |
779 ip6->ip6_plen = htons((u_short)plen); |
780 ip6->ip6_nxt = IPPROTO_UDP; 781 ip6->ip6_hlim = in6_selecthlim(inp, NULL); 782 ip6->ip6_src = *laddr; 783 ip6->ip6_dst = *faddr; 784 785 udp6->uh_sum = in6_cksum_pseudo(ip6, plen, IPPROTO_UDP, 0); 786 m->m_pkthdr.csum_flags = CSUM_UDP_IPV6; 787 m->m_pkthdr.csum_data = offsetof(struct udphdr, uh_sum); 788 789 flags = 0; 790 |
791 UDP_PROBE(send, NULL, inp, ip6, inp, udp6); |
792 UDPSTAT_INC(udps_opackets); 793 error = ip6_output(m, optp, NULL, flags, inp->in6p_moptions, 794 NULL, inp); 795 break; 796 case AF_INET: 797 error = EAFNOSUPPORT; 798 goto release; 799 } --- 366 unchanged lines hidden --- |