ip6_input.c (191688) | ip6_input.c (192923) |
---|---|
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> | 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 191688 2009-04-30 13:36:26Z zec $"); | 64__FBSDID("$FreeBSD: head/sys/netinet6/ip6_input.c 192923 2009-05-27 18:57: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> --- 695 unchanged lines hidden (view full) --- 768 769 /* 770 * If we are acting as a router and the packet contains a 771 * router alert option, see if we know the option value. 772 * Currently, we only support the option value for MLD, in which 773 * case we should pass the packet to the multicast routing 774 * daemon. 775 */ | 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> --- 695 unchanged lines hidden (view full) --- 768 769 /* 770 * If we are acting as a router and the packet contains a 771 * router alert option, see if we know the option value. 772 * Currently, we only support the option value for MLD, in which 773 * case we should pass the packet to the multicast routing 774 * daemon. 775 */ |
776 if (rtalert != ~0 && V_ip6_forwarding) { | 776 if (rtalert != ~0) { |
777 switch (rtalert) { 778 case IP6OPT_RTALERT_MLD: | 777 switch (rtalert) { 778 case IP6OPT_RTALERT_MLD: |
779 ours = 1; | 779 if (V_ip6_forwarding) 780 ours = 1; |
780 break; 781 default: 782 /* 783 * RFC2711 requires unrecognized values must be 784 * silently ignored. 785 */ 786 break; 787 } --- 27 unchanged lines hidden (view full) --- 815 IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) { 816 /* 817 * If we are acting as a multicast router, all 818 * incoming multicast packets are passed to the 819 * kernel-level multicast forwarding function. 820 * The packet is returned (relatively) intact; if 821 * ip6_mforward() returns a non-zero value, the packet 822 * must be discarded, else it may be accepted below. | 781 break; 782 default: 783 /* 784 * RFC2711 requires unrecognized values must be 785 * silently ignored. 786 */ 787 break; 788 } --- 27 unchanged lines hidden (view full) --- 816 IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) { 817 /* 818 * If we are acting as a multicast router, all 819 * incoming multicast packets are passed to the 820 * kernel-level multicast forwarding function. 821 * The packet is returned (relatively) intact; if 822 * ip6_mforward() returns a non-zero value, the packet 823 * must be discarded, else it may be accepted below. |
824 * 825 * XXX TODO: Check hlim and multicast scope here to avoid 826 * unnecessarily calling into ip6_mforward(). |
|
823 */ 824 if (ip6_mforward && 825 ip6_mforward(ip6, m->m_pkthdr.rcvif, m)) { 826 IP6STAT_INC(ip6s_cantforward); 827 in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_discard); 828 goto bad; 829 } 830 } else if (!ours) { --- 46 unchanged lines hidden (view full) --- 877 /* 878 * enforce IPsec policy checking if we are seeing last header. 879 * note that we do not visit this with protocols with pcb layer 880 * code - like udp/tcp/raw ip. 881 */ 882 if (ip6_ipsec_input(m, nxt)) 883 goto bad; 884#endif /* IPSEC */ | 827 */ 828 if (ip6_mforward && 829 ip6_mforward(ip6, m->m_pkthdr.rcvif, m)) { 830 IP6STAT_INC(ip6s_cantforward); 831 in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_discard); 832 goto bad; 833 } 834 } else if (!ours) { --- 46 unchanged lines hidden (view full) --- 881 /* 882 * enforce IPsec policy checking if we are seeing last header. 883 * note that we do not visit this with protocols with pcb layer 884 * code - like udp/tcp/raw ip. 885 */ 886 if (ip6_ipsec_input(m, nxt)) 887 goto bad; 888#endif /* IPSEC */ |
889 890 /* 891 * Use mbuf flags to propagate Router Alert option to 892 * ICMPv6 layer, as hop-by-hop options have been stripped. 893 */ 894 if (nxt == IPPROTO_ICMPV6 && rtalert != ~0) 895 m->m_flags |= M_RTALERT_MLD; 896 |
|
885 nxt = (*inet6sw[ip6_protox[nxt]].pr_input)(&m, &off, nxt); 886 } 887 goto out; 888bad: 889 m_freem(m); 890out: 891 if (rin6.ro_rt) 892 RTFREE(rin6.ro_rt); --- 813 unchanged lines hidden --- | 897 nxt = (*inet6sw[ip6_protox[nxt]].pr_input)(&m, &off, nxt); 898 } 899 goto out; 900bad: 901 m_freem(m); 902out: 903 if (rin6.ro_rt) 904 RTFREE(rin6.ro_rt); --- 813 unchanged lines hidden --- |