ip_input.c (104774) | ip_input.c (105194) |
---|---|
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 | 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 104774 2002-10-10 12:03:36Z maxim $ | 34 * $FreeBSD: head/sys/netinet/ip_input.c 105194 2002-10-16 01:54:46Z sam $ |
35 */ 36 37#define _IP_VHL 38 39#include "opt_bootp.h" 40#include "opt_ipfw.h" 41#include "opt_ipdn.h" 42#include "opt_ipdivert.h" --- 251 unchanged lines hidden (view full) --- 294 args.eh = NULL; 295 args.oif = NULL; 296 args.rule = NULL; 297 args.divert_rule = 0; /* divert cookie */ 298 args.next_hop = NULL; 299 300 /* Grab info from MT_TAG mbufs prepended to the chain. */ 301 for (; m && m->m_type == MT_TAG; m = m->m_next) { | 35 */ 36 37#define _IP_VHL 38 39#include "opt_bootp.h" 40#include "opt_ipfw.h" 41#include "opt_ipdn.h" 42#include "opt_ipdivert.h" --- 251 unchanged lines hidden (view full) --- 294 args.eh = NULL; 295 args.oif = NULL; 296 args.rule = NULL; 297 args.divert_rule = 0; /* divert cookie */ 298 args.next_hop = NULL; 299 300 /* Grab info from MT_TAG mbufs prepended to the chain. */ 301 for (; m && m->m_type == MT_TAG; m = m->m_next) { |
302 switch(m->m_tag_id) { | 302 switch(m->_m_tag_id) { |
303 default: 304 printf("ip_input: unrecognised MT_TAG tag %d\n", | 303 default: 304 printf("ip_input: unrecognised MT_TAG tag %d\n", |
305 m->m_tag_id); | 305 m->_m_tag_id); |
306 break; 307 308 case PACKET_TAG_DUMMYNET: 309 args.rule = ((struct dn_pkt *)m)->rule; 310 break; 311 312 case PACKET_TAG_DIVERT: 313 args.divert_rule = (intptr_t)m->m_hdr.mh_data & 0xffff; --- 1431 unchanged lines hidden (view full) --- 1745 1746 tag.mh_type = MT_TAG; 1747 tag.mh_flags = PACKET_TAG_IPFORWARD; 1748 tag.mh_data = (caddr_t)next_hop; 1749 tag.mh_next = m; 1750 m = (struct mbuf *)&tag; 1751 } 1752 error = ip_output(m, (struct mbuf *)0, &ipforward_rt, | 306 break; 307 308 case PACKET_TAG_DUMMYNET: 309 args.rule = ((struct dn_pkt *)m)->rule; 310 break; 311 312 case PACKET_TAG_DIVERT: 313 args.divert_rule = (intptr_t)m->m_hdr.mh_data & 0xffff; --- 1431 unchanged lines hidden (view full) --- 1745 1746 tag.mh_type = MT_TAG; 1747 tag.mh_flags = PACKET_TAG_IPFORWARD; 1748 tag.mh_data = (caddr_t)next_hop; 1749 tag.mh_next = m; 1750 m = (struct mbuf *)&tag; 1751 } 1752 error = ip_output(m, (struct mbuf *)0, &ipforward_rt, |
1753 IP_FORWARDING, 0); | 1753 IP_FORWARDING, 0, NULL); |
1754 } 1755 if (error) 1756 ipstat.ips_cantforward++; 1757 else { 1758 ipstat.ips_forward++; 1759 if (type) 1760 ipstat.ips_redirectsent++; 1761 else { --- 21 unchanged lines hidden (view full) --- 1783 default: 1784 type = ICMP_UNREACH; 1785 code = ICMP_UNREACH_HOST; 1786 break; 1787 1788 case EMSGSIZE: 1789 type = ICMP_UNREACH; 1790 code = ICMP_UNREACH_NEEDFRAG; | 1754 } 1755 if (error) 1756 ipstat.ips_cantforward++; 1757 else { 1758 ipstat.ips_forward++; 1759 if (type) 1760 ipstat.ips_redirectsent++; 1761 else { --- 21 unchanged lines hidden (view full) --- 1783 default: 1784 type = ICMP_UNREACH; 1785 code = ICMP_UNREACH_HOST; 1786 break; 1787 1788 case EMSGSIZE: 1789 type = ICMP_UNREACH; 1790 code = ICMP_UNREACH_NEEDFRAG; |
1791#ifndef IPSEC 1792 if (ipforward_rt.ro_rt) 1793 destifp = ipforward_rt.ro_rt->rt_ifp; 1794#else | 1791#ifdef IPSEC |
1795 /* 1796 * If the packet is routed over IPsec tunnel, tell the 1797 * originator the tunnel MTU. 1798 * tunnel MTU = if MTU - sizeof(IP) - ESP/AH hdrsiz 1799 * XXX quickhack!!! 1800 */ 1801 if (ipforward_rt.ro_rt) { 1802 struct secpolicy *sp = NULL; --- 34 unchanged lines hidden (view full) --- 1837 dummyifp.if_mtu -= ipsechdr; 1838 destifp = &dummyifp; 1839 } 1840 } 1841 1842 key_freesp(sp); 1843 } 1844 } | 1792 /* 1793 * If the packet is routed over IPsec tunnel, tell the 1794 * originator the tunnel MTU. 1795 * tunnel MTU = if MTU - sizeof(IP) - ESP/AH hdrsiz 1796 * XXX quickhack!!! 1797 */ 1798 if (ipforward_rt.ro_rt) { 1799 struct secpolicy *sp = NULL; --- 34 unchanged lines hidden (view full) --- 1834 dummyifp.if_mtu -= ipsechdr; 1835 destifp = &dummyifp; 1836 } 1837 } 1838 1839 key_freesp(sp); 1840 } 1841 } |
1842#else 1843 if (ipforward_rt.ro_rt) 1844 destifp = ipforward_rt.ro_rt->rt_ifp; |
|
1845#endif /*IPSEC*/ 1846 ipstat.ips_cantfrag++; 1847 break; 1848 1849 case ENOBUFS: 1850 type = ICMP_SOURCEQUENCH; 1851 code = 0; 1852 break; --- 132 unchanged lines hidden --- | 1845#endif /*IPSEC*/ 1846 ipstat.ips_cantfrag++; 1847 break; 1848 1849 case ENOBUFS: 1850 type = ICMP_SOURCEQUENCH; 1851 code = 0; 1852 break; --- 132 unchanged lines hidden --- |