Deleted Added
full compact
ip6_input.c (191433) ip6_input.c (191672)
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 191433 2009-04-23 17:41:54Z bz $");
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 /*
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
558 * Multicast check. Assume packet is for us to avoid
559 * prematurely taking locks.
559 */
560 if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) {
560 */
561 if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) {
561 struct in6_multi *in6m = 0;
562
562 ours = 1;
563 in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_mcast);
563 in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_mcast);
564 /*
565 * See if we belong to the destination multicast group on the
566 * arrival interface.
567 */
568 IN6_LOOKUP_MULTI(ip6->ip6_dst, m->m_pkthdr.rcvif, in6m);
569 if (in6m)
570 ours = 1;
571 else if (!ip6_mrouter) {
572 V_ip6stat.ip6s_notmember++;
573 V_ip6stat.ip6s_cantforward++;
574 in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_discard);
575 goto bad;
576 }
577 deliverifp = m->m_pkthdr.rcvif;
578 goto hbhcheck;
579 }
580
581 /*
582 * Unicast check
583 */
584

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

818 m->m_pkthdr.len = sizeof(struct ip6_hdr) + plen;
819 } else
820 m_adj(m, sizeof(struct ip6_hdr) + plen - m->m_pkthdr.len);
821 }
822
823 /*
824 * Forward if desirable.
825 */
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 */
826 if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) {
813 if (V_ip6_mrouter &&
814 IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) {
827 /*
828 * If we are acting as a multicast router, all
829 * incoming multicast packets are passed to the
830 * kernel-level multicast forwarding function.
831 * The packet is returned (relatively) intact; if
832 * ip6_mforward() returns a non-zero value, the packet
833 * must be discarded, else it may be accepted below.
834 */
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 */
835 if (ip6_mrouter && ip6_mforward &&
823 if (ip6_mforward &&
836 ip6_mforward(ip6, m->m_pkthdr.rcvif, m)) {
824 ip6_mforward(ip6, m->m_pkthdr.rcvif, m)) {
837 V_ip6stat.ip6s_cantforward++;
825 IP6STAT_INC(ip6s_cantforward);
826 in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_discard);
838 goto bad;
839 }
827 goto bad;
828 }
840 if (!ours)
841 goto bad;
842 } else if (!ours) {
843 ip6_forward(m, srcrt);
844 goto out;
845 }
846
847 ip6 = mtod(m, struct ip6_hdr *);
848
849 /*

--- 868 unchanged lines hidden ---
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 ---