]> asedeno.scripts.mit.edu Git - linux.git/commit
dns: Allow the dns resolver to retrieve a server set
authorDavid Howells <dhowells@redhat.com>
Thu, 4 Oct 2018 13:27:55 +0000 (14:27 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 4 Oct 2018 16:40:52 +0000 (09:40 -0700)
commitbbb4c4323a4d9cb5ca04db904aa3050a7586839a
tree7737c6f82a31650e7d282f94a227cdea167599dc
parent0aa63eb9a904d50527cc5eadb061d16e607dd4c6
dns: Allow the dns resolver to retrieve a server set

Allow the DNS resolver to retrieve a set of servers and their associated
addresses, ports, preference and weight ratings.

In terms of communication with userspace, "srv=1" is added to the callout
string (the '1' indicating the maximum data version supported by the
kernel) to ask the userspace side for this.

If the userspace side doesn't recognise it, it will ignore the option and
return the usual text address list.

If the userspace side does recognise it, it will return some binary data
that begins with a zero byte that would cause the string parsers to give an
error.  The second byte contains the version of the data in the blob (this
may be between 1 and the version specified in the callout data).  The
remainder of the payload is version-specific.

In version 1, the payload looks like (note that this is packed):

u8 Non-string marker (ie. 0)
u8 Content (0 => Server list)
u8 Version (ie. 1)
u8 Source (eg. DNS_RECORD_FROM_DNS_SRV)
u8 Status (eg. DNS_LOOKUP_GOOD)
u8 Number of servers
foreach-server {
u16 Name length (LE)
u16 Priority (as per SRV record) (LE)
u16 Weight (as per SRV record) (LE)
u16 Port (LE)
u8 Source (eg. DNS_RECORD_FROM_NSS)
u8 Status (eg. DNS_LOOKUP_GOT_NOT_FOUND)
u8 Protocol (eg. DNS_SERVER_PROTOCOL_UDP)
u8 Number of addresses
char[] Name (not NUL-terminated)
foreach-address {
u8 Family (AF_INET{,6})
union {
u8[4] ipv4_addr
u8[16] ipv6_addr
}
}
}

This can then be used to fetch a whole cell's VL-server configuration for
AFS, for example.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/dns_resolver.h
include/uapi/linux/dns_resolver.h [new file with mode: 0644]
net/dns_resolver/dns_key.c
net/dns_resolver/dns_query.c