[Swan-dev] get rid of getnetbyname() /etc/networks?

D. Hugh Redelmeier hugh at mimosa.com
Mon May 3 05:53:46 UTC 2021


| From: Paul Wouters <paul at nohats.ca>

| Related, there are still a few places that end up calling
| gethostbyname2() which is also obsolete and does not work for IPv6:
| 
| lib/libswan/ttoaddress.c:       struct hostent *h = gethostbyname2(p, af);
| 
| The case in ttoaddress.c is the main one. Since it is used by
| ttoaddress_dns() which is used in many places, we cannot replace it
| with an async libunbound call. And to do a sync unbound call, last I
| looked at this years ago, we would have to start another libunbound
| context which gets its own cachce. Also, it would mean people can no
| longer compile without libunbound. I guess the best fix would be to
| rewrite it to use getaddrinfo() or res_ functions?

I'm working on using getaddrinfo(3).  Using getaddrinfo(3) seems to be
more concise than using gethostbyname2(3).  This is surprising given
the complex interface.

I think that the res_functions are not a good idea: they are not
POSIX, they are just BIND (GCC wrapper).


More information about the Swan-dev mailing list