Initial import from FreeBSD RELENG_4:
[dragonfly.git] / contrib / ipfilter / FreeBSD / ip_input.c.diffs
1 *** /sys/netinet/ip_input.c.orig        Thu Oct 24 22:27:27 1996
2 --- /sys/netinet/ip_input.c     Tue Feb 18 21:18:19 1997
3 ***************
4 *** 93,98 ****
5 --- 93,102 ----
6   int   ipqmaxlen = IFQ_MAXLEN;
7   struct        in_ifaddr *in_ifaddr;                   /* first inet address */
8   struct        ifqueue ipintrq;
9 + #if defined(IPFILTER_LKM) || defined(IPFILTER)
10 + int   fr_check __P((struct ip *, int, struct ifnet *, int, struct mbuf **));
11 + int   (*fr_checkp) __P((struct ip *, int, struct ifnet *, int, struct mbuf **));
12 + #endif
13   
14   struct ipstat ipstat;
15   struct ipq ipq;
16 ***************
17 *** 219,226 ****
18                 }
19                 ip = mtod(m, struct ip *);
20         }
21 !       ip->ip_sum = in_cksum(m, hlen);
22 !       if (ip->ip_sum) {
23                 ipstat.ips_badsum++;
24                 goto bad;
25         }
26 --- 223,229 ----
27                 }
28                 ip = mtod(m, struct ip *);
29         }
30 !       if (in_cksum(m, hlen)) {
31                 ipstat.ips_badsum++;
32                 goto bad;
33         }
34 ***************
35 *** 267,272 ****
36 --- 270,288 ----
37                goto next;
38         }
39   
40 + #if defined(IPFILTER) || defined(IPFILTER_LKM)
41 +       /*
42 +        * Check if we want to allow this packet to be processed.
43 +        * Consider it to be bad if not.
44 +        */
45 +       if (fr_checkp) {
46 +               struct  mbuf    *m1 = m;
47
48 +               if ((*fr_checkp)(ip, hlen, m->m_pkthdr.rcvif, 0, &m1) || !m1)
49 +                       goto next;
50 +               ip = mtod(m = m1, struct ip *);
51 +       }
52 + #endif
53         /*
54          * Process options and, if not destined for us,
55          * ship it on.  ip_dooptions returns 1 when an
56 ***************
57 *** 527,532 ****
58 --- 533,540 ----
59        * if they are completely covered, dequeue them.
60        */
61       while (q != (struct ipasfrag *)fp && ip->ip_off + ip->ip_len > q->ip_off) {
62 +             struct mbuf *m0;
63
64               i = (ip->ip_off + ip->ip_len) - q->ip_off;
65               if (i < q->ip_len) {
66                       q->ip_len -= i;
67 ***************
68 *** 526,534 ****
69                         m_adj(dtom(q), i);
70                         break;
71                 }
72                 q = q->ipf_next;
73 -               m_freem(dtom(q->ipf_prev));
74                 ip_deq(q->ipf_prev);
75         }
76   
77   insert:
78 --- 542,551 ----
79                         m_adj(dtom(q), i);
80                         break;
81                 }
82 +               m0 = dtom(q);
83                 q = q->ipf_next;
84                 ip_deq(q->ipf_prev);
85 +               m_freem(m0);
86         }
87   
88   insert: