ip_input.c (122179) | ip_input.c (122320) |
---|---|
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 122179 2003-11-07 01:47:52Z sam $ | 34 * $FreeBSD: head/sys/netinet/ip_input.c 122320 2003-11-08 22:28:40Z 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" --- 286 unchanged lines hidden (view full) --- 329 maxnipq = nmbclusters / 32; 330 maxfragsperpacket = 16; 331 332#ifndef RANDOM_IP_ID 333 ip_id = time_second & 0xffff; 334#endif 335 ipintrq.ifq_maxlen = ipqmaxlen; 336 mtx_init(&ipintrq.ifq_mtx, "ip_inq", NULL, MTX_DEF); | 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" --- 286 unchanged lines hidden (view full) --- 329 maxnipq = nmbclusters / 32; 330 maxfragsperpacket = 16; 331 332#ifndef RANDOM_IP_ID 333 ip_id = time_second & 0xffff; 334#endif 335 ipintrq.ifq_maxlen = ipqmaxlen; 336 mtx_init(&ipintrq.ifq_mtx, "ip_inq", NULL, MTX_DEF); |
337 netisr_register(NETISR_IP, ip_input, &ipintrq); | 337 netisr_register(NETISR_IP, ip_input, &ipintrq, NETISR_MPSAFE); |
338} 339 340/* 341 * Invalidate any cached route used for forwarding. 342 */ 343void 344ip_forward_cacheinval(void) 345{ --- 658 unchanged lines hidden (view full) --- 1004 goto bad; 1005 } 1006#endif /* FAST_IPSEC */ 1007 1008 /* 1009 * Switch out to protocol's input routine. 1010 */ 1011 ipstat.ips_delivered++; | 338} 339 340/* 341 * Invalidate any cached route used for forwarding. 342 */ 343void 344ip_forward_cacheinval(void) 345{ --- 658 unchanged lines hidden (view full) --- 1004 goto bad; 1005 } 1006#endif /* FAST_IPSEC */ 1007 1008 /* 1009 * Switch out to protocol's input routine. 1010 */ 1011 ipstat.ips_delivered++; |
1012 NET_PICKUP_GIANT(); |
|
1012 if (args.next_hop && ip->ip_p == IPPROTO_TCP) { 1013 /* TCP needs IPFORWARD info if available */ 1014 struct m_hdr tag; 1015 1016 tag.mh_type = MT_TAG; 1017 tag.mh_flags = PACKET_TAG_IPFORWARD; 1018 tag.mh_data = (caddr_t)args.next_hop; 1019 tag.mh_next = m; 1020 1021 (*inetsw[ip_protox[ip->ip_p]].pr_input)( 1022 (struct mbuf *)&tag, hlen); 1023 } else 1024 (*inetsw[ip_protox[ip->ip_p]].pr_input)(m, hlen); | 1013 if (args.next_hop && ip->ip_p == IPPROTO_TCP) { 1014 /* TCP needs IPFORWARD info if available */ 1015 struct m_hdr tag; 1016 1017 tag.mh_type = MT_TAG; 1018 tag.mh_flags = PACKET_TAG_IPFORWARD; 1019 tag.mh_data = (caddr_t)args.next_hop; 1020 tag.mh_next = m; 1021 1022 (*inetsw[ip_protox[ip->ip_p]].pr_input)( 1023 (struct mbuf *)&tag, hlen); 1024 } else 1025 (*inetsw[ip_protox[ip->ip_p]].pr_input)(m, hlen); |
1026 NET_DROP_GIANT(); |
|
1025 return; 1026bad: 1027 m_freem(m); 1028} 1029 1030/* 1031 * Take incoming datagram fragment and try to reassemble it into 1032 * whole datagram. If a chain for reassembly of this datagram already --- 1267 unchanged lines hidden --- | 1027 return; 1028bad: 1029 m_freem(m); 1030} 1031 1032/* 1033 * Take incoming datagram fragment and try to reassemble it into 1034 * whole datagram. If a chain for reassembly of this datagram already --- 1267 unchanged lines hidden --- |