summaryrefslogtreecommitdiffstats
path: root/net/dns_resolver
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2019-06-26 16:02:33 -0400
committerDavid Howells <dhowells@redhat.com>2019-06-27 18:02:12 -0400
commita58946c158a040068e7c94dc1d58bbd273258068 (patch)
treee655258b700359cdfd9f762c099b7587dc0eed9b /net/dns_resolver
parent9b242610514fe387ef957bce05e1fdd3efd60359 (diff)
keys: Pass the network namespace into request_key mechanism
Create a request_key_net() function and use it to pass the network namespace domain tag into DNS revolver keys and rxrpc/AFS keys so that keys for different domains can coexist in the same keyring. Signed-off-by: David Howells <dhowells@redhat.com> cc: netdev@vger.kernel.org cc: linux-nfs@vger.kernel.org cc: linux-cifs@vger.kernel.org cc: linux-afs@lists.infradead.org
Diffstat (limited to 'net/dns_resolver')
-rw-r--r--net/dns_resolver/dns_query.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/net/dns_resolver/dns_query.c b/net/dns_resolver/dns_query.c
index 2d260432b3be..cab4e0df924f 100644
--- a/net/dns_resolver/dns_query.c
+++ b/net/dns_resolver/dns_query.c
@@ -40,6 +40,7 @@
40#include <linux/cred.h> 40#include <linux/cred.h>
41#include <linux/dns_resolver.h> 41#include <linux/dns_resolver.h>
42#include <linux/err.h> 42#include <linux/err.h>
43#include <net/net_namespace.h>
43 44
44#include <keys/dns_resolver-type.h> 45#include <keys/dns_resolver-type.h>
45#include <keys/user-type.h> 46#include <keys/user-type.h>
@@ -48,6 +49,7 @@
48 49
49/** 50/**
50 * dns_query - Query the DNS 51 * dns_query - Query the DNS
52 * @net: The network namespace to operate in.
51 * @type: Query type (or NULL for straight host->IP lookup) 53 * @type: Query type (or NULL for straight host->IP lookup)
52 * @name: Name to look up 54 * @name: Name to look up
53 * @namelen: Length of name 55 * @namelen: Length of name
@@ -69,7 +71,8 @@
69 * 71 *
70 * Returns the size of the result on success, -ve error code otherwise. 72 * Returns the size of the result on success, -ve error code otherwise.
71 */ 73 */
72int dns_query(const char *type, const char *name, size_t namelen, 74int dns_query(struct net *net,
75 const char *type, const char *name, size_t namelen,
73 const char *options, char **_result, time64_t *_expiry, 76 const char *options, char **_result, time64_t *_expiry,
74 bool invalidate) 77 bool invalidate)
75{ 78{
@@ -122,7 +125,7 @@ int dns_query(const char *type, const char *name, size_t namelen,
122 * add_key() to preinstall malicious redirections 125 * add_key() to preinstall malicious redirections
123 */ 126 */
124 saved_cred = override_creds(dns_resolver_cache); 127 saved_cred = override_creds(dns_resolver_cache);
125 rkey = request_key(&key_type_dns_resolver, desc, options); 128 rkey = request_key_net(&key_type_dns_resolver, desc, net, options);
126 revert_creds(saved_cred); 129 revert_creds(saved_cred);
127 kfree(desc); 130 kfree(desc);
128 if (IS_ERR(rkey)) { 131 if (IS_ERR(rkey)) {