[SSSD] RFC: a substitute for the hostent structure

Jakub Hrozek jhrozek at redhat.com
Thu May 19 10:46:15 UTC 2011


I've been working on extending our resolver code to honour TTL lately.
One of the problems I'm solving is the data structure we pass from our
resolver abstraction over c-ares to the failover code.

Currently, the code uses "struct hostent". This is not practical as
hostent does not store TTL.

My current version of the patch uses a "struct resolv_hostent" quite
similar to hostent, but the address itself is stored in:

--------
struct resolv_in_addr {
  struct in_addr ipaddr;
  int            ttl;
};

struct resolv_in6_addr {
  struct in6_addr ipaddr;
  int             ttl;
};

union resolv_addr {
    struct resolv_in_addr v4_addr;
    struct resolv_in6_addr v6_addr;
};
--------

I was also considering using "struct sockaddr_storage" because that is
defined in system headers and some sources[1] recommend it, but I also
think that semantics of sockaddr structures is more tied to connecting
to a socket than just pure resolving. So right now I prefer the
resolv_addr union, but I would like to hear other opinions before moving
on with the patch.

	Jakub

[1] http://www.akkadia.org/drepper/userapi-ipv6.html

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 261 bytes
Desc: OpenPGP digital signature
URL: <https://lists.fedorahosted.org/pipermail/sssd-devel/attachments/20110519/838e68fa/attachment.sig>


More information about the sssd-devel mailing list