Deleted Added
sdiff udiff text old ( 122334 ) new ( 122702 )
full compact
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 * @(#)ip_input.c 8.2 (Berkeley) 1/4/94
34 * $FreeBSD: head/sys/netinet/ip_input.c 122334 2003-11-08 23:36:32Z sam $
35 */
36
37#include "opt_bootp.h"
38#include "opt_ipfw.h"
39#include "opt_ipdn.h"
40#include "opt_ipdivert.h"
41#include "opt_ipfilter.h"
42#include "opt_ipstealth.h"

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

355
356/*
357 * Ip input routine. Checksum and byte swap header. If fragmented
358 * try to reassemble. Process options. Pass to next level.
359 */
360void
361ip_input(struct mbuf *m)
362{
363 struct ip *ip;
364 struct ipq *fp;
365 struct in_ifaddr *ia = NULL;
366 struct ifaddr *ifa;
367 int i, hlen, checkif;
368 u_short sum;
369 struct in_addr pkt_dst;
370 u_int32_t divert_info = 0; /* packet divert/tee info */
371 struct ip_fw_args args;
372 struct route cro; /* copy of cached route */
373 int srcrt = 0; /* forward by ``src routing'' */
374#ifdef PFIL_HOOKS
375 struct in_addr odst; /* original dst address */

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

382#endif /* FAST_IPSEC */
383
384 args.eh = NULL;
385 args.oif = NULL;
386 args.rule = NULL;
387 args.divert_rule = 0; /* divert cookie */
388 args.next_hop = NULL;
389
390 /* Grab info from MT_TAG mbufs prepended to the chain. */
391 for (; m && m->m_type == MT_TAG; m = m->m_next) {
392 switch(m->_m_tag_id) {
393 default:
394 printf("ip_input: unrecognised MT_TAG tag %d\n",
395 m->_m_tag_id);
396 break;
397
398 case PACKET_TAG_DUMMYNET:
399 args.rule = ((struct dn_pkt *)m)->rule;
400 break;
401
402 case PACKET_TAG_DIVERT:
403 args.divert_rule = (intptr_t)m->m_hdr.mh_data & 0xffff;
404 break;
405
406 case PACKET_TAG_IPFORWARD:
407 args.next_hop = (struct sockaddr_in *)m->m_hdr.mh_data;
408 break;
409 }
410 }
411
412 M_ASSERTPKTHDR(m);
413
414 if (args.rule) { /* dummynet already filtered us */
415 ip = mtod(m, struct ip *);
416 hlen = ip->ip_hl << 2;
417 goto iphack ;
418 }
419
420 ipstat.ips_total++;
421

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

1345 while (nipq > maxnipq && !TAILQ_EMPTY(&ipq[i])) {
1346 ipstat.ips_fragdropped +=
1347 TAILQ_FIRST(&ipq[i])->ipq_nfrags;
1348 ip_freef(&ipq[i], TAILQ_FIRST(&ipq[i]));
1349 }
1350 }
1351 }
1352 IPQ_UNLOCK();
1353 ipflow_slowtimo();
1354 splx(s);
1355}
1356
1357/*
1358 * Drain off all datagram fragments.
1359 */
1360void
1361ip_drain()

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

1975 RTCACHE_UPDATE(ro);
1976 if (error)
1977 ipstat.ips_cantforward++;
1978 else {
1979 ipstat.ips_forward++;
1980 if (type)
1981 ipstat.ips_redirectsent++;
1982 else {
1983 if (mcopy) {
1984 ipflow_create(ro, mcopy);
1985 m_freem(mcopy);
1986 }
1987 return;
1988 }
1989 }
1990 if (mcopy == NULL)
1991 return;
1992 destifp = NULL;
1993
1994 switch (error) {

--- 307 unchanged lines hidden ---