Lines Matching refs:tcp
69 #include <netinet/tcp.h>
339 /* - initialise all of the timeout queues, including a table for TCP, some */
1356 tcphdr_t *tcp;
1421 tcp = NULL;
1542 tcp = fin->fin_dp;
1544 if (tcp->th_flags & TH_RST) {
1566 * state information structure from the TCP header information.
1570 is->is_maxswin = ntohs(tcp->th_win);
1575 is->is_send = ntohl(tcp->th_seq) + fin->fin_dlen -
1576 (TCP_OFF(tcp) << 2) +
1577 ((tcp->th_flags & TH_SYN) ? 1 : 0) +
1578 ((tcp->th_flags & TH_FIN) ? 1 : 0);
1585 if ((tcp->th_flags & ~(TH_FIN|TH_ACK|TH_ECNALL)) ==
1587 (TCP_OFF(tcp) > (sizeof(tcphdr_t) >> 2))) {
1588 if (ipf_tcpoptions(softs, fin, tcp,
1598 if ((tcp->th_flags & TH_OPENING) == TH_SYN)
1602 is->is_dend = ntohl(tcp->th_ack);
1603 is->is_maxdend = ntohl(tcp->th_ack);
1616 tcp = fin->fin_dp;
1621 hv += tcp->th_dport;
1622 hv += tcp->th_sport;
1857 /* -1 == packet has bad TCP options data */
1860 /* tcp(I) - pointer to TCP packet header */
1861 /* td(I) - pointer to TCP data held as part of the state */
1863 /* Look after the TCP header for any options and deal with those that are */
1867 ipf_tcpoptions(ipf_state_softc_t *softs, fr_info_t *fin, tcphdr_t *tcp,
1874 len = (TCP_OFF(tcp) << 2);
1879 len -= sizeof(*tcp);
1881 off = fin->fin_plen - fin->fin_dlen + sizeof(*tcp) + fin->fin_ipoff;
1908 * Extract the TCP options we are interested in out of
1928 * So, if we wanted to set the TCP MAXSEG,
1963 /* tcp(I) - pointer to TCP packet header */
1966 /* Check to see if a packet with TCP headers fits within the TCP window. */
1972 tcphdr_t *tcp, ipstate_t *is)
1990 if ((tcp->th_flags & TH_OPENING) == TH_SYN) {
2007 ret = ipf_state_tcpinwindow(fin, fdata, tdata, tcp,
2031 * Compare with ~TH_FIN to mask out T/TCP setups.
2033 flags = tcp->th_flags & ~(TH_FIN|TH_ECNALL);
2035 is->is_s0[source] = ntohl(tcp->th_ack);
2036 is->is_s0[!source] = ntohl(tcp->th_seq) + 1;
2037 if ((TCP_OFF(tcp) > (sizeof(tcphdr_t) >> 2))) {
2038 if (ipf_tcpoptions(softs, fin, tcp,
2045 is->is_s0[source] = ntohl(tcp->th_seq) + 1;
2046 if ((TCP_OFF(tcp) > (sizeof(tcphdr_t) >> 2))) {
2047 if (ipf_tcpoptions(softs, fin, tcp,
2073 /* Check to see if this TCP connection is expecting and needs a new */
2083 tcphdr_t *tcp;
2087 tcp = fin->fin_dp;
2091 old = ntohl(tcp->th_seq);
2104 /* Returns: int - 1 == packet inside TCP "window", 0 == not inside. */
2106 /* fdata(I) - pointer to tcp state informatio (forward) */
2107 /* tdata(I) - pointer to tcp state informatio (reverse) */
2108 tcp(I) - pointer to TCP packet header */
2111 /* within the TCP data window. In a show of generosity, allow packets that */
2116 tcphdr_t *tcp, int flags)
2128 tcpflags = tcp->th_flags;
2129 seq = ntohl(tcp->th_seq);
2130 ack = ntohl(tcp->th_ack);
2132 win = ntohs(tcp->th_win);
2134 win = ntohs(tcp->th_win) << fdata->td_winscale;
2142 dsize = fin->fin_dlen - (TCP_OFF(tcp) << 2) +
2178 /* gross hack to get around certain broken tcp stacks */
2218 * Sometimes a TCP RST will be generated with only the ACK field
2263 * some TCP connections in the state cache are hashed with
2292 /* tcp(I) - pointer to TCP/UDP header */
2298 ipf_state_clone(fr_info_t *fin, tcphdr_t *tcp, ipstate_t *is)
2330 send = ntohl(tcp->th_seq) + fin->fin_dlen - (TCP_OFF(tcp) << 2) +
2331 ((tcp->th_flags & TH_SYN) ? 1 : 0) +
2332 ((tcp->th_flags & TH_FIN) ? 1 : 0);
2339 clone->is_maxdwin = ntohs(tcp->th_win);
2347 clone->is_maxswin = ntohs(tcp->th_win);
2380 /* tcp(I) - pointer to TCP/UDP header */
2389 tcphdr_t *tcp, u_32_t cmask)
2412 if (tcp != NULL) {
2417 if (tcp != NULL) {
2450 if (tcp) {
2462 if (tcp) {
2484 if (tcp == NULL)
2551 clone = ipf_state_clone(fin, tcp, is);
2562 is->is_send = ntohl(tcp->th_seq);
2565 is->is_send = ntohl(tcp->th_ack);
2571 is->is_dend = ntohl(tcp->th_ack);
2574 is->is_dend = ntohl(tcp->th_seq);
2633 tcphdr_t *tcp;
2677 * outside the ICMP packet, leading to TCP deref's causing problems.
2801 tcp = (tcphdr_t *)((char *)oip + (IP_HL(oip) << 2));
2803 hv += tcp->th_dport;;
2804 hv += tcp->th_sport;;
2815 * tcp internals such as seq and ack numbers. Only the
2821 tcp, FI_ICMPCMP))) {
2957 /* tcp(I) - pointer to TCP/UDP header. */
2968 ipf_state_lookup(fr_info_t *fin, tcphdr_t *tcp, ipftq_t **ifqp)
2982 tcp = fin->fin_dp;
2983 ic = (struct icmp *)tcp;
3142 is = ipf_matchsrcdst(fin, is, &src, &dst, tcp, FI_CMP);
3146 tcp, is)) {
3255 tcphdr_t *tcp;
3274 tcp = fin->fin_dp;
3276 tcp = NULL;
3282 is = ipf_state_lookup(fin, tcp, &ifq);
3359 * For TCP packets, ifq == NULL. For all others, check if this new
3404 /* TCP checksum to match that change. */
3409 tcphdr_t *tcp;
3413 tcp = fin->fin_dp;
3417 seq = ntohl(tcp->th_seq);
3419 tcp->th_seq = htonl(seq);
3420 ipf_fix_outcksum(0, &tcp->th_sum, is->is_sumd[0], 0);
3425 seq = ntohl(tcp->th_seq);
3427 tcp->th_seq = htonl(seq);
3428 ipf_fix_outcksum(0, &tcp->th_sum, is->is_sumd[1], 0);
3441 /* TCP checksum to match that change. */
3446 tcphdr_t *tcp;
3450 tcp = fin->fin_dp;
3454 ack = ntohl(tcp->th_ack);
3456 tcp->th_ack = htonl(ack);
3457 ipf_fix_incksum(0, &tcp->th_sum, is->is_sumd[0], 0);
3462 ack = ntohl(tcp->th_ack);
3464 tcp->th_ack = htonl(ack);
3465 ipf_fix_incksum(0, &tcp->th_sum, is->is_sumd[1], 0);
3729 /* which == 1 : flush TCP connections which have started to close but are */
3731 /* which == 2 : flush TCP connections which have been idle for a long time, */
3816 * for TCP connections.
3914 /* tqtab(I) - TCP timeout queue table this is in */
3922 /* diagram 18.12 of TCP/IP volume 1 by W. Richard Stevens was used. */
3965 tcphdr_t *tcp;
3967 tcp = fin->fin_dp;
3971 tcpflags = tcp->th_flags;
3972 dlen = fin->fin_dlen - (TCP_OFF(tcp) << 2);
4007 * used for tcp connections of course
4047 * in the TCP FSM. Setting rval to 2 has the
4375 tcphdr_t *tcp;
4503 tcp = NULL;
4509 tcp = (tcphdr_t *)(oip6 + 1);
4510 dport = tcp->th_dport;
4511 sport = tcp->th_sport;
4536 * tcp internals such as seq and ack numbers.
4541 is = ipf_matchsrcdst(&ofin, is, &src, &dst, tcp, FI_ICMPCMP);
4556 /* tqp(I) - pointer to an array of timeout queues for TCP */
4558 /* Initialise the array of timeout queues for TCP. */
4566 IPFTQ_INIT(&tqp[i], 0, "ipftq tcp tab");
4588 /* Parameters: tqp(I) - pointer to an array of timeout queues for TCP */
4591 /* of timeout queues for TCP. */