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 --- 16 unchanged lines hidden (view full) --- 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 * @(#)ip_input.c 8.2 (Berkeley) 1/4/94 30 */ 31 32#include <sys/cdefs.h> |
33__FBSDID("$FreeBSD: head/sys/netinet/ip_input.c 254889 2013-08-25 21:54:41Z markj $"); |
34 35#include "opt_bootp.h" 36#include "opt_ipfw.h" 37#include "opt_ipstealth.h" 38#include "opt_ipsec.h" |
39#include "opt_kdtrace.h" |
40#include "opt_route.h" 41 42#include <sys/param.h> 43#include <sys/systm.h> 44#include <sys/mbuf.h> 45#include <sys/malloc.h> 46#include <sys/domain.h> 47#include <sys/protosw.h> 48#include <sys/socket.h> 49#include <sys/time.h> 50#include <sys/kernel.h> 51#include <sys/lock.h> 52#include <sys/rwlock.h> |
53#include <sys/sdt.h> |
54#include <sys/syslog.h> 55#include <sys/sysctl.h> 56 57#include <net/pfil.h> 58#include <net/if.h> 59#include <net/if_types.h> 60#include <net/if_var.h> 61#include <net/if_dl.h> 62#include <net/route.h> 63#include <net/netisr.h> 64#include <net/vnet.h> 65#include <net/flowtable.h> 66 67#include <netinet/in.h> |
68#include <netinet/in_kdtrace.h> |
69#include <netinet/in_systm.h> 70#include <netinet/in_var.h> 71#include <netinet/ip.h> 72#include <netinet/in_pcb.h> 73#include <netinet/ip_var.h> 74#include <netinet/ip_fw.h> 75#include <netinet/ip_icmp.h> 76#include <netinet/ip_options.h> --- 350 unchanged lines hidden (view full) --- 427 if (hlen > m->m_len) { 428 if ((m = m_pullup(m, hlen)) == NULL) { 429 IPSTAT_INC(ips_badhlen); 430 return; 431 } 432 ip = mtod(m, struct ip *); 433 } 434 |
435 IP_PROBE(receive, NULL, NULL, ip, m->m_pkthdr.rcvif, ip, NULL); 436 |
437 /* 127/8 must not appear on wire - RFC1122 */ 438 ifp = m->m_pkthdr.rcvif; 439 if ((ntohl(ip->ip_dst.s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET || 440 (ntohl(ip->ip_src.s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET) { 441 if ((ifp->if_flags & IFF_LOOPBACK) == 0) { 442 IPSTAT_INC(ips_badaddr); 443 goto bad; 444 } --- 1324 unchanged lines hidden --- |