FreeBSD kernel IPv4 code
|
#include <sys/cdefs.h>
#include "opt_inet.h"
#include "opt_inet6.h"
#include "opt_tcpdebug.h"
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/eventhandler.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/sysctl.h>
#include <sys/syslog.h>
#include <sys/systm.h>
#include <vm/uma.h>
#include <net/if.h>
#include <net/if_var.h>
#include <net/route.h>
#include <net/vnet.h>
#include <netinet/in.h>
#include <netinet/in_pcb.h>
#include <netinet/in_systm.h>
#include <netinet/in_var.h>
#include <netinet/ip.h>
#include <netinet/ip_var.h>
#include <netinet/ip_options.h>
#include <netinet/ip6.h>
#include <netinet6/in6_pcb.h>
#include <netinet6/ip6_var.h>
#include <netinet6/nd6.h>
#include <netinet/tcp.h>
#include <netinet/tcp_fsm.h>
#include <netinet/tcp_seq.h>
#include <netinet/tcp_timer.h>
#include <netinet/tcp_var.h>
#include <netinet6/tcp6_var.h>
#include <netinet/tcpip.h>
Go to the source code of this file.
Macros | |
#define | TCP_R_LOG_ADD 1 |
#define | TCP_R_LOG_LIMIT_REACHED 2 |
#define | TCP_R_LOG_APPEND 3 |
#define | TCP_R_LOG_PREPEND 4 |
#define | TCP_R_LOG_REPLACE 5 |
#define | TCP_R_LOG_MERGE_INTO 6 |
#define | TCP_R_LOG_NEW_ENTRY 7 |
#define | TCP_R_LOG_READ 8 |
#define | TCP_R_LOG_ZERO 9 |
#define | TCP_R_LOG_DUMP 10 |
#define | TCP_R_LOG_TRIM 11 |
Functions | |
__FBSDID ("$FreeBSD$") | |
static | SYSCTL_NODE (_net_inet_tcp, OID_AUTO, reass, CTLFLAG_RW|CTLFLAG_MPSAFE, 0, "TCP Segment Reassembly Queue") |
static | SYSCTL_NODE (_net_inet_tcp_reass, OID_AUTO, stats, CTLFLAG_RW|CTLFLAG_MPSAFE, 0, "TCP Segment Reassembly stats") |
SYSCTL_INT (_net_inet_tcp_reass, OID_AUTO, maxsegments, CTLFLAG_RDTUN, &tcp_reass_maxseg, 0, "Global maximum number of TCP Segments in Reassembly Queue") | |
SYSCTL_UMA_CUR (_net_inet_tcp_reass, OID_AUTO, cursegments, 0, &tcp_reass_zone, "Global number of TCP Segments currently in Reassembly Queue") | |
SYSCTL_UINT (_net_inet_tcp_reass, OID_AUTO, maxqueuelen, CTLFLAG_RWTUN, &tcp_reass_maxqueuelen, 0, "Maximum number of TCP Segments per Reassembly Queue") | |
SYSCTL_INT (_net_inet_tcp_reass, OID_AUTO, new_limit, CTLFLAG_RWTUN, &tcp_new_limits, 0, "Do we use the new limit method we are discussing?") | |
SYSCTL_UINT (_net_inet_tcp_reass, OID_AUTO, queueguard, CTLFLAG_RWTUN, &tcp_reass_queue_guard, 16, "Number of TCP Segments in Reassembly Queue where we flip over to guard mode") | |
static void | tcp_reass_zone_change (void *tag) |
void | tcp_reass_global_init (void) |
void | tcp_reass_flush (struct tcpcb *tp) |
static void | tcp_reass_append (struct tcpcb *tp, struct tseg_qent *last, struct mbuf *m, struct tcphdr *th, int tlen, struct mbuf *mlast, int lenofoh) |
static void | tcp_reass_prepend (struct tcpcb *tp, struct tseg_qent *first, struct mbuf *m, struct tcphdr *th, int tlen, struct mbuf *mlast, int lenofoh) |
static void | tcp_reass_replace (struct tcpcb *tp, struct tseg_qent *q, struct mbuf *m, tcp_seq seq, int len, struct mbuf *mlast, int mbufoh, uint16_t flags) |
static void | tcp_reass_merge_into (struct tcpcb *tp, struct tseg_qent *ent, struct tseg_qent *q) |
static void | tcp_reass_merge_forward (struct tcpcb *tp, struct tseg_qent *ent) |
static int | tcp_reass_overhead_of_chain (struct mbuf *m, struct mbuf **mlast) |
int | tcp_reass (struct tcpcb *tp, struct tcphdr *th, tcp_seq *seq_start, int *tlenp, struct mbuf *m) |
Variables | |
static int | tcp_reass_maxseg = 0 |
static uma_zone_t | tcp_reass_zone |
static u_int | tcp_reass_maxqueuelen = 100 |
static int | tcp_new_limits = 0 |
static u_int | tcp_reass_queue_guard = 16 |
#define TCP_R_LOG_ADD 1 |
Definition at line 89 of file tcp_reass.c.
#define TCP_R_LOG_APPEND 3 |
Definition at line 91 of file tcp_reass.c.
#define TCP_R_LOG_DUMP 10 |
Definition at line 98 of file tcp_reass.c.
#define TCP_R_LOG_LIMIT_REACHED 2 |
Definition at line 90 of file tcp_reass.c.
#define TCP_R_LOG_MERGE_INTO 6 |
Definition at line 94 of file tcp_reass.c.
#define TCP_R_LOG_NEW_ENTRY 7 |
Definition at line 95 of file tcp_reass.c.
#define TCP_R_LOG_PREPEND 4 |
Definition at line 92 of file tcp_reass.c.
#define TCP_R_LOG_READ 8 |
Definition at line 96 of file tcp_reass.c.
#define TCP_R_LOG_REPLACE 5 |
Definition at line 93 of file tcp_reass.c.
#define TCP_R_LOG_TRIM 11 |
Definition at line 99 of file tcp_reass.c.
#define TCP_R_LOG_ZERO 9 |
Definition at line 97 of file tcp_reass.c.
__FBSDID | ( | "$FreeBSD$" | ) |
SYSCTL_INT | ( | _net_inet_tcp_reass | , |
OID_AUTO | , | ||
maxsegments | , | ||
CTLFLAG_RDTUN | , | ||
& | tcp_reass_maxseg, | ||
0 | , | ||
"Global maximum number of TCP Segments in Reassembly Queue" | |||
) |
SYSCTL_INT | ( | _net_inet_tcp_reass | , |
OID_AUTO | , | ||
new_limit | , | ||
CTLFLAG_RWTUN | , | ||
& | tcp_new_limits, | ||
0 | , | ||
"Do we use the new limit method we are discussing?" | |||
) |
|
static |
|
static |
SYSCTL_UINT | ( | _net_inet_tcp_reass | , |
OID_AUTO | , | ||
maxqueuelen | , | ||
CTLFLAG_RWTUN | , | ||
& | tcp_reass_maxqueuelen, | ||
0 | , | ||
"Maximum number of TCP Segments per Reassembly Queue" | |||
) |
SYSCTL_UINT | ( | _net_inet_tcp_reass | , |
OID_AUTO | , | ||
queueguard | , | ||
CTLFLAG_RWTUN | , | ||
& | tcp_reass_queue_guard, | ||
16 | , | ||
"Number of TCP Segments in Reassembly Queue where we flip over to guard mode" | |||
) |
SYSCTL_UMA_CUR | ( | _net_inet_tcp_reass | , |
OID_AUTO | , | ||
cursegments | , | ||
0 | , | ||
& | tcp_reass_zone, | ||
"Global number of TCP Segments currently in Reassembly Queue" | |||
) |
int tcp_reass | ( | struct tcpcb * | tp, |
struct tcphdr * | th, | ||
tcp_seq * | seq_start, | ||
int * | tlenp, | ||
struct mbuf * | m | ||
) |
+--last v
reassembly buffer |—| |—| |—| new segment |—|
+--last v
reassembly buffer |—| |—| |—| new segment |—|
first-------+ v
rea: |—| |—| |—| new: |—| Note the case we do not deal with here is: rea= |—| |—| |—| new= |-—| Due to the fact that it could be new |-----------------—| And we might need to merge forward.
first---->+ v
rea= |—| .... new" |—|
Now is this fit just in-between only? i.e.: p—+ +-—q v v res= |–| |–| |–| nee |-|
If we reach here we have some (possibly all) overlap such as: res= |–| |–| |–| new= |-—| or new= |--------------—| or new= |-----—| or new= |—| or new= |--------—|
prev seg---->+ v
reassembly buffer |—| new segment |-|
prev seg---->+ v
reassembly buffer |—| new segment |--—|
prev seg---->+ v
reassembly buffer |–| |—| new segment |–| (note: it was trimmed above if it overlapped)
next seg---->+ v
reassembly buffer |–| |—| new segment |-------—|
next seg---->+ v
reassembly buffer |–| |—| new segment |-------—|
Definition at line 526 of file tcp_reass.c.
References inpcb::inp_inc, inpcb::inp_socket, INP_WLOCK_ASSERT, tcpcb::rcv_nxt, SEQ_GEQ, SEQ_GT, SEQ_LEQ, SEQ_LT, tcpcb::t_flags, tcpcb::t_inpcb, tcpcb::t_maxseg, tcpcb::t_rcvoopack, tcpcb::t_segq, tcpcb::t_segqlen, tcpcb::t_segqmbuflen, tcpcb::t_state, tcp_get_flags(), tcp_log_addrs(), tcp_new_limits, TCP_R_LOG_ADD, TCP_R_LOG_LIMIT_REACHED, TCP_R_LOG_NEW_ENTRY, TCP_R_LOG_READ, TCP_R_LOG_TRIM, TCP_R_LOG_ZERO, tcp_reass_append(), tcp_reass_maxqueuelen, tcp_reass_merge_forward(), tcp_reass_overhead_of_chain(), tcp_reass_prepend(), tcp_reass_queue_guard, tcp_reass_replace(), tcp_reass_zone, TCPS_HAVEESTABLISHED, tcps_rcvmemdrop, TCPSTAT_ADD, TCPSTAT_INC, TF_WAKESOR, tseg_qent::tqe_flags, tseg_qent::tqe_last, tseg_qent::tqe_len, tseg_qent::tqe_m, tseg_qent::tqe_mbuf_cnt, and tseg_qent::tqe_start.
Referenced by bbr_do_syn_recv(), bbr_process_data(), rack_do_syn_recv(), rack_process_data(), and tcp_do_segment().
|
static |
Definition at line 324 of file tcp_reass.c.
References tcpcb::t_rcvoopack, tcp_get_flags(), TCP_R_LOG_APPEND, TCPSTAT_ADD, TCPSTAT_INC, tseg_qent::tqe_flags, tseg_qent::tqe_last, tseg_qent::tqe_len, tseg_qent::tqe_m, tseg_qent::tqe_mbuf_cnt, and tseg_qent::tqe_start.
Referenced by tcp_reass().
void tcp_reass_flush | ( | struct tcpcb * | tp | ) |
Definition at line 305 of file tcp_reass.c.
References INP_WLOCK_ASSERT, tcpcb::t_inpcb, tcpcb::t_segq, tcpcb::t_segqlen, tcpcb::t_segqmbuflen, tcp_reass_zone, and tseg_qent::tqe_m.
Referenced by tcp_discardcb(), and tcp_drain().
void tcp_reass_global_init | ( | void | ) |
Definition at line 273 of file tcp_reass.c.
References tcp_reass_maxseg, tcp_reass_zone, and tcp_reass_zone_change().
Referenced by tcp_init().
Definition at line 446 of file tcp_reass.c.
References SEQ_GEQ, SEQ_GT, tcpcb::t_segq, tcpcb::t_segqlen, tcpcb::t_segqmbuflen, TCP_R_LOG_TRIM, tcp_reass_merge_into(), tcp_reass_zone, tseg_qent::tqe_len, tseg_qent::tqe_m, tseg_qent::tqe_mbuf_cnt, and tseg_qent::tqe_start.
Referenced by tcp_reass().
|
static |
Definition at line 421 of file tcp_reass.c.
References tcpcb::t_segq, tcpcb::t_segqlen, TCP_R_LOG_MERGE_INTO, tcp_reass_zone, tseg_qent::tqe_flags, tseg_qent::tqe_last, tseg_qent::tqe_len, tseg_qent::tqe_m, and tseg_qent::tqe_mbuf_cnt.
Referenced by tcp_reass_merge_forward().
|
static |
Definition at line 498 of file tcp_reass.c.
Referenced by tcp_reass().
|
static |
Definition at line 350 of file tcp_reass.c.
References SEQ_GT, tcpcb::t_rcvoopack, TCP_R_LOG_PREPEND, TCP_R_LOG_TRIM, TCPSTAT_ADD, TCPSTAT_INC, tseg_qent::tqe_len, tseg_qent::tqe_m, tseg_qent::tqe_mbuf_cnt, and tseg_qent::tqe_start.
Referenced by tcp_reass().
|
static |
Definition at line 386 of file tcp_reass.c.
References tcpcb::t_rcvoopack, tcpcb::t_segqmbuflen, TCP_R_LOG_REPLACE, TCPSTAT_ADD, TCPSTAT_INC, tseg_qent::tqe_flags, tseg_qent::tqe_last, tseg_qent::tqe_len, tseg_qent::tqe_m, tseg_qent::tqe_mbuf_cnt, and tseg_qent::tqe_start.
Referenced by tcp_reass().
|
static |
Definition at line 192 of file tcp_reass.c.
References tcp_reass_maxseg, and tcp_reass_zone.
Referenced by tcp_reass_global_init().
|
static |
Definition at line 124 of file tcp_reass.c.
Referenced by tcp_reass().
|
static |
Definition at line 119 of file tcp_reass.c.
Referenced by tcp_reass().
|
static |
Definition at line 109 of file tcp_reass.c.
Referenced by tcp_reass_global_init(), and tcp_reass_zone_change().
|
static |
Definition at line 129 of file tcp_reass.c.
Referenced by tcp_reass().
|
static |
Definition at line 114 of file tcp_reass.c.
Referenced by tcp_reass(), tcp_reass_flush(), tcp_reass_global_init(), tcp_reass_merge_forward(), tcp_reass_merge_into(), and tcp_reass_zone_change().