#include <net/route.h>
#include <net/if.h>
#include <net/content_filter.h>
+#include <net/ntstat.h>
#define tcp_minmssoverload fring
#define _IP_VHL
* maximum allowed receive and send socket buffer size.
*/
if (nmbclusters > 30720) {
- #if CONFIG_EMBEDDED
- tcp_autorcvbuf_max = 2 * 1024 * 1024;
- tcp_autosndbuf_max = 2 * 1024 * 1024;
- #else
- tcp_autorcvbuf_max = 1024 * 1024;
- tcp_autosndbuf_max = 1024 * 1024;
- #endif /* CONFIG_EMBEDDED */
+ tcp_autorcvbuf_max = 2 * 1024 * 1024;
+ tcp_autosndbuf_max = 2 * 1024 * 1024;
+
SYSCTL_SKMEM_UPDATE_FIELD(tcp.autorcvbufmax, tcp_autorcvbuf_max);
SYSCTL_SKMEM_UPDATE_FIELD(tcp.autosndbufmax, tcp_autosndbuf_max);
-
- /*
- * Receive buffer max for cellular interfaces supporting
- * Carrier Aggregation is higher
- */
- tcp_autorcvbuf_max_ca = 2 * 1024 * 1024;
}
}
#endif
#if NECP
- necp_mark_packet_from_socket(m, tp ? tp->t_inpcb : NULL, 0, 0);
+ necp_mark_packet_from_socket(m, tp ? tp->t_inpcb : NULL, 0, 0, 0);
#endif /* NECP */
#if IPSEC
m->m_pkthdr.pkt_flowid = tp->t_inpcb->inp_flowhash;
m->m_pkthdr.pkt_flags |= (PKTF_FLOW_ID | PKTF_FLOW_LOCALSRC | PKTF_FLOW_ADV);
m->m_pkthdr.pkt_proto = IPPROTO_TCP;
+ m->m_pkthdr.tx_tcp_pid = tp->t_inpcb->inp_socket->last_pid;
+ m->m_pkthdr.tx_tcp_e_pid = tp->t_inpcb->inp_socket->e_pid;
}
#if INET6
SYSCTL_PROC(_net_inet_tcp, OID_AUTO, pcblist_n,
- CTLTYPE_STRUCT | CTLFLAG_RD | CTLFLAG_LOCKED, 0, 0,
- tcp_pcblist_n, "S,xtcpcb_n", "List of active TCP connections");
+ CTLTYPE_STRUCT | CTLFLAG_RD | CTLFLAG_LOCKED, 0, 0,
+ tcp_pcblist_n, "S,xtcpcb_n", "List of active TCP connections");
+
+static int
+tcp_progress_indicators SYSCTL_HANDLER_ARGS
+{
+#pragma unused(oidp, arg1, arg2)
+
+ return (ntstat_tcp_progress_indicators(req));
+}
+
+SYSCTL_PROC(_net_inet_tcp, OID_AUTO, progress,
+ CTLTYPE_STRUCT | CTLFLAG_RW | CTLFLAG_LOCKED | CTLFLAG_ANYBODY, 0, 0,
+ tcp_progress_indicators, "S", "Various items that indicate the current state of progress on the link");
__private_extern__ void
tcp_get_ports_used(uint32_t ifindex, int protocol, uint32_t flags,
bitstr_t *bitfield)
{
- inpcb_get_ports_used(ifindex, protocol, flags, bitfield,
- &tcbinfo);
- }
+ inpcb_get_ports_used(ifindex, protocol, flags, bitfield,
+ &tcbinfo);
+}
__private_extern__ uint32_t
tcp_count_opportunistic(unsigned int ifindex, u_int32_t flags)
}
if (m == NULL ||
- (m->m_pkthdr.len < (int32_t) (off + offsetof(struct tcphdr, th_seq))))
+ (m->m_pkthdr.len < (int32_t) (off + offsetof(struct tcphdr, th_ack))))
return;
th = (struct tcphdr *)(void *)mtodo(m, off);
if (inp->inp_last_outifp == NULL) {
inp->inp_last_outifp = rt->rt_ifp;
}
- }
- /* Note if the peer is local */
- if (rt != NULL && !(rt->rt_ifp->if_flags & IFF_POINTOPOINT) &&
- (IN6_IS_ADDR_LOOPBACK(&inp->in6p_faddr) ||
- IN6_IS_ADDR_LINKLOCAL(&inp->in6p_faddr) ||
- rt->rt_gateway->sa_family == AF_LINK ||
- in6_localaddr(&inp->in6p_faddr))) {
- tp->t_flags |= TF_LOCAL;
+ /* Note if the peer is local */
+ if (!(rt->rt_ifp->if_flags & IFF_POINTOPOINT) &&
+ (IN6_IS_ADDR_LOOPBACK(&inp->in6p_faddr) ||
+ IN6_IS_ADDR_LINKLOCAL(&inp->in6p_faddr) ||
+ rt->rt_gateway->sa_family == AF_LINK ||
+ in6_localaddr(&inp->in6p_faddr))) {
+ tp->t_flags |= TF_LOCAL;
+ }
}
/*
* defined by the constant tcp_autorcvbuf_max.
*/
void
-tcp_set_max_rwinscale(struct tcpcb *tp, struct socket *so,
- u_int32_t rcvbuf_max)
+tcp_set_max_rwinscale(struct tcpcb *tp, struct socket *so, struct ifnet *ifp)
{
- u_int32_t maxsockbufsize;
+ uint32_t maxsockbufsize;
+ uint32_t rcvbuf_max;
+
if (!tcp_do_rfc1323) {
tp->request_r_scale = 0;
return;
}
+ /*
+ * When we start a connection and don't know about the interface, set
+ * the scaling factor simply to the max - we can always announce less.
+ */
+ if (!ifp || (IFNET_IS_CELLULAR(ifp) && (ifp->if_eflags & IFEF_3CA)))
+ rcvbuf_max = (tcp_autorcvbuf_max << 1);
+ else
+ rcvbuf_max = tcp_autorcvbuf_max;
+
tp->request_r_scale = max(tcp_win_scale, tp->request_r_scale);
maxsockbufsize = ((so->so_rcv.sb_flags & SB_USRSIZE) != 0) ?
so->so_rcv.sb_hiwat : rcvbuf_max;
}
int
-tcp_notsent_lowat_check(struct socket *so) {
+tcp_notsent_lowat_check(struct socket *so)
+{
struct inpcb *inp = sotoinpcb(so);
struct tcpcb *tp = NULL;
int notsent = 0;
+
if (inp != NULL) {
tp = intotcpcb(inp);
}
+ if (tp == NULL) {
+ return (0);
+ }
+
notsent = so->so_snd.sb_cc -
(tp->snd_nxt - tp->snd_una);