Deleted Added
full compact
ip_fastfwd.c (135920) ip_fastfwd.c (136690)
1/*
2 * Copyright (c) 2003 Andre Oppermann, Internet Business Solutions AG
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

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

21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
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 *
1/*
2 * Copyright (c) 2003 Andre Oppermann, Internet Business Solutions AG
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

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

21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
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 * $FreeBSD: head/sys/netinet/ip_fastfwd.c 135920 2004-09-29 04:54:33Z mlaier $
29 * $FreeBSD: head/sys/netinet/ip_fastfwd.c 136690 2004-10-19 14:31:56Z andre $
30 */
31
32/*
33 * ip_fastforward gets its speed from processing the forwarded packet to
34 * completion (if_output on the other side) without any queues or netisr's.
35 * The receiving interface DMAs the packet into memory, the upper half of
36 * driver calls ip_fastforward, we do our routing table lookup and directly
37 * send it off to the outgoing interface which DMAs the packet to the

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

236 sum = in_cksum_hdr(ip);
237 else
238 sum = in_cksum(m, hlen);
239 }
240 if (sum) {
241 ipstat.ips_badsum++;
242 goto drop;
243 }
30 */
31
32/*
33 * ip_fastforward gets its speed from processing the forwarded packet to
34 * completion (if_output on the other side) without any queues or netisr's.
35 * The receiving interface DMAs the packet into memory, the upper half of
36 * driver calls ip_fastforward, we do our routing table lookup and directly
37 * send it off to the outgoing interface which DMAs the packet to the

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

236 sum = in_cksum_hdr(ip);
237 else
238 sum = in_cksum(m, hlen);
239 }
240 if (sum) {
241 ipstat.ips_badsum++;
242 goto drop;
243 }
244
245 /*
246 * Remeber that we have checked the IP header and found it valid.
247 */
244 m->m_pkthdr.csum_flags |= (CSUM_IP_CHECKED | CSUM_IP_VALID);
245
246 ip_len = ntohs(ip->ip_len);
247
248 /*
249 * Is IP length longer than packet we have got?
250 */
251 if (m->m_pkthdr.len < ip_len) {

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

403 if (!ipstealth) {
404#endif
405 if (ip->ip_ttl <= IPTTLDEC) {
406 icmp_error(m, ICMP_TIMXCEED, ICMP_TIMXCEED_INTRANS, 0, NULL);
407 return 1;
408 }
409
410 /*
248 m->m_pkthdr.csum_flags |= (CSUM_IP_CHECKED | CSUM_IP_VALID);
249
250 ip_len = ntohs(ip->ip_len);
251
252 /*
253 * Is IP length longer than packet we have got?
254 */
255 if (m->m_pkthdr.len < ip_len) {

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

407 if (!ipstealth) {
408#endif
409 if (ip->ip_ttl <= IPTTLDEC) {
410 icmp_error(m, ICMP_TIMXCEED, ICMP_TIMXCEED_INTRANS, 0, NULL);
411 return 1;
412 }
413
414 /*
411 * Decrement the TTL and incrementally change the checksum.
412 * Don't bother doing this with hw checksum offloading.
415 * Decrement the TTL and incrementally change the IP header checksum.
416 * Don't bother doing this with hw checksum offloading, it's faster
417 * doing it right here.
413 */
414 ip->ip_ttl -= IPTTLDEC;
415 if (ip->ip_sum >= (u_int16_t) ~htons(IPTTLDEC << 8))
416 ip->ip_sum -= ~htons(IPTTLDEC << 8);
417 else
418 ip->ip_sum += htons(IPTTLDEC << 8);
419#ifdef IPSTEALTH
420 }

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

457 if (odest.s_addr != dest.s_addr || fwd_tag != NULL) {
458#endif /* IPFIREWALL_FORWARD */
459 /*
460 * Is it now for a local address on this host?
461 */
462#ifndef IPFIREWALL_FORWARD
463 if (in_localip(dest)) {
464#else
418 */
419 ip->ip_ttl -= IPTTLDEC;
420 if (ip->ip_sum >= (u_int16_t) ~htons(IPTTLDEC << 8))
421 ip->ip_sum -= ~htons(IPTTLDEC << 8);
422 else
423 ip->ip_sum += htons(IPTTLDEC << 8);
424#ifdef IPSTEALTH
425 }

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

462 if (odest.s_addr != dest.s_addr || fwd_tag != NULL) {
463#endif /* IPFIREWALL_FORWARD */
464 /*
465 * Is it now for a local address on this host?
466 */
467#ifndef IPFIREWALL_FORWARD
468 if (in_localip(dest)) {
469#else
465 if (in_localip(dest) || m->m_flags & M_FASTFWD_OURS) {
470 if (m->m_flags & M_FASTFWD_OURS || in_localip(dest)) {
466#endif /* IPFIREWALL_FORWARD */
467forwardlocal:
468 /*
469 * Return packet for processing by ip_input().
470 * Keep host byte order as expected at ip_input's
471 * "ours"-label.
472 */
473 m->m_flags |= M_FASTFWD_OURS;

--- 139 unchanged lines hidden ---
471#endif /* IPFIREWALL_FORWARD */
472forwardlocal:
473 /*
474 * Return packet for processing by ip_input().
475 * Keep host byte order as expected at ip_input's
476 * "ours"-label.
477 */
478 m->m_flags |= M_FASTFWD_OURS;

--- 139 unchanged lines hidden ---