1/*- 2 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 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 --- 47 unchanged lines hidden (view full) --- 56 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 57 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 58 * SUCH DAMAGE. 59 * 60 * @(#)ip_input.c 8.2 (Berkeley) 1/4/94 61 */ 62 63#include <sys/cdefs.h> |
64__FBSDID("$FreeBSD: head/sys/netinet6/ip6_input.c 191672 2009-04-29 19:19:13Z bms $"); |
65 66#include "opt_inet.h" 67#include "opt_inet6.h" 68#include "opt_ipsec.h" 69#include "opt_route.h" 70 71#include <sys/param.h> 72#include <sys/systm.h> --- 477 unchanged lines hidden (view full) --- 550 } 551 if (in6_setscope(&ip6->ip6_src, m->m_pkthdr.rcvif, NULL) || 552 in6_setscope(&ip6->ip6_dst, m->m_pkthdr.rcvif, NULL)) { 553 V_ip6stat.ip6s_badscope++; 554 goto bad; 555 } 556 557 /* |
558 * Multicast check. Assume packet is for us to avoid 559 * prematurely taking locks. |
560 */ 561 if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) { |
562 ours = 1; |
563 in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_mcast); |
564 deliverifp = m->m_pkthdr.rcvif; 565 goto hbhcheck; 566 } 567 568 /* 569 * Unicast check 570 */ 571 --- 233 unchanged lines hidden (view full) --- 805 m->m_pkthdr.len = sizeof(struct ip6_hdr) + plen; 806 } else 807 m_adj(m, sizeof(struct ip6_hdr) + plen - m->m_pkthdr.len); 808 } 809 810 /* 811 * Forward if desirable. 812 */ |
813 if (V_ip6_mrouter && 814 IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) { |
815 /* 816 * If we are acting as a multicast router, all 817 * incoming multicast packets are passed to the 818 * kernel-level multicast forwarding function. 819 * The packet is returned (relatively) intact; if 820 * ip6_mforward() returns a non-zero value, the packet 821 * must be discarded, else it may be accepted below. 822 */ |
823 if (ip6_mforward && |
824 ip6_mforward(ip6, m->m_pkthdr.rcvif, m)) { |
825 IP6STAT_INC(ip6s_cantforward); 826 in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_discard); |
827 goto bad; 828 } |
829 } else if (!ours) { 830 ip6_forward(m, srcrt); 831 goto out; 832 } 833 834 ip6 = mtod(m, struct ip6_hdr *); 835 836 /* --- 868 unchanged lines hidden --- |