diff options
author | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2006-11-14 22:07:45 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-03 00:22:39 -0500 |
commit | cfb6eeb4c860592edd123fdea908d23c6ad1c7dc (patch) | |
tree | 361c073622faa540ef6602ef1b0a6e8c0a17fc60 /include/linux | |
parent | bf6bce71eae386dbc37f93af7e5ad173450d9945 (diff) |
[TCP]: MD5 Signature Option (RFC2385) support.
Based on implementation by Rick Payne.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/tcp.h | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/include/linux/tcp.h b/include/linux/tcp.h index 2d36f6db3706..0aecfc955591 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h | |||
@@ -19,6 +19,7 @@ | |||
19 | 19 | ||
20 | #include <linux/types.h> | 20 | #include <linux/types.h> |
21 | #include <asm/byteorder.h> | 21 | #include <asm/byteorder.h> |
22 | #include <linux/socket.h> | ||
22 | 23 | ||
23 | struct tcphdr { | 24 | struct tcphdr { |
24 | __be16 source; | 25 | __be16 source; |
@@ -94,6 +95,7 @@ enum { | |||
94 | #define TCP_INFO 11 /* Information about this connection. */ | 95 | #define TCP_INFO 11 /* Information about this connection. */ |
95 | #define TCP_QUICKACK 12 /* Block/reenable quick acks */ | 96 | #define TCP_QUICKACK 12 /* Block/reenable quick acks */ |
96 | #define TCP_CONGESTION 13 /* Congestion control algorithm */ | 97 | #define TCP_CONGESTION 13 /* Congestion control algorithm */ |
98 | #define TCP_MD5SIG 14 /* TCP MD5 Signature (RFC2385) */ | ||
97 | 99 | ||
98 | #define TCPI_OPT_TIMESTAMPS 1 | 100 | #define TCPI_OPT_TIMESTAMPS 1 |
99 | #define TCPI_OPT_SACK 2 | 101 | #define TCPI_OPT_SACK 2 |
@@ -157,6 +159,17 @@ struct tcp_info | |||
157 | __u32 tcpi_total_retrans; | 159 | __u32 tcpi_total_retrans; |
158 | }; | 160 | }; |
159 | 161 | ||
162 | /* for TCP_MD5SIG socket option */ | ||
163 | #define TCP_MD5SIG_MAXKEYLEN 80 | ||
164 | |||
165 | struct tcp_md5sig { | ||
166 | struct __kernel_sockaddr_storage tcpm_addr; /* address associated */ | ||
167 | __u16 __tcpm_pad1; /* zero */ | ||
168 | __u16 tcpm_keylen; /* key length */ | ||
169 | __u32 __tcpm_pad2; /* zero */ | ||
170 | __u8 tcpm_key[TCP_MD5SIG_MAXKEYLEN]; /* key (binary) */ | ||
171 | }; | ||
172 | |||
160 | #ifdef __KERNEL__ | 173 | #ifdef __KERNEL__ |
161 | 174 | ||
162 | #include <linux/skbuff.h> | 175 | #include <linux/skbuff.h> |
@@ -197,9 +210,13 @@ struct tcp_options_received { | |||
197 | }; | 210 | }; |
198 | 211 | ||
199 | struct tcp_request_sock { | 212 | struct tcp_request_sock { |
200 | struct inet_request_sock req; | 213 | struct inet_request_sock req; |
201 | __u32 rcv_isn; | 214 | #ifdef CONFIG_TCP_MD5SIG |
202 | __u32 snt_isn; | 215 | /* Only used by TCP MD5 Signature so far. */ |
216 | struct tcp_request_sock_ops *af_specific; | ||
217 | #endif | ||
218 | __u32 rcv_isn; | ||
219 | __u32 snt_isn; | ||
203 | }; | 220 | }; |
204 | 221 | ||
205 | static inline struct tcp_request_sock *tcp_rsk(const struct request_sock *req) | 222 | static inline struct tcp_request_sock *tcp_rsk(const struct request_sock *req) |
@@ -363,6 +380,14 @@ struct tcp_sock { | |||
363 | __u32 probe_seq_start; | 380 | __u32 probe_seq_start; |
364 | __u32 probe_seq_end; | 381 | __u32 probe_seq_end; |
365 | } mtu_probe; | 382 | } mtu_probe; |
383 | |||
384 | #ifdef CONFIG_TCP_MD5SIG | ||
385 | /* TCP AF-Specific parts; only used by MD5 Signature support so far */ | ||
386 | struct tcp_sock_af_ops *af_specific; | ||
387 | |||
388 | /* TCP MD5 Signagure Option information */ | ||
389 | struct tcp_md5sig_info *md5sig_info; | ||
390 | #endif | ||
366 | }; | 391 | }; |
367 | 392 | ||
368 | static inline struct tcp_sock *tcp_sk(const struct sock *sk) | 393 | static inline struct tcp_sock *tcp_sk(const struct sock *sk) |
@@ -377,6 +402,10 @@ struct tcp_timewait_sock { | |||
377 | __u32 tw_rcv_wnd; | 402 | __u32 tw_rcv_wnd; |
378 | __u32 tw_ts_recent; | 403 | __u32 tw_ts_recent; |
379 | long tw_ts_recent_stamp; | 404 | long tw_ts_recent_stamp; |
405 | #ifdef CONFIG_TCP_MD5SIG | ||
406 | __u16 tw_md5_keylen; | ||
407 | __u8 tw_md5_key[TCP_MD5SIG_MAXKEYLEN]; | ||
408 | #endif | ||
380 | }; | 409 | }; |
381 | 410 | ||
382 | static inline struct tcp_timewait_sock *tcp_twsk(const struct sock *sk) | 411 | static inline struct tcp_timewait_sock *tcp_twsk(const struct sock *sk) |