Lines Matching defs:key
87 static int tcp_v4_md5_hash_hdr(char *md5_hash, const struct tcp_md5sig_key *key,
679 struct tcp_md5sig_key *key = NULL;
731 key = tcp_md5_do_lookup(sk, l3index, addr, AF_INET);
740 * source port, and then find md5 key through listening socket.
742 * Incoming packet is checked with md5 hash with finding key,
749 /* don't send rst if it can't find key */
758 key = tcp_md5_do_lookup(sk1, l3index, addr, AF_INET);
759 if (!key)
763 genhash = tcp_v4_md5_hash_skb(newhash, key, NULL, skb);
769 if (key) {
779 key, ip_hdr(skb)->saddr,
843 struct tcp_md5sig_key *key,
884 if (key) {
895 key, ip_hdr(skb)->saddr,
1062 struct tcp_md5sig_key *key;
1074 hlist_for_each_entry_rcu(key, &md5sig->head, node,
1076 if (key->family != family)
1078 if (key->l3index && key->l3index != l3index)
1081 mask = inet_make_mask(key->prefixlen);
1082 match = (key->addr.a4.s_addr & mask) ==
1086 match = ipv6_prefix_equal(&key->addr.a6, &addr->a6,
1087 key->prefixlen);
1093 if (match && better_md5_match(best_match, key))
1094 best_match = key;
1106 struct tcp_md5sig_key *key;
1119 hlist_for_each_entry_rcu(key, &md5sig->head, node,
1121 if (key->family != family)
1123 if (key->l3index != l3index)
1125 if (!memcmp(&key->addr, addr, size) &&
1126 key->prefixlen == prefixlen)
1127 return key;
1151 struct tcp_md5sig_key *key;
1155 key = tcp_md5_do_lookup_exact(sk, addr, family, prefixlen, l3index);
1156 if (key) {
1158 * Note that the key might be used concurrently.
1160 * key mismatches, since changing MD5 key on live flows
1163 data_race(memcpy(key->key, newkey, newkeylen));
1166 * Also note that a reader could catch new key->keylen value
1167 * but old key->key[], this is the reason we use __GFP_ZERO
1170 WRITE_ONCE(key->keylen, newkeylen);
1187 key = sock_kmalloc(sk, sizeof(*key), gfp | __GFP_ZERO);
1188 if (!key)
1191 sock_kfree_s(sk, key, sizeof(*key));
1195 memcpy(key->key, newkey, newkeylen);
1196 key->keylen = newkeylen;
1197 key->family = family;
1198 key->prefixlen = prefixlen;
1199 key->l3index = l3index;
1200 memcpy(&key->addr, addr,
1203 hlist_add_head_rcu(&key->node, &md5sig->head);
1211 struct tcp_md5sig_key *key;
1213 key = tcp_md5_do_lookup_exact(sk, addr, family, prefixlen, l3index);
1214 if (!key)
1216 hlist_del_rcu(&key->node);
1217 atomic_sub(sizeof(*key), &sk->sk_omem_alloc);
1218 kfree_rcu(key, rcu);
1226 struct tcp_md5sig_key *key;
1232 hlist_for_each_entry_safe(key, n, &md5sig->head, node) {
1233 hlist_del_rcu(&key->node);
1234 atomic_sub(sizeof(*key), &sk->sk_omem_alloc);
1235 kfree_rcu(key, rcu);
1319 static int tcp_v4_md5_hash_hdr(char *md5_hash, const struct tcp_md5sig_key *key,
1334 if (tcp_md5_hash_key(hp, key))
1350 int tcp_v4_md5_hash_skb(char *md5_hash, const struct tcp_md5sig_key *key,
1380 if (tcp_md5_hash_key(hp, key))
1543 struct tcp_md5sig_key *key;
1599 /* Copy over the MD5 key from the original socket */
1601 key = tcp_md5_do_lookup(sk, l3index, addr, AF_INET);
1602 if (key) {
1604 * We're using one, so create a matching key
1606 * memory, then we end up not copying the key
1610 key->key, key->keylen, GFP_ATOMIC);
2257 /* Clean up the MD5 key list, if any */