aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/tcp.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/tcp.h')
-rw-r--r--include/net/tcp.h89
1 files changed, 1 insertions, 88 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h
index ab9f947b118b..7f2f17198d75 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -179,7 +179,6 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
179#define TCPOPT_SACK 5 /* SACK Block */ 179#define TCPOPT_SACK 5 /* SACK Block */
180#define TCPOPT_TIMESTAMP 8 /* Better RTT estimations/PAWS */ 180#define TCPOPT_TIMESTAMP 8 /* Better RTT estimations/PAWS */
181#define TCPOPT_MD5SIG 19 /* MD5 Signature (RFC2385) */ 181#define TCPOPT_MD5SIG 19 /* MD5 Signature (RFC2385) */
182#define TCPOPT_COOKIE 253 /* Cookie extension (experimental) */
183#define TCPOPT_EXP 254 /* Experimental */ 182#define TCPOPT_EXP 254 /* Experimental */
184/* Magic number to be after the option value for sharing TCP 183/* Magic number to be after the option value for sharing TCP
185 * experimental options. See draft-ietf-tcpm-experimental-options-00.txt 184 * experimental options. See draft-ietf-tcpm-experimental-options-00.txt
@@ -454,7 +453,7 @@ extern void tcp_syn_ack_timeout(struct sock *sk, struct request_sock *req);
454extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, 453extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
455 size_t len, int nonblock, int flags, int *addr_len); 454 size_t len, int nonblock, int flags, int *addr_len);
456extern void tcp_parse_options(const struct sk_buff *skb, 455extern void tcp_parse_options(const struct sk_buff *skb,
457 struct tcp_options_received *opt_rx, const u8 **hvpp, 456 struct tcp_options_received *opt_rx,
458 int estab, struct tcp_fastopen_cookie *foc); 457 int estab, struct tcp_fastopen_cookie *foc);
459extern const u8 *tcp_parse_md5sig_option(const struct tcphdr *th); 458extern const u8 *tcp_parse_md5sig_option(const struct tcphdr *th);
460 459
@@ -476,7 +475,6 @@ extern int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr,
476extern int tcp_connect(struct sock *sk); 475extern int tcp_connect(struct sock *sk);
477extern struct sk_buff * tcp_make_synack(struct sock *sk, struct dst_entry *dst, 476extern struct sk_buff * tcp_make_synack(struct sock *sk, struct dst_entry *dst,
478 struct request_sock *req, 477 struct request_sock *req,
479 struct request_values *rvp,
480 struct tcp_fastopen_cookie *foc); 478 struct tcp_fastopen_cookie *foc);
481extern int tcp_disconnect(struct sock *sk, int flags); 479extern int tcp_disconnect(struct sock *sk, int flags);
482 480
@@ -1589,91 +1587,6 @@ struct tcp_request_sock_ops {
1589#endif 1587#endif
1590}; 1588};
1591 1589
1592/* Using SHA1 for now, define some constants.
1593 */
1594#define COOKIE_DIGEST_WORDS (SHA_DIGEST_WORDS)
1595#define COOKIE_MESSAGE_WORDS (SHA_MESSAGE_BYTES / 4)
1596#define COOKIE_WORKSPACE_WORDS (COOKIE_DIGEST_WORDS + COOKIE_MESSAGE_WORDS)
1597
1598extern int tcp_cookie_generator(u32 *bakery);
1599
1600/**
1601 * struct tcp_cookie_values - each socket needs extra space for the
1602 * cookies, together with (optional) space for any SYN data.
1603 *
1604 * A tcp_sock contains a pointer to the current value, and this is
1605 * cloned to the tcp_timewait_sock.
1606 *
1607 * @cookie_pair: variable data from the option exchange.
1608 *
1609 * @cookie_desired: user specified tcpct_cookie_desired. Zero
1610 * indicates default (sysctl_tcp_cookie_size).
1611 * After cookie sent, remembers size of cookie.
1612 * Range 0, TCP_COOKIE_MIN to TCP_COOKIE_MAX.
1613 *
1614 * @s_data_desired: user specified tcpct_s_data_desired. When the
1615 * constant payload is specified (@s_data_constant),
1616 * holds its length instead.
1617 * Range 0 to TCP_MSS_DESIRED.
1618 *
1619 * @s_data_payload: constant data that is to be included in the
1620 * payload of SYN or SYNACK segments when the
1621 * cookie option is present.
1622 */
1623struct tcp_cookie_values {
1624 struct kref kref;
1625 u8 cookie_pair[TCP_COOKIE_PAIR_SIZE];
1626 u8 cookie_pair_size;
1627 u8 cookie_desired;
1628 u16 s_data_desired:11,
1629 s_data_constant:1,
1630 s_data_in:1,
1631 s_data_out:1,
1632 s_data_unused:2;
1633 u8 s_data_payload[0];
1634};
1635
1636static inline void tcp_cookie_values_release(struct kref *kref)
1637{
1638 kfree(container_of(kref, struct tcp_cookie_values, kref));
1639}
1640
1641/* The length of constant payload data. Note that s_data_desired is
1642 * overloaded, depending on s_data_constant: either the length of constant
1643 * data (returned here) or the limit on variable data.
1644 */
1645static inline int tcp_s_data_size(const struct tcp_sock *tp)
1646{
1647 return (tp->cookie_values != NULL && tp->cookie_values->s_data_constant)
1648 ? tp->cookie_values->s_data_desired
1649 : 0;
1650}
1651
1652/**
1653 * struct tcp_extend_values - tcp_ipv?.c to tcp_output.c workspace.
1654 *
1655 * As tcp_request_sock has already been extended in other places, the
1656 * only remaining method is to pass stack values along as function
1657 * parameters. These parameters are not needed after sending SYNACK.
1658 *
1659 * @cookie_bakery: cryptographic secret and message workspace.
1660 *
1661 * @cookie_plus: bytes in authenticator/cookie option, copied from
1662 * struct tcp_options_received (above).
1663 */
1664struct tcp_extend_values {
1665 struct request_values rv;
1666 u32 cookie_bakery[COOKIE_WORKSPACE_WORDS];
1667 u8 cookie_plus:6,
1668 cookie_out_never:1,
1669 cookie_in_always:1;
1670};
1671
1672static inline struct tcp_extend_values *tcp_xv(struct request_values *rvp)
1673{
1674 return (struct tcp_extend_values *)rvp;
1675}
1676
1677extern void tcp_v4_init(void); 1590extern void tcp_v4_init(void);
1678extern void tcp_init(void); 1591extern void tcp_init(void);
1679 1592