DNS: Separate out CIFS DNS Resolver code
Subsystems (7)
David Howells
maintainerPATCH 1/2 DNS: Separate out CIFS DNS Resolver code
From: Wang Lei <[email protected]>
Separate out the DNS resolver key type from the CIFS filesystem into its own module so that it can be made available for general use, including the AFS filesystem module.
This facility makes it possible for the kernel to upcall to userspace to have it issue DNS requests, package up the replies and present them to the kernel in a useful form. The kernel is then able to cache the DNS replies as keys can be retained in keyrings.
Resolver keys are of type "dns_resolver" and have a case-insensitive description that is of the form "[<type>:]<domain_name>". The optional <type> indicates the particular DNS lookup and packaging that's required. The <domain_name> is the query to be made.
If <type> isn't given, a basic hostname to IP address lookup is made, and the result is stored in the key in the form of a printable string consisting of a comma-separated list of IPv4 and IPv6 addresses.
This key type is supported by userspace helpers driven from /sbin/request-key and configured through /etc/request-key.conf. The cifs.upcall utility is invoked for UNC path server name to IP address resolution.
The CIFS functionality is encapsulated by the dns_resolve_unc_to_ip() function, which is used to resolve a UNC path to an IP address for CIFS filesystem. This part remains in the CIFS module for now.
See the added Documentation/networking/dns_resolver.txt for more information.
---
Documentation/networking/dns_resolver.txt | 146 ++++++++++++++++++ fs/cifs/Kconfig | 17 +- fs/cifs/cifsfs.c | 13 -- fs/cifs/dns_resolve.c | 229 ++++++----------------------- fs/cifs/dns_resolve.h | 2 include/keys/dns_resolver-type.h | 23 +++ include/linux/dns_resolver.h | 34 ++++ net/Kconfig | 1 net/Makefile | 1 net/dns_resolver/Kconfig | 27 +++ net/dns_resolver/Makefile | 7 + net/dns_resolver/dns_key.c | 210 +++++++++++++++++++++++++++ net/dns_resolver/dns_query.c | 159 ++++++++++++++++++++ net/dns_resolver/internal.h | 44 ++++++ 14 files changed, 708 insertions(+), 205 deletions(-) create mode 100644 Documentation/networking/dns_resolver.txt create mode 100644 include/keys/dns_resolver-type.h create mode 100644 include/linux/dns_resolver.h create mode 100644 net/dns_resolver/Kconfig create mode 100644 net/dns_resolver/Makefile create mode 100644 net/dns_resolver/dns_key.c create mode 100644 net/dns_resolver/dns_query.c create mode 100644 net/dns_resolver/internal.h
Documentation/networking/dns_resolver.txt new file +146 -0
@@ -0,0 +1,146 @@ + =================== + DNS Resolver Module + =================== + +Contents: + + - Overview. + - Compilation. + - Setting up. + - Usage. + - Mechanism. + - Debugging. + + +======== +OVERVIEW +======== + +The DNS resolver module provides a way for kernel services to make DNS queries +by way of requesting a key of key type dns_resolver. These queries are +upcalled to userspace through /sbin/request-key. + +These routines must be supported by userspace tools dns.upcall, cifs.upcall and +request-key. It is under development and does not yet provide the full feature +set. The features it does support include: + + (*) Implements the dns_resolver key_type to contact userspace. + +It does not yet support the following AFS features: + + (*) Dns query support for AFSDB resource record. + +This code is extracted from the CIFS filesystem. + + +=========== +COMPILATION +=========== + +The module should be enabled by turning on the kernel configuration options: + + CONFIG_DNS_RESOLVER - tristate "DNS Resolver support" + + +========== +SETTING UP +========== + +To set up this facility, the /etc/request-key.conf file must be altered so that +/sbin/request-key can appropriately direct the upcalls. For example, to handle +basic dname to IPv4/IPv6 address resolution, the following line should be +added: + + #OP TYPE DESC CO-INFO PROGRAM ARG1 ARG2 ARG3 ... + #====== ============ ======= ======= ========================== + create dns_resolver * * /usr/sbin/cifs.upcall %k + +To direct a query for query type 'foo', a line of the following should be added +before the more general line given above as the first match is the one taken. + + create dns_resolver foo:* * /usr/sbin/dns.foo %k + + + +===== +USAGE +===== + +To make use of this facility, one of the following functions that are +implemented in the module can be called after doing: + + #include <linux/dns_resolver.h> + + (1) int dns_query(const char *type, const char *name, size_t namelen, + const char *options, char **_result, time_t *_expiry); + + This is the basic access function. It looks for a cached DNS query and if + it doesn't find it, it upcalls to userspace to make a new DNS query, which + may then be cached. The key description is constructed as a string of the + form: + + [<type>:]<name> + + where <type> optionally specifies the particular upcall program to invoke, + and thus the type of query to do, and <name> specifies the string to be + looked up. The default query type is a straight hostname to IP address + set lookup. + + The name parameter is not required to be a NUL-terminated string, and its + length should be given by the namelen argument. + + The options parameter may be NULL or it may be a set of options + appropriate to the query type. + + The return value is a string appropriate to the query type. For instance, + for the default query type it is just a list of comma-separated IPv4 and + IPv6 addresses. The caller must free the result. + + The length of the result string is returned on success, and a -ve error + code is returned otherwise. -EKEYREJECTED will be returned if the DNS + lookup failed. + + If _expiry is non-NULL, the expiry time (TTL) of the result will be + returned also. + + +========= +MECHANISM +========= + +The dnsresolver module registers a key type called "dns_resolver". Keys of +this type are used to transport and cache DNS lookup results from userspace. + +When dns_query() is invoked, it calls request_key() to search the local +keyrings for a cached DNS result. If that fails to find one, it upcalls to +userspace to get a new result. + +Upcalls to userspace are made through the request_key() upcall vector, and are +directed by means of configuration lines in /etc/request-key.conf that tell +/sbin/request-key what program to run to instantiate the key. + +The upcall handler program is responsible for querying the DNS, processing the +result into a form suitable for passing to the keyctl_instantiate_key() +routine. This then passes the data to dns_resolver_instantiate() which strips +off and processes any options included in the data, and then attaches the +remainder of the string to the key as its payload. + +The upcall handler program should set the expiry time on the key to that of the +lowest TTL of all the records it has extracted a result from. This means that +the key will be discarded and recreated when the data it holds has expired. + +dns_query() returns a copy of the value attached to the key, or an error if +that is indicated instead. + +See <file:Documentation/keys-request-key.txt> for further information about +request-key function. + + +========= +DEBUGGING +========= + +Debugging messages can be turned on dynamically by writing a 1 into the +following file: + + /sys/module/dnsresolver/parameters/debug
fs/cifs/Kconfig +9 -8
@@ -71,14 +71,14 @@ config CIFS_WEAK_PW_HASH If unsure, say N. config CIFS_UPCALL - bool "Kerberos/SPNEGO advanced session setup" - depends on CIFS && KEYS - help - Enables an upcall mechanism for CIFS which accesses - userspace helper utilities to provide SPNEGO packaged (RFC 4178) - Kerberos tickets which are needed to mount to certain secure servers - (for which more secure Kerberos authentication is required). If - unsure, say N. + bool "Kerberos/SPNEGO advanced session setup" + depends on CIFS && KEYS + select DNS_RESOLVER + help + Enables an upcall mechanism for CIFS which accesses userspace helper + utilities to provide SPNEGO packaged (RFC 4178) Kerberos tickets + which are needed to mount to certain secure servers (for which more + secure Kerberos authentication is required). If unsure, say N. config CIFS_XATTR bool "CIFS extended attributes"
@@ -122,6 +122,7 @@ config CIFS_DEBUG2 config CIFS_DFS_UPCALL bool "DFS feature support" depends on CIFS && KEYS + select DNS_RESOLVER help Distributed File System (DFS) support is used to access shares transparently in an enterprise name space, even if the share
fs/cifs/cifsfs.c +1 -12
@@ -45,7 +45,6 @@#include "cifs_fs_sb.h" #include <linux/mm.h> #include <linux/key-type.h> -#include "dns_resolve.h" #include "cifs_spnego.h" #include "fscache.h" #define CIFS_MAGIC_NUMBER 0xFF534D42/* the first four bytes of SMB PDUs */
@@ -934,22 +933,13 @@ init_cifs(void)if (rc) goto out_unregister_filesystem;#endif -#ifdef CONFIG_CIFS_DFS_UPCALL - rc =cifs_init_dns_resolver (); -if (rc) - goto out_unregister_key_type; -#endif rc =slow_work_register_user (THIS_MODULE );if (rc) - goto out_unregister_resolver_key; + goto out_unregister_key_type;return 0 ; - out_unregister_resolver_key: -#ifdef CONFIG_CIFS_DFS_UPCALL -cifs_exit_dns_resolver (); out_unregister_key_type: -#endif #ifdef CONFIG_CIFS_UPCALL unregister_key_type (&cifs_spnego_key_type); out_unregister_filesystem:
@@ -976,7 +966,6 @@ exit_cifs(void)cifs_fscache_unregister ();#ifdef CONFIG_CIFS_DFS_UPCALL cifs_dfs_release_automount_timer (); -cifs_exit_dns_resolver ();#endif #ifdef CONFIG_CIFS_UPCALL unregister_key_type (&cifs_spnego_key_type);
fs/cifs/dns_resolve.c +46 -183
264 lines not on this page · raw message
fs/cifs/dns_resolve.h +0 -2
@@ -24,8 +24,6 @@#define _DNS_RESOLVE_H#ifdef __KERNEL__ -extern int __init cifs_init_dns_resolver (void ); -extern void cifs_exit_dns_resolver (void );extern int dns_resolve_server_name_to_ip (const char *unc,char **ip_addr);#endif /* KERNEL */
include/keys/dns_resolver-type.h new file +23 -0
@@ -0,0 +1,23 @@ +/* DNS resolver key type +* +* Copyright (C) 2010 Wang Lei. All Rights Reserved. +* Written by Wang Lei ([email protected]) +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version +* 2 of the License, or (at your option) any later version. +*/ + +#ifndef _KEYS_DNS_RESOLVER_TYPE_H +#define _KEYS_DNS_RESOLVER_TYPE_H + +#include <linux/key-type.h> + +extern struct key_type key_type_dns_resolver; + +extern int request_dns_resolver_key (const char *description, +const char *callout_info, +char **data); + +#endif /* _KEYS_DNS_RESOLVER_TYPE_H */
include/linux/dns_resolver.h new file +34 -0
@@ -0,0 +1,34 @@ +/* +* DNS Resolver upcall management for CIFS DFS and AFS +* Handles host name to IP address resolution and DNS query for AFSDB RR. +* +* Copyright (c) International Business Machines Corp., 2008 +* Author(s): Steve French (sfrench-r/[email protected]) +* Wang Lei ([email protected]) +* +* This library is free software; you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation; either version 2.1 of the License, or +* (at your option) any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See +* the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License +* along with this library; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef _LINUX_DNS_RESOLVER_H +#define _LINUX_DNS_RESOLVER_H + +#ifdef __KERNEL__ + +extern int dns_query (const char *type,const char *name,size_t namelen, +const char *options,char **_result,time_t *_expiry); + +#endif /* KERNEL */ + +#endif /* _LINUX_DNS_RESOLVER_H */
net/Kconfig +1 -0
@@ -203,6 +203,7 @@ source "net/phonet/Kconfig" source "net/ieee802154/Kconfig" source "net/sched/Kconfig" source "net/dcb/Kconfig" +source "net/dns_resolver/Kconfig" config RPS boolean
net/Makefile +1 -0
@@ -67,3 +67,4 @@ ifeq ($(CONFIG_NET),y) obj-$(CONFIG_SYSCTL) += sysctl_net.o endif obj-$(CONFIG_WIMAX) += wimax/ +obj-$(CONFIG_DNS_RESOLVER) += dns_resolver/
net/dns_resolver/Kconfig new file +27 -0
@@ -0,0 +1,27 @@ +# +# Configuration for DNS Resolver +# +config DNS_RESOLVER + tristate "DNS Resolver support" + depends on NET && KEYS + help + Saying Y here will include support for the DNS Resolver key type + which can be used to make upcalls to perform DNS lookups in + userspace. + + DNS Resolver is used to query DNS server for information. Examples + being resolving a UNC hostname element to an IP address for CIFS or + performing a DNS query for AFSDB records so that AFS can locate a + cell's volume location database servers. + + DNS Resolver is used by the CIFS and AFS modules, and would support + samba4 later. DNS Resolver is supported by the userspace upcall + helper "/sbin/dns.resolver" via /etc/request-key.conf. + + See <file:Documentation/networking/dns_resolver.txt> for further + information. + + To compile this as a module, choose M here: the module will be called + dnsresolver. + + If unsure, say N.
net/dns_resolver/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# +# Makefile for the Linux DNS Resolver. +# + +obj-$(CONFIG_DNS_RESOLVER) += dns_resolver.o + +dns_resolver-objs := dns_key.o dns_query.o
net/dns_resolver/dns_key.c new file +210 -0
210 lines not on this page · raw message
net/dns_resolver/dns_query.c new file +159 -0
159 lines not on this page · raw message
net/dns_resolver/internal.h new file +44 -0
44 lines not on this page · raw message
David Howells
maintainerPATCH 2/2 DNS: Make AFS go to the DNS for AFSDB records for unknown cells
From: Wang Lei <[email protected]>
Add DNS query support for AFS so that it can get the IP addresses of Volume Location servers from the DNS using an AFSDB record.
This requires userspace support. /etc/request-key.conf must be configured to invoke a helper for dns_resolver type keys with a subtype of "afsdb:" in the description.
---
fs/afs/Kconfig | 1 + fs/afs/cell.c | 40 ++++++++++++++++++++++++++++++---------- 2 files changed, 31 insertions(+), 10 deletions(-)
fs/afs/Kconfig +1 -0
@@ -2,6 +2,7 @@ config AFS_FS tristate "Andrew File System support (AFS) (EXPERIMENTAL)" depends on INET && EXPERIMENTAL select AF_RXRPC + select DNS_RESOLVER help If you say Y here, you will get an experimental Andrew File System driver. It currently only supports unsecured read-only AFS access.
fs/afs/cell.c +30 -10
@@ -13,6 +13,7 @@#include <linux/slab.h> #include <linux/key.h> #include <linux/ctype.h> +#include <linux/dns_resolver.h> #include <linux/sched.h> #include <keys/rxrpc-type.h> #include "internal.h"
@@ -36,6 +37,8 @@ static struct afs_cell *afs_cell_alloc(const char *name, char *vllist)struct key *key;size_t namelen;char keyname[4 +AFS_MAXCELLNAME +1 ], *cp, *dp, *next; +char *dvllist =NULL , *_vllist =NULL ; +char delimiter =':' ;int ret;_enter ("%s,%s" , name, vllist);
@@ -43,8 +46,10 @@ static struct afs_cell *afs_cell_alloc(const char *name, char *vllist)BUG_ON (!name);/* TODO: want to look up "this cell" in the cache */ namelen =strlen (name); -if (namelen >AFS_MAXCELLNAME ) +if (namelen >AFS_MAXCELLNAME ) { +_leave (" = -ENAMETOOLONG" );return ERR_PTR (-ENAMETOOLONG ); + }/* allocate and initialise a cell record */ cell =kzalloc (sizeof (struct afs_cell ) + namelen +1 ,GFP_KERNEL );
@@ -64,15 +69,31 @@ static struct afs_cell *afs_cell_alloc(const char *name, char *vllist)INIT_LIST_HEAD (&cell->vl_list);spin_lock_init (&cell->vl_lock); +/* if the ip address is invalid, try dns query */ +if (!vllist ||strlen (vllist) <7 ) { + ret =dns_query ("afsdb" , name, namelen,"ipv4" , &dvllist,NULL ); +if (ret <0 ) { +_leave (" = %d" , ret); +return ERR_PTR (ret); + } + _vllist = dvllist; + +/* change the delimiter for user-space reply */ + delimiter =',' ; + + }else { + _vllist = vllist; + } +/* fill in the VL server list from the rest of the string */ do { unsigned a, b, c, d; - next = strchr(vllist, ':'); + next = strchr(_vllist, delimiter); if (next) *next++ = 0; - if (sscanf(vllist, "%u.%u.%u.%u", &a, &b, &c, &d) != 4) + if (sscanf(_vllist, "%u.%u.%u.%u", &a, &b, &c, &d) != 4) goto bad_address; if (a > 255 || b > 255 || c > 255 || d > 255)
@@ -81,7 +102,7 @@ static struct afs_cell *afs_cell_alloc(const char *name, char *vllist) cell->vl_addrs[cell->vl_naddrs++].s_addr =htonl ((a <<24 ) | (b <<16 ) | (c <<8 ) | d); - }while (cell->vl_naddrs <AFS_CELL_MAX_ADDRS && (vllist = next)); + }while (cell->vl_naddrs <AFS_CELL_MAX_ADDRS && (_vllist = next));/* create a key to represent an anonymous user */ memcpy (keyname,"afs@" ,4 );
@@ -110,6 +131,7 @@ bad_address: ret = -EINVAL ; error:key_put (cell->anonymous_key); +kfree (dvllist);kfree (cell);_leave (" = %d" , ret);return ERR_PTR (ret);
@@ -201,14 +223,12 @@ int afs_cell_init(char *rootcell) } cp =strchr (rootcell,':' ); -if (!cp) { -printk (KERN_ERR "kAFS: no VL server IP addresses specified\n" ); -_leave (" = -EINVAL" ); -return -EINVAL ; - } +if (!cp) +_debug ("kAFS: no VL server IP addresses specified" ); +else + *cp++ =0 ;/* allocate a cell record for the root cell */ - *cp++ =0 ; new_root =afs_cell_create (rootcell, cp);if (IS_ERR (new_root)) {_leave (" = %ld" ,PTR_ERR (new_root));
Quoted 5 lines · David Howells
From: Wang Lei <[email protected]>
Separate out the DNS resolver key type from the CIFS filesystem into its own module so that it can be made available for general use, including the AFS filesystem module.
Merged, after addressing trivial checkpatch error:
[sfrench@hera cifs-2.6]$ scripts/checkpatch.pl ~/dh1a.patch
ERROR: "(foo*)" should be "(foo *)"
#523: FILE: fs/cifs/dns_resolve.c:75:
+ rc = cifs_convert_address((struct sockaddr*)&ss, hostname, len);
total: 1 errors, 0 warnings, 999 lines checked
Signature · 3 lines
Thanks, Steve
Quoted 124 lines · On Wed, 04 Aug 2010 15:16:33 +0100 David Howells wrote:
From: Wang Lei <[email protected]>
See the added
Documentation/networking/dns_resolver.txtfor more information.
---Documentation/networking/dns_resolver.txt | 146 ++++++++++++++++++ fs/cifs/Kconfig | 17 +- fs/cifs/cifsfs.c | 13 -- fs/cifs/dns_resolve.c | 229 ++++++----------------------- fs/cifs/dns_resolve.h | 2 include/keys/dns_resolver-type.h | 23 +++ include/linux/dns_resolver.h | 34 ++++ net/Kconfig | 1 net/Makefile | 1 net/dns_resolver/Kconfig | 27 +++ net/dns_resolver/Makefile | 7 + net/dns_resolver/dns_key.c | 210 +++++++++++++++++++++++++++ net/dns_resolver/dns_query.c | 159 ++++++++++++++++++++ net/dns_resolver/internal.h | 44 ++++++ 14 files changed, 708 insertions(+), 205 deletions(-) create mode 100644 Documentation/networking/dns_resolver.txt create mode 100644 include/keys/dns_resolver-type.h create mode 100644 include/linux/dns_resolver.h create mode 100644 net/dns_resolver/Kconfig create mode 100644 net/dns_resolver/Makefile create mode 100644 net/dns_resolver/dns_key.c create mode 100644 net/dns_resolver/dns_query.c create mode 100644 net/dns_resolver/internal.hDocumentation/networking/dns_resolver.txt new file +89
-0@@ -0,0 +1,146 @@ + =================== + DNS Resolver Module + =================== + +Contents: + + - Overview. + - Compilation. + - Setting up. + - Usage. + - Mechanism. + - Debugging. + + +======== +OVERVIEW +======== + +The DNS resolver module provides a way for kernel services to make DNS queries +by way of requesting a key of key type dns_resolver. These queries are +upcalled to userspace through /sbin/request-key. + +These routines must be supported by userspace tools dns.upcall, cifs.upcall and +request-key. It is under development and does not yet provide the full feature +set. The features it does support include: + + (*) Implements the dns_resolver key_type to contact userspace. + +It does not yet support the following AFS features: + + (*) Dns query support for AFSDB resource record. + +This code is extracted from the CIFS filesystem. + + +=========== +COMPILATION +=========== + +The module should be enabled by turning on the kernel configuration options: + + CONFIG_DNS_RESOLVER - tristate "DNS Resolver support" + + +========== +SETTING UP +========== + +To set up this facility, the /etc/request-key.conf file must be altered so that +/sbin/request-key can appropriately direct the upcalls. For example, to handle +basic dname to IPv4/IPv6 address resolution, the following line should be +added: + + #OP TYPE DESC CO-INFO PROGRAM ARG1 ARG2 ARG3 ... + #====== ============ ======= ======= ========================== + create dns_resolver * * /usr/sbin/cifs.upcall %k + +To direct a query for query type 'foo', a line of the following should be added +before the more general line given above as the first match is the one taken. + + create dns_resolver foo:* * /usr/sbin/dns.foo %k + + + +===== +USAGE +===== + +To make use of this facility, one of the following functions that are +implemented in the module can be called after doing: + + #include <linux/dns_resolver.h> + + (1) int dns_query(const char *type, const char *name, size_t namelen, + const char *options, char **_result, time_t *_expiry); + + This is the basic access function. It looks for a cached DNS query and if + it doesn't find it, it upcalls to userspace to make a new DNS query, which + may then be cached. The key description is constructed as a string of the + form: + + [<type>:]<name> + + where <type> optionally specifies the particular upcall program to invoke, + and thus the type of query to do, and <name> specifies the string to be + looked up. The default query type is a straight hostname to IP address + set lookup. + + The name parameter is not required to be a NUL-terminated string, and its
Documentation/networking/dns_resolver.txt line 99
Quoted 10 lines
Documentation/networking/dns_resolver.txt new file +10
-0+ length should be given by the namelen argument. + + The options parameter may be NULL or it may be a set of options + appropriate to the query type. + + The return value is a string appropriate to the query type. For instance, + for the default query type it is just a list of comma-separated IPv4 and + IPv6 addresses. The caller must free the result. + + The length of the result string is returned on success, and a -ve error
s/-ve/negative/ please. Some readers won't know that "-ve" means.
include/keys/dns_resolver-type.h
Quoted 51 lines
Documentation/networking/dns_resolver.txt new file +47
-0+ code is returned otherwise. -EKEYREJECTED will be returned if the DNS + lookup failed. + + If _expiry is non-NULL, the expiry time (TTL) of the result will be + returned also. + + +========= +MECHANISM +========= + +The dnsresolver module registers a key type called "dns_resolver". Keys of +this type are used to transport and cache DNS lookup results from userspace. + +When dns_query() is invoked, it calls request_key() to search the local +keyrings for a cached DNS result. If that fails to find one, it upcalls to +userspace to get a new result. + +Upcalls to userspace are made through the request_key() upcall vector, and are +directed by means of configuration lines in /etc/request-key.conf that tell +/sbin/request-key what program to run to instantiate the key. + +The upcall handler program is responsible for querying the DNS, processing the +result into a form suitable for passing to the keyctl_instantiate_key() +routine. This then passes the data to dns_resolver_instantiate() which strips +off and processes any options included in the data, and then attaches the +remainder of the string to the key as its payload. + +The upcall handler program should set the expiry time on the key to that of the +lowest TTL of all the records it has extracted a result from. This means that +the key will be discarded and recreated when the data it holds has expired. + +dns_query() returns a copy of the value attached to the key, or an error if +that is indicated instead. + +See <file:Documentation/keys-request-key.txt> for further information about +request-key function. + + +========= +DEBUGGING +========= + +Debugging messages can be turned on dynamically by writing a 1 into the +following file: + + /sys/module/dnsresolver/parameters/debuginclude/keys/dns_resolver-type.h new file +0
-0
I sure would prefer not to mix - and _ in the file name.
Quoted 6 lines
net/dns_resolver/dns_query.c new file +0
-0@@ -0,0 +1,159 @@
...
Quoted 1 line
+/*
Use
/**
to make this kernel-doc, since the lines below here already are that.
Quoted 21 lines
+ *
dns_query- Query the DNS
+ * @type: Query type (or NULL for straighthost->IPlookup)
+ * @name: Name to look up
+ * @namelen: Length of name
+ * @options: Request options (or NULL if no options)
+ * @_result: Where to place the returned data.
+ * @_expiry: Where to store the result expiry time (or NULL)
+ *
+ * The data will be returned in the pointer at *result, and the caller is
+ * responsible for freeing it.
+ *
+ * The description should be of the form "[<query_type>:]<domain_name>", and
+ * the options need to be appropriate for the query type requested. If no
+ *query_typeis given, then the query is a straight hostname to IP address
+ * lookup.
+ *
+ * The DNS resolution lookup is performed by upcalling to userspace by way of
+ * requesting a key of typedns_resolver.
+ *
+ * Returns the size of the result on success, -ve error code otherwise.
+ */
net/dns_resolver/dns_query.c line 71
Quoted 3 lines
net/dns_resolver/dns_query.c new file +3
-0+int dns_query (const char *type,const char *name,size_t namelen, +const char *options,char **_result,time_t *_expiry) +{
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
A message that is not in the archive (sent off-list or not yet received): AANLkTikhKSWKO5L6GBGSWhCHRbicUs4ZNVxA_Y0Qnj-h-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Quoted 8 lines · Steve French
Merged, after addressing trivial checkpatch error:
[sfrench@hera cifs-2.6]$
scripts/checkpatch.pl~/dh1a.patch
ERROR: "(foo*)" should be "(foo *)"
#523: FILE:fs/cifs/dns_resolve.c:75:fs/cifs/dns_resolve.c +1
-0+ rc =cifs_convert_address ((struct sockaddr *)&ss, hostname, len);total: 1 errors, 0 warnings, 999 lines checked
Thanks! I forgot to run checkpatch, detestable though it may be:-).
David