12 Aug, 2010

1 commit

  • If the DNS server returns an error, allow that to be cached in the DNS resolver
    key in lieu of a value. Userspace passes the desired error number as an option
    in the payload:

    "#dnserror="

    Userspace must map h_errno from the name resolution routines to an appropriate
    Linux error before passing it up. Something like the following mapping is
    recommended:

    [HOST_NOT_FOUND] = ENODATA,
    [TRY_AGAIN] = EAGAIN,
    [NO_RECOVERY] = ECONNREFUSED,
    [NO_DATA] = ENODATA,

    in lieu of Linux errors specifically for representing name service errors. The
    filesystem must map these errors appropropriately before passing them to
    userspace. AFS is made to map ENODATA and EAGAIN to EDESTADDRREQ for the
    return to userspace; ECONNREFUSED is allowed to stand as is.

    The error can be seen in /proc/keys as a negative number after the description
    of the key. Compare, for example, the following key entries:

    2f97238c I--Q-- 1 53s 3f010000 0 0 dns_resol afsdb:grand.centrall.org: -61
    338bfbbe I--Q-- 1 59m 3f010000 0 0 dns_resol afsdb:grand.central.org: 37

    If the error option is supplied in the payload, the main part of the payload is
    discarded. The key should have an expiry time set by userspace.

    Signed-off-by: Wang Lei
    Signed-off-by: David Howells
    Acked-by: Jeff Layton
    Signed-off-by: Steve French

    Wang Lei
     

06 Aug, 2010

3 commits

  • Fixes for the DNS query module, including:

    (1) Use 'negative' instead of '-ve' in the documentation.

    (2) Mark the kdoc comment with '/**' on dns_query().

    Reported-by: Randy Dunlap
    Signed-off-by: David Howells
    Signed-off-by: Steve French

    David Howells
     
  • Fixes build errors:

    net/dns_resolver/dns_key.c: In function 'init_dns_resolver':
    net/dns_resolver/dns_key.c:170: error: implicit declaration of function 'IS_ERR'
    net/dns_resolver/dns_key.c:171: error: implicit declaration of function 'PTR_ERR'
    net/dns_resolver/dns_query.c: In function 'dns_query':
    net/dns_resolver/dns_query.c:126: error: implicit declaration of function 'IS_ERR'
    net/dns_resolver/dns_query.c:127: error: implicit declaration of function 'PTR_ERR'

    Signed-off-by: Stephen Rothwell
    Signed-off-by: David Howells
    Signed-off-by: Steve French

    Stephen Rothwell
     
  • 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 "[:]". The optional
    indicates the particular DNS lookup and packaging that's required. The
    is the query to be made.

    If 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.

    Signed-off-by: Wang Lei
    Signed-off-by: David Howells
    Acked-by: Jeff Layton
    Signed-off-by: Steve French

    Wang Lei