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.h66
1 files changed, 30 insertions, 36 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 42c29bfbcee3..6b2acfce4cfd 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1138,35 +1138,27 @@ static inline void tcp_clear_all_retrans_hints(struct tcp_sock *tp)
1138/* MD5 Signature */ 1138/* MD5 Signature */
1139struct crypto_hash; 1139struct crypto_hash;
1140 1140
1141union tcp_md5_addr {
1142 struct in_addr a4;
1143#if IS_ENABLED(CONFIG_IPV6)
1144 struct in6_addr a6;
1145#endif
1146};
1147
1141/* - key database */ 1148/* - key database */
1142struct tcp_md5sig_key { 1149struct tcp_md5sig_key {
1143 u8 *key; 1150 struct hlist_node node;
1144 u8 keylen; 1151 u8 keylen;
1145}; 1152 u8 family; /* AF_INET or AF_INET6 */
1146 1153 union tcp_md5_addr addr;
1147struct tcp4_md5sig_key { 1154 u8 key[TCP_MD5SIG_MAXKEYLEN];
1148 struct tcp_md5sig_key base; 1155 struct rcu_head rcu;
1149 __be32 addr;
1150};
1151
1152struct tcp6_md5sig_key {
1153 struct tcp_md5sig_key base;
1154#if 0
1155 u32 scope_id; /* XXX */
1156#endif
1157 struct in6_addr addr;
1158}; 1156};
1159 1157
1160/* - sock block */ 1158/* - sock block */
1161struct tcp_md5sig_info { 1159struct tcp_md5sig_info {
1162 struct tcp4_md5sig_key *keys4; 1160 struct hlist_head head;
1163#if IS_ENABLED(CONFIG_IPV6) 1161 struct rcu_head rcu;
1164 struct tcp6_md5sig_key *keys6;
1165 u32 entries6;
1166 u32 alloced6;
1167#endif
1168 u32 entries4;
1169 u32 alloced4;
1170}; 1162};
1171 1163
1172/* - pseudo header */ 1164/* - pseudo header */
@@ -1203,19 +1195,25 @@ extern int tcp_v4_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key,
1203 const struct sock *sk, 1195 const struct sock *sk,
1204 const struct request_sock *req, 1196 const struct request_sock *req,
1205 const struct sk_buff *skb); 1197 const struct sk_buff *skb);
1206extern struct tcp_md5sig_key * tcp_v4_md5_lookup(struct sock *sk, 1198extern int tcp_md5_do_add(struct sock *sk, const union tcp_md5_addr *addr,
1207 struct sock *addr_sk); 1199 int family, const u8 *newkey,
1208extern int tcp_v4_md5_do_add(struct sock *sk, __be32 addr, u8 *newkey, 1200 u8 newkeylen, gfp_t gfp);
1209 u8 newkeylen); 1201extern int tcp_md5_do_del(struct sock *sk, const union tcp_md5_addr *addr,
1210extern int tcp_v4_md5_do_del(struct sock *sk, __be32 addr); 1202 int family);
1203extern struct tcp_md5sig_key *tcp_v4_md5_lookup(struct sock *sk,
1204 struct sock *addr_sk);
1211 1205
1212#ifdef CONFIG_TCP_MD5SIG 1206#ifdef CONFIG_TCP_MD5SIG
1213#define tcp_twsk_md5_key(twsk) ((twsk)->tw_md5_keylen ? \ 1207extern struct tcp_md5sig_key *tcp_md5_do_lookup(struct sock *sk,
1214 &(struct tcp_md5sig_key) { \ 1208 const union tcp_md5_addr *addr, int family);
1215 .key = (twsk)->tw_md5_key, \ 1209#define tcp_twsk_md5_key(twsk) ((twsk)->tw_md5_key)
1216 .keylen = (twsk)->tw_md5_keylen, \
1217 } : NULL)
1218#else 1210#else
1211static inline struct tcp_md5sig_key *tcp_md5_do_lookup(struct sock *sk,
1212 const union tcp_md5_addr *addr,
1213 int family)
1214{
1215 return NULL;
1216}
1219#define tcp_twsk_md5_key(twsk) NULL 1217#define tcp_twsk_md5_key(twsk) NULL
1220#endif 1218#endif
1221 1219
@@ -1470,10 +1468,6 @@ struct tcp_sock_af_ops {
1470 const struct sock *sk, 1468 const struct sock *sk,
1471 const struct request_sock *req, 1469 const struct request_sock *req,
1472 const struct sk_buff *skb); 1470 const struct sk_buff *skb);
1473 int (*md5_add) (struct sock *sk,
1474 struct sock *addr_sk,
1475 u8 *newkey,
1476 u8 len);
1477 int (*md5_parse) (struct sock *sk, 1471 int (*md5_parse) (struct sock *sk,
1478 char __user *optval, 1472 char __user *optval,
1479 int optlen); 1473 int optlen);