ip6_output.c (236130) | ip6_output.c (236170) |
---|---|
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_output.c 8.3 (Berkeley) 1/21/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_output.c 8.3 (Berkeley) 1/21/94 61 */ 62 63#include <sys/cdefs.h> |
64__FBSDID("$FreeBSD: head/sys/netinet6/ip6_output.c 236130 2012-05-26 23:58:51Z bz $"); | 64__FBSDID("$FreeBSD: head/sys/netinet6/ip6_output.c 236170 2012-05-28 09:30:13Z bz $"); |
65 66#include "opt_inet.h" 67#include "opt_inet6.h" 68#include "opt_ipfw.h" 69#include "opt_ipsec.h" 70#include "opt_sctp.h" 71#include "opt_route.h" 72 --- 112 unchanged lines hidden (view full) --- 185 } while (/*CONSTCOND*/ 0) 186 187static void 188in6_delayed_cksum(struct mbuf *m, uint32_t plen, u_short offset) 189{ 190 u_short csum; 191 192 csum = in_cksum_skip(m, offset + plen, offset); | 65 66#include "opt_inet.h" 67#include "opt_inet6.h" 68#include "opt_ipfw.h" 69#include "opt_ipsec.h" 70#include "opt_sctp.h" 71#include "opt_route.h" 72 --- 112 unchanged lines hidden (view full) --- 185 } while (/*CONSTCOND*/ 0) 186 187static void 188in6_delayed_cksum(struct mbuf *m, uint32_t plen, u_short offset) 189{ 190 u_short csum; 191 192 csum = in_cksum_skip(m, offset + plen, offset); |
193 if (m->m_pkthdr.csum_flags & CSUM_UDP && csum == 0) | 193 if (m->m_pkthdr.csum_flags & CSUM_UDP_IPV6 && csum == 0) |
194 csum = 0xffff; 195 offset += m->m_pkthdr.csum_data; /* checksum offset */ 196 197 if (offset + sizeof(u_short) > m->m_len) { 198 printf("%s: delayed m_pullup, m->len: %d off: %d\n", 199 __func__, m->m_len, offset); 200 /* 201 * XXX this should not happen, but if it does, the correct --- 678 unchanged lines hidden (view full) --- 880 /* See if destination IP address was changed by packet filter. */ 881 if (!IN6_ARE_ADDR_EQUAL(&odst, &ip6->ip6_dst)) { 882 m->m_flags |= M_SKIP_FIREWALL; 883 /* If destination is now ourself drop to ip6_input(). */ 884 if (in6_localip(&ip6->ip6_dst)) { 885 m->m_flags |= M_FASTFWD_OURS; 886 if (m->m_pkthdr.rcvif == NULL) 887 m->m_pkthdr.rcvif = V_loif; | 194 csum = 0xffff; 195 offset += m->m_pkthdr.csum_data; /* checksum offset */ 196 197 if (offset + sizeof(u_short) > m->m_len) { 198 printf("%s: delayed m_pullup, m->len: %d off: %d\n", 199 __func__, m->m_len, offset); 200 /* 201 * XXX this should not happen, but if it does, the correct --- 678 unchanged lines hidden (view full) --- 880 /* See if destination IP address was changed by packet filter. */ 881 if (!IN6_ARE_ADDR_EQUAL(&odst, &ip6->ip6_dst)) { 882 m->m_flags |= M_SKIP_FIREWALL; 883 /* If destination is now ourself drop to ip6_input(). */ 884 if (in6_localip(&ip6->ip6_dst)) { 885 m->m_flags |= M_FASTFWD_OURS; 886 if (m->m_pkthdr.rcvif == NULL) 887 m->m_pkthdr.rcvif = V_loif; |
888 if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { | 888 if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA_IPV6) { |
889 m->m_pkthdr.csum_flags |= | 889 m->m_pkthdr.csum_flags |= |
890 CSUM_DATA_VALID | CSUM_PSEUDO_HDR; | 890 CSUM_DATA_VALID_IPV6 | CSUM_PSEUDO_HDR; |
891 m->m_pkthdr.csum_data = 0xffff; 892 } 893#ifdef SCTP 894 if (m->m_pkthdr.csum_flags & CSUM_SCTP) 895 m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID; 896#endif 897 error = netisr_queue(NETISR_IPV6, m); 898 goto done; 899 } else 900 goto again; /* Redo the routing table lookup. */ 901 } 902 903#ifdef IPFIREWALL_FORWARD 904 /* See if local, if yes, send it to netisr. */ 905 if (m->m_flags & M_FASTFWD_OURS) { 906 if (m->m_pkthdr.rcvif == NULL) 907 m->m_pkthdr.rcvif = V_loif; | 891 m->m_pkthdr.csum_data = 0xffff; 892 } 893#ifdef SCTP 894 if (m->m_pkthdr.csum_flags & CSUM_SCTP) 895 m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID; 896#endif 897 error = netisr_queue(NETISR_IPV6, m); 898 goto done; 899 } else 900 goto again; /* Redo the routing table lookup. */ 901 } 902 903#ifdef IPFIREWALL_FORWARD 904 /* See if local, if yes, send it to netisr. */ 905 if (m->m_flags & M_FASTFWD_OURS) { 906 if (m->m_pkthdr.rcvif == NULL) 907 m->m_pkthdr.rcvif = V_loif; |
908 if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { | 908 if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA_IPV6) { |
909 m->m_pkthdr.csum_flags |= | 909 m->m_pkthdr.csum_flags |= |
910 CSUM_DATA_VALID | CSUM_PSEUDO_HDR; | 910 CSUM_DATA_VALID_IPV6 | CSUM_PSEUDO_HDR; |
911 m->m_pkthdr.csum_data = 0xffff; 912 } 913#ifdef SCTP 914 if (m->m_pkthdr.csum_flags & CSUM_SCTP) 915 m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID; 916#endif 917 error = netisr_queue(NETISR_IPV6, m); 918 goto done; --- 36 unchanged lines hidden (view full) --- 955 } else 956 tso = 0; 957 /* 958 * If we added extension headers, we will not do TSO and calculate the 959 * checksums ourselves for now. 960 * XXX-BZ Need a framework to know when the NIC can handle it, even 961 * with ext. hdrs. 962 */ | 911 m->m_pkthdr.csum_data = 0xffff; 912 } 913#ifdef SCTP 914 if (m->m_pkthdr.csum_flags & CSUM_SCTP) 915 m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID; 916#endif 917 error = netisr_queue(NETISR_IPV6, m); 918 goto done; --- 36 unchanged lines hidden (view full) --- 955 } else 956 tso = 0; 957 /* 958 * If we added extension headers, we will not do TSO and calculate the 959 * checksums ourselves for now. 960 * XXX-BZ Need a framework to know when the NIC can handle it, even 961 * with ext. hdrs. 962 */ |
963 if (sw_csum & CSUM_DELAY_DATA) { 964 sw_csum &= ~CSUM_DELAY_DATA; | 963 if (sw_csum & CSUM_DELAY_DATA_IPV6) { 964 sw_csum &= ~CSUM_DELAY_DATA_IPV6; |
965 in6_delayed_cksum(m, plen, sizeof(struct ip6_hdr)); 966 } 967#ifdef SCTP 968 if (sw_csum & CSUM_SCTP) { 969 sw_csum &= ~CSUM_SCTP; 970 sctp_delayed_cksum(m, sizeof(struct ip6_hdr)); 971 } 972#endif --- 98 unchanged lines hidden (view full) --- 1071 } 1072 1073 1074 /* 1075 * If the interface will not calculate checksums on 1076 * fragmented packets, then do it here. 1077 * XXX-BZ handle the hw offloading case. Need flags. 1078 */ | 965 in6_delayed_cksum(m, plen, sizeof(struct ip6_hdr)); 966 } 967#ifdef SCTP 968 if (sw_csum & CSUM_SCTP) { 969 sw_csum &= ~CSUM_SCTP; 970 sctp_delayed_cksum(m, sizeof(struct ip6_hdr)); 971 } 972#endif --- 98 unchanged lines hidden (view full) --- 1071 } 1072 1073 1074 /* 1075 * If the interface will not calculate checksums on 1076 * fragmented packets, then do it here. 1077 * XXX-BZ handle the hw offloading case. Need flags. 1078 */ |
1079 if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { | 1079 if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA_IPV6) { |
1080 in6_delayed_cksum(m, plen, hlen); | 1080 in6_delayed_cksum(m, plen, hlen); |
1081 m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; | 1081 m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA_IPV6; |
1082 } 1083#ifdef SCTP 1084 if (m->m_pkthdr.csum_flags & CSUM_SCTP) { 1085 sctp_delayed_cksum(m, hlen); 1086 m->m_pkthdr.csum_flags &= ~CSUM_SCTP; 1087 } 1088#endif 1089 mnext = &m->m_nextpkt; --- 1988 unchanged lines hidden --- | 1082 } 1083#ifdef SCTP 1084 if (m->m_pkthdr.csum_flags & CSUM_SCTP) { 1085 sctp_delayed_cksum(m, hlen); 1086 m->m_pkthdr.csum_flags &= ~CSUM_SCTP; 1087 } 1088#endif 1089 mnext = &m->m_nextpkt; --- 1988 unchanged lines hidden --- |