tcp_output.c (61179) | tcp_output.c (62587) |
---|---|
1/* 2 * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1995 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 * @(#)tcp_output.c 8.4 (Berkeley) 5/24/95 | 1/* 2 * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1995 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 * @(#)tcp_output.c 8.4 (Berkeley) 5/24/95 |
34 * $FreeBSD: head/sys/netinet/tcp_output.c 61179 2000-06-02 17:38:45Z jlemon $ | 34 * $FreeBSD: head/sys/netinet/tcp_output.c 62587 2000-07-04 16:35:15Z itojun $ |
35 */ 36 37#include "opt_inet6.h" 38#include "opt_ipsec.h" 39#include "opt_tcpdebug.h" 40 41#include <stddef.h> 42 43#include <sys/param.h> 44#include <sys/systm.h> 45#include <sys/kernel.h> 46#include <sys/sysctl.h> 47#include <sys/mbuf.h> | 35 */ 36 37#include "opt_inet6.h" 38#include "opt_ipsec.h" 39#include "opt_tcpdebug.h" 40 41#include <stddef.h> 42 43#include <sys/param.h> 44#include <sys/systm.h> 45#include <sys/kernel.h> 46#include <sys/sysctl.h> 47#include <sys/mbuf.h> |
48#include <sys/domain.h> |
|
48#include <sys/protosw.h> 49#include <sys/socket.h> 50#include <sys/socketvar.h> 51 52#include <net/route.h> 53 54#include <netinet/in.h> 55#include <netinet/in_systm.h> 56#include <netinet/ip.h> | 49#include <sys/protosw.h> 50#include <sys/socket.h> 51#include <sys/socketvar.h> 52 53#include <net/route.h> 54 55#include <netinet/in.h> 56#include <netinet/in_systm.h> 57#include <netinet/ip.h> |
57#ifdef INET6 58#include <netinet/ip6.h> 59#endif | |
60#include <netinet/in_pcb.h> | 58#include <netinet/in_pcb.h> |
61#ifdef INET6 62#include <netinet6/in6_pcb.h> 63#endif | |
64#include <netinet/ip_var.h> 65#ifdef INET6 | 59#include <netinet/ip_var.h> 60#ifdef INET6 |
61#include <netinet6/in6_pcb.h> 62#include <netinet/ip6.h> |
|
66#include <netinet6/ip6_var.h> 67#endif 68#include <netinet/tcp.h> 69#define TCPOUTFLAGS 70#include <netinet/tcp_fsm.h> 71#include <netinet/tcp_seq.h> 72#include <netinet/tcp_timer.h> 73#include <netinet/tcp_var.h> --- 734 unchanged lines hidden (view full) --- 808 * the template, but need a way to checksum without them. 809 */ 810 /* 811 * m->m_pkthdr.len should have been set before cksum calcuration, 812 * because in6_cksum() need it. 813 */ 814#ifdef INET6 815 if (isipv6) { | 63#include <netinet6/ip6_var.h> 64#endif 65#include <netinet/tcp.h> 66#define TCPOUTFLAGS 67#include <netinet/tcp_fsm.h> 68#include <netinet/tcp_seq.h> 69#include <netinet/tcp_timer.h> 70#include <netinet/tcp_var.h> --- 734 unchanged lines hidden (view full) --- 805 * the template, but need a way to checksum without them. 806 */ 807 /* 808 * m->m_pkthdr.len should have been set before cksum calcuration, 809 * because in6_cksum() need it. 810 */ 811#ifdef INET6 812 if (isipv6) { |
816 /* | 813 /* |
817 * we separately set hoplimit for every segment, since the 818 * user might want to change the value via setsockopt. 819 * Also, desired default hop limit might be changed via | 814 * we separately set hoplimit for every segment, since the 815 * user might want to change the value via setsockopt. 816 * Also, desired default hop limit might be changed via |
820 * Neighbor Discovery. 821 */ 822 ip6->ip6_hlim = in6_selecthlim(tp->t_inpcb, 823 tp->t_inpcb->in6p_route.ro_rt ? 824 tp->t_inpcb->in6p_route.ro_rt->rt_ifp 825 : NULL); | 817 * Neighbor Discovery. 818 */ 819 ip6->ip6_hlim = in6_selecthlim(tp->t_inpcb, 820 tp->t_inpcb->in6p_route.ro_rt ? 821 tp->t_inpcb->in6p_route.ro_rt->rt_ifp 822 : NULL); |
826 827 /* TODO: IPv6 IP6TOS_ECT bit on */ 828#ifdef IPSEC | 823 824 /* TODO: IPv6 IP6TOS_ECT bit on */ 825#ifdef IPSEC |
829 m->m_pkthdr.rcvif = (struct ifnet *)so; | 826 ipsec_setsocket(m, so); |
830#endif /*IPSEC*/ 831 error = ip6_output(m, 832 tp->t_inpcb->in6p_outputopts, 833 &tp->t_inpcb->in6p_route, | 827#endif /*IPSEC*/ 828 error = ip6_output(m, 829 tp->t_inpcb->in6p_outputopts, 830 &tp->t_inpcb->in6p_route, |
834 (so->so_options & SO_DONTROUTE)|IPV6_SOCKINMRCVIF, 835 NULL, NULL); | 831 (so->so_options & SO_DONTROUTE), NULL, NULL); |
836 } else 837#endif /* INET6 */ 838 { 839 struct rtentry *rt; 840 ip->ip_len = m->m_pkthdr.len; | 832 } else 833#endif /* INET6 */ 834 { 835 struct rtentry *rt; 836 ip->ip_len = m->m_pkthdr.len; |
837#ifdef INET6 838 if (INP_CHECK_SOCKAF(so, AF_INET6)) 839 ip->ip_ttl = in6_selecthlim(tp->t_inpcb, 840 tp->t_inpcb->in6p_route.ro_rt ? 841 tp->t_inpcb->in6p_route.ro_rt->rt_ifp 842 : NULL); 843 else 844#endif /* INET6 */ |
|
841 ip->ip_ttl = tp->t_inpcb->inp_ip_ttl; /* XXX */ 842 ip->ip_tos = tp->t_inpcb->inp_ip_tos; /* XXX */ 843 /* 844 * See if we should do MTU discovery. We do it only if the following 845 * are true: 846 * 1) we have a valid route to the destination 847 * 2) the MTU is not locked (if it is, then discovery has been 848 * disabled) 849 */ 850 if (path_mtu_discovery 851 && (rt = tp->t_inpcb->inp_route.ro_rt) 852 && rt->rt_flags & RTF_UP 853 && !(rt->rt_rmx.rmx_locks & RTV_MTU)) { 854 ip->ip_off |= IP_DF; 855 } | 845 ip->ip_ttl = tp->t_inpcb->inp_ip_ttl; /* XXX */ 846 ip->ip_tos = tp->t_inpcb->inp_ip_tos; /* XXX */ 847 /* 848 * See if we should do MTU discovery. We do it only if the following 849 * are true: 850 * 1) we have a valid route to the destination 851 * 2) the MTU is not locked (if it is, then discovery has been 852 * disabled) 853 */ 854 if (path_mtu_discovery 855 && (rt = tp->t_inpcb->inp_route.ro_rt) 856 && rt->rt_flags & RTF_UP 857 && !(rt->rt_rmx.rmx_locks & RTV_MTU)) { 858 ip->ip_off |= IP_DF; 859 } |
860#ifdef IPSEC 861 ipsec_setsocket(m, so); 862#endif /*IPSEC*/ |
|
856 error = ip_output(m, tp->t_inpcb->inp_options, &tp->t_inpcb->inp_route, | 863 error = ip_output(m, tp->t_inpcb->inp_options, &tp->t_inpcb->inp_route, |
857 (so->so_options & SO_DONTROUTE)|IP_SOCKINMRCVIF, 0); | 864 (so->so_options & SO_DONTROUTE), 0); |
858 } 859 if (error) { 860out: 861 if (error == ENOBUFS) { 862 if (!callout_active(tp->tt_rexmt) && 863 !callout_active(tp->tt_persist)) 864 callout_reset(tp->tt_rexmt, tp->t_rxtcur, 865 tcp_timer_rexmt, tp); --- 57 unchanged lines hidden --- | 865 } 866 if (error) { 867out: 868 if (error == ENOBUFS) { 869 if (!callout_active(tp->tt_rexmt) && 870 !callout_active(tp->tt_persist)) 871 callout_reset(tp->tt_rexmt, tp->t_rxtcur, 872 tcp_timer_rexmt, tp); --- 57 unchanged lines hidden --- |