diff options
author | Greg Hudson <ghudson@mit.edu> | 2011-02-13 21:14:00 +0000 |
---|---|---|
committer | Greg Hudson <ghudson@mit.edu> | 2011-02-13 21:14:00 +0000 |
commit | 8b9d249e40601047e69c92d7acb578fd0bbafc00 (patch) | |
tree | dff77af4a82cae99af17dc0848d44a138968841f /src/include/k5-trace.h | |
parent | 6726c9f5eca0e49cabfdf878c02e5966bdcccd93 (diff) | |
download | krb5-8b9d249e40601047e69c92d7acb578fd0bbafc00.tar.gz krb5-8b9d249e40601047e69c92d7acb578fd0bbafc00.tar.xz krb5-8b9d249e40601047e69c92d7acb578fd0bbafc00.zip |
Defer hostname lookups in krb5_sendto_kdc
Restructure the locate_kdc and sendto_kdc code to defer getaddrinfo
calls until we need the answer. This requires many changes:
* struct addrlist is now called struct serverlist, and is declared in
os-proto.h instead of k5-int.h. It contains an array of struct
server_entry structures which can hold either a name or an address.
(Address entries are used for locate_kdc module results.)
* The connection state list is now a linked list, and holds address
information directly instead of using a struct addrinfo (this
simplifies memory management). Each connection entry contains a
callback buffer (previously stored in a separate array) and an index
into the server list.
* The {addrstate} trace formatting primitive is no longer needed, and
has been replaced by {connstate}. There is also a new tracing event
for resolving hostnames.
* locate_server, locate_kdc, free_serverlist, and sendto get their
prefixes changed from krb5int_ to k5_ as their prototypes were being
adjusted anyway. The family argument is gone from the locate
functions as it was never productively used. k5_sendto now receives
the socket types of interest.
* krb5_sendto_kdc will now pass a 0 socktype to k5_locate_kdc if both
socket types are wanted. There were some allowances for this in
locate but this was never previously done. In order to be
conservative when invoking locate modules, we always pass an
explicit socktype, thus calling lookup twice (as we did before,
albeit with a separate init/fini cycle) in the common case. When
creating hostname entries in serverlist from profile configuration,
we preserve the 0 value of socktype, and later create both TCP and
UDP addresses from the getaddrinfo results when the host is
resolved.
* Some accessor functions previously used by libkrb4 have been removed
as they impinged upon this work.
ticket: 6868
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@24635 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/include/k5-trace.h')
-rw-r--r-- | src/include/k5-trace.h | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/src/include/k5-trace.h b/src/include/k5-trace.h index a4a0b83de..0df77fc19 100644 --- a/src/include/k5-trace.h +++ b/src/include/k5-trace.h @@ -60,7 +60,7 @@ * {lenstr} size_t and const char *, as a counted string * {hexlenstr} size_t and const char *, as hex bytes * {hashlenstr} size_t and const char *, as four-character hex hash - * {addrinfo} struct addrinfo *, show socket type, address, port + * {connstate} struct conn_state *, show socket type, address, port * {data} krb5_data *, display as counted string * {hexdata} krb5_data *, display as hex bytes * {errno} int, display as number/errorstring @@ -264,32 +264,34 @@ rlm, (master) ? " (master)" : "", (tcp) ? " (tcp only)" : "")) #define TRACE_SENDTO_KDC_MASTER(c, master) \ TRACE(c, (c, "Response was{str} from master KDC", (master) ? "" : " not")) -#define TRACE_SENDTO_KDC_RESPONSE(c, addr) \ - TRACE(c, (c, "Received answer from {addrinfo}", addr)) -#define TRACE_SENDTO_KDC_TCP_CONNECT(c, addr) \ - TRACE(c, (c, "Initiating TCP connection to {addrinfo}", addr)) -#define TRACE_SENDTO_KDC_TCP_DISCONNECT(c, addr) \ - TRACE(c, (c, "Terminating TCP connection to {addrinfo}", addr)) -#define TRACE_SENDTO_KDC_TCP_ERROR_CONNECT(c, addr, err) \ - TRACE(c, (c, "TCP error connecting to {addrinfo}: {errno}", addr, err)) -#define TRACE_SENDTO_KDC_TCP_ERROR_RECV(c, addr, err) \ - TRACE(c, (c, "TCP error receiving from {addrinfo}: {errno}", addr, err)) -#define TRACE_SENDTO_KDC_TCP_ERROR_RECV_LEN(c, addr, err) \ - TRACE(c, (c, "TCP error receiving from {addrinfo}: {errno}", addr, err)) -#define TRACE_SENDTO_KDC_TCP_ERROR_SEND(c, addr, err) \ - TRACE(c, (c, "TCP error sending to {addrinfo}: {errno}", addr, err)) -#define TRACE_SENDTO_KDC_TCP_SEND(c, addr) \ - TRACE(c, (c, "Sending TCP request to {addrinfo}", addr)) -#define TRACE_SENDTO_KDC_UDP_ERROR_RECV(c, addr, err) \ - TRACE(c, (c, "UDP error receiving from {addrinfo}: {errno}", addr, err)) -#define TRACE_SENDTO_KDC_UDP_ERROR_SEND_INITIAL(c, addr, err) \ - TRACE(c, (c, "UDP error sending to {addrinfo}: {errno}", addr, err)) -#define TRACE_SENDTO_KDC_UDP_ERROR_SEND_RETRY(c, addr, err) \ - TRACE(c, (c, "UDP error sending to {addrinfo}: {errno}", addr, err)) -#define TRACE_SENDTO_KDC_UDP_SEND_INITIAL(c, addr) \ - TRACE(c, (c, "Sending initial UDP request to {addrinfo}", addr)) -#define TRACE_SENDTO_KDC_UDP_SEND_RETRY(c, addr) \ - TRACE(c, (c, "Sending retry UDP request to {addrinfo}", addr)) +#define TRACE_SENDTO_KDC_RESOLVING(c, hostname) \ + TRACE(c, (c, "Resolving hostname {str}", hostname)) +#define TRACE_SENDTO_KDC_RESPONSE(c, conn) \ + TRACE(c, (c, "Received answer from {connstate}", conn)) +#define TRACE_SENDTO_KDC_TCP_CONNECT(c, conn) \ + TRACE(c, (c, "Initiating TCP connection to {connstate}", conn)) +#define TRACE_SENDTO_KDC_TCP_DISCONNECT(c, conn) \ + TRACE(c, (c, "Terminating TCP connection to {connstate}", conn)) +#define TRACE_SENDTO_KDC_TCP_ERROR_CONNECT(c, conn, err) \ + TRACE(c, (c, "TCP error connecting to {connstate}: {errno}", conn, err)) +#define TRACE_SENDTO_KDC_TCP_ERROR_RECV(c, conn, err) \ + TRACE(c, (c, "TCP error receiving from {connstate}: {errno}", conn, err)) +#define TRACE_SENDTO_KDC_TCP_ERROR_RECV_LEN(c, conn, err) \ + TRACE(c, (c, "TCP error receiving from {connstate}: {errno}", conn, err)) +#define TRACE_SENDTO_KDC_TCP_ERROR_SEND(c, conn, err) \ + TRACE(c, (c, "TCP error sending to {connstate}: {errno}", conn, err)) +#define TRACE_SENDTO_KDC_TCP_SEND(c, conn) \ + TRACE(c, (c, "Sending TCP request to {connstate}", conn)) +#define TRACE_SENDTO_KDC_UDP_ERROR_RECV(c, conn, err) \ + TRACE(c, (c, "UDP error receiving from {connstate}: {errno}", conn, err)) +#define TRACE_SENDTO_KDC_UDP_ERROR_SEND_INITIAL(c, conn, err) \ + TRACE(c, (c, "UDP error sending to {connstate}: {errno}", conn, err)) +#define TRACE_SENDTO_KDC_UDP_ERROR_SEND_RETRY(c, conn, err) \ + TRACE(c, (c, "UDP error sending to {connstate}: {errno}", conn, err)) +#define TRACE_SENDTO_KDC_UDP_SEND_INITIAL(c, conn) \ + TRACE(c, (c, "Sending initial UDP request to {connstate}", conn)) +#define TRACE_SENDTO_KDC_UDP_SEND_RETRY(c, conn) \ + TRACE(c, (c, "Sending retry UDP request to {connstate}", conn)) #define TRACE_SEND_TGS_ETYPES(c, etypes) \ TRACE(c, (c, "etypes requested in TGS request: {etypes}", etypes)) |