History log of /freebsd-current/lib/libc/net/name6.c
Revision Date Author Comments
# 559a218c 01-Nov-2023 Warner Losh <imp@FreeBSD.org>

libc: Purge unneeded cdefs.h

These sys/cdefs.h are not needed. Purge them. They are mostly left-over
from the $FreeBSD$ removal. A few in libc are still required for macros
that cdefs.h defines. Keep those.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D42385


# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 8a16b7a1 20-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

General further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.


# e1ec67bb 31-Aug-2016 Andrey A. Chernov <ache@FreeBSD.org>

'addrlen' does not matter when we need to find the first non-zero bit in
the byte from the left and 'addrlen' already counted in 'lim'.

PR: 212121
Submitted by: Herbie.Robinson@stratus.com
MFC after: 7 days


# af98aa6e 31-Aug-2016 Andrey A. Chernov <ache@FreeBSD.org>

Apply the same qsort() usage fix as in r304911 getaddrinfo.c
qsort() can't be stabilized with just return(-1) alone.

MFC after: 3 days


# 705458af 16-May-2016 Don Lewis <truckman@FreeBSD.org>

Don't call free_addrselectpolicy(&policyhead) before policyhead has been
initialized.

Reported by: Coverity
CID: 1018727


# 32223c1b 29-Apr-2016 Pedro F. Giffuni <pfg@FreeBSD.org>

libc: spelling fixes.

Mostly on comments.


# 75a5de5a 19-Apr-2016 Pedro F. Giffuni <pfg@FreeBSD.org>

libc: use our roundup2/rounddown2() macros when param.h is available.

rounddown2 tends to produce longer lines than the original code but
still it makes the code more readable.


# bf51882a 16-Apr-2016 Pedro F. Giffuni <pfg@FreeBSD.org>

libc: make some more use of the nitems() macro.

We have an nitems() macro in the <sys/param.h> header that is
convenient to re-use as it makes things easier to read.
Given that it is available already without adding additional
headers and other parts of libc already use it, extend a bit
more its use.


# bf231994 21-Dec-2015 Hajimu UMEMOTO <ume@FreeBSD.org>

Use _map_v4v6_address().

MFC after: 1 week


# 56d5e096 06-Apr-2015 Gleb Smirnoff <glebius@FreeBSD.org>

Stop including if_var.h from userland.

Sponsored by: Nginx, Inc.


# 72531978 06-Sep-2013 Jilles Tjoelker <jilles@FreeBSD.org>

libc: Use SOCK_CLOEXEC for various internal file descriptors.

This change avoids undesirably passing some internal file descriptors to a
process created (fork+exec) by another thread.

Kernel support for SOCK_CLOEXEC was added in r248534, March 19, 2013.


# e2e9c35f 28-May-2013 Ed Maste <emaste@FreeBSD.org>

Remove the advertising clause from the Regents of the University of
California's license, per the letter dated July 22, 1999.


# f09c52c3 10-Jan-2013 Hajimu UMEMOTO <ume@FreeBSD.org>

Re-enable ip6addrctl support but only for IPv6 address.

Requested by: Ben Morrow <ben__at__morrow.me.uk>
MFC after: 1 week


# d38f4ead 09-Jan-2013 Hajimu UMEMOTO <ume@FreeBSD.org>

Disable destination address selection support of
getipnodebyname(1). RFC 2553 mentions IPv6 addresses
are returned 1st.

Spotted by: uqs
MFC after: 1 week


# 32ffd233 02-Apr-2012 Xin LI <delphij@FreeBSD.org>

Eliminate two cases of unwanted strncpy(). The name is not required
by the current code, and the results would get overwritten anyway
by subsequent memset().

Reviewed by: ume
MFC after: 1 month


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 3e83e4a3 31-Jul-2007 Michael Bushkov <bushman@FreeBSD.org>

- Getipnodebyname() and getipnodebyaddr() reimplemented through
gethostbyname() and gethostbyaddr() accordingly

Approved by: re (kensmith), brooks (mentor)


# 720fc1c7 26-Jul-2006 Yaroslav Tykhiy <ytykhiy@gmail.com>

Fix build w/o INET6.

Submitted by: Andre Albsmeier <Andre.Albsmeier siemens com>


# 18d2f53d 23-Jul-2006 Hajimu UMEMOTO <ume@FreeBSD.org>

stop use of mutex lock in ICMP lookup.

MFC after: 1 week


# b88ad6b5 21-Jul-2006 Hajimu UMEMOTO <ume@FreeBSD.org>

- draft-ietf-ipngwg-icmp-namelookups-09
- make it compilable

It still requires root privilege and is experimental.

Obtained from: KAME
MFC after: 1 week


# 06a99fe3 27-Apr-2006 Hajimu UMEMOTO <ume@FreeBSD.org>

- Extend the nsswitch to support Services, Protocols and Rpc
databases.
- Make nsswitch support caching.

Submitted by: Michael Bushkov <bushman__at__rsu.ru>
Sponsored by: Google Summer of Code 2005


# 90d1d883 25-Mar-2006 Hajimu UMEMOTO <ume@FreeBSD.org>

- Use ANSI C prototype.
- Remove trailing space.


# 5342d17f 21-Mar-2006 Hajimu UMEMOTO <ume@FreeBSD.org>

Update the resolver in libc to BIND9's one.

Since, res_sendsigned(3) and the friends use MD5 functions, it is
hard to include them without having MD5 functions in libc. So,
res_sendsigned(3) is not merged into libc.

Since, res_update(3) in BIND9 is not binary compatible with our
res_update(3), res_update(3) is leaved as is, except some
necessary modifications.
The res_update(3) and the friends are not essential part of the
resolver. They are not defined in resolv.h but defined in
res_update.h separately in BIND9. Further, they are not called from
our tree. So, I hide them from our resolv.h, but leave them only
for binary backward compatibility (perhaps, no one calls them).

Since, struct __res_state_ext is not exposed in BIND9, I hide it
from our resolv.h. And, global variable _res_ext is removed. It
breaks binary backward compatibility. But, since it is not used from
outside of our libc, I think it is safe.

Reviewed by: arch@ (no objection)


# 4a58c5f5 14-Nov-2005 Hajimu UMEMOTO <ume@FreeBSD.org>

The KAME's getipnodebyaddr() code honor the MULTI_PTRS_ARE_ALIASES
define also, but res_config.h was not included into libc/net/name6.c.
So getipnodebyaddr() ignored the multiple PTRs.

PR: kern/88241
Submitted by: Dan Lukes <dan__at__obluda.cz>
MFC after: 3 days


# d6fd3ed8 27-May-2005 Hajimu UMEMOTO <ume@FreeBSD.org>

reduce cast.

MFC after: 1 week


# fd57e549 14-May-2005 George V. Neville-Neil <gnn@FreeBSD.org>

Submitted by: Jinmei Tatuya, Hajimu Umemoto
Reviewed by: rwatson at freebsd dot org
Approved by: rwatson at freebsd dot org
MFC after: 1 week

Fix the matchlen() function so that it handles the IPv4 (AF_INET)
case correctly. Until now it has been treating IPv4 addresses
as if they were IPv6 which could lead to corruption errors.


# 946e41f1 13-May-2005 Hajimu UMEMOTO <ume@FreeBSD.org>

raise readability bit.


# 943db5a2 01-May-2005 Hajimu UMEMOTO <ume@FreeBSD.org>

the 3rd argument of getsockname() should be socklen_t*.

Submitted by: stefanf


# f468e837 30-Apr-2005 Hajimu UMEMOTO <ume@FreeBSD.org>

oops, we don't need previous change.


# 6bd1d1a1 30-Apr-2005 Hajimu UMEMOTO <ume@FreeBSD.org>

make it compilable without YP definition.


# b8ab0f45 28-Apr-2005 Hajimu UMEMOTO <ume@FreeBSD.org>

we don't need mutex lock to call _gethostbynis*(), anymore.


# 7b671d90 28-Apr-2005 Hajimu UMEMOTO <ume@FreeBSD.org>

_gethostbynis{addr,name}() can handle an IPv6, now.


# bcb131aa 27-Apr-2005 Hajimu UMEMOTO <ume@FreeBSD.org>

hide implementation specific internal functions from netdb.h.
it is needed to make get{host,net}by*() thread-safe.


# d7d66e8c 18-Apr-2005 Hajimu UMEMOTO <ume@FreeBSD.org>

- nuke deprecated and unused getnodeby(3).
- remove unused variable.

Obtained from: KAME


# e8ffd816 09-Apr-2005 Hajimu UMEMOTO <ume@FreeBSD.org>

unbreak build without YP defined.

Submitted by: Andrea Campi <andrea+freebsd_cvs_at_webcom.it>


# 2424b118 06-Apr-2005 Hajimu UMEMOTO <ume@FreeBSD.org>

- we are no longer shareing any resources to be locked between
getaddrinfo(3) and getipnodeby*(3).
- use definitions in reentrant.h.
- remove obsolete comment.


# 78ebcde8 05-Apr-2005 Hajimu UMEMOTO <ume@FreeBSD.org>

add missing mutex unlock.


# 0fbf0979 02-Apr-2005 Hajimu UMEMOTO <ume@FreeBSD.org>

nuke the logic for AF_UNSPEC and simplify. once, it was introduced
to improve getaddrinfo(3). but, it is not needed for a long time
since getaddrinfo(3) became providing its own res_*N() functions.


# a2a24ec8 27-Jan-2005 Hajimu UMEMOTO <ume@FreeBSD.org>

make _getipnodebyname_multi() static.


# 0def575f 21-Jul-2004 Hajimu UMEMOTO <ume@FreeBSD.org>

now e.f.f.3.ip6.arpa is delegated, we no longer need to query ip6.int

Obtained from: KAME


# 146cd1bc 02-Jun-2004 Hajimu UMEMOTO <ume@FreeBSD.org>

use source address as a hint to determine destination address
by getipnodebyname().


# 54846c9f 06-Apr-2004 Pierre Beyssac <pb@FreeBSD.org>

Add a missing "*errp = h_errno" forgotten in rev 1.36.


# e651d83a 05-Apr-2004 Pierre Beyssac <pb@FreeBSD.org>

Fix _dns_ghbyname() to return NS_TRYAGAIN instead of NS_NOTFOUND
on temporary nameserver failure. This is necessary to get
getipnodebyname(3) to correctly return h_errno=TRY_AGAIN instead
of HOST_NOT_FOUND.

Reviewed by: green, thomas
MFC after: 1 week


# 33dee819 25-Feb-2004 Brian Feldman <green@FreeBSD.org>

Make the resolver(3) and many associated interfaces much more reentrant.
The getaddrinfo(3), getipnodebyname(3) and resolver(3) can coincide now
with what should be totally reentrant, and h_errno values will now
be preserved correctly, but this does not affect interfaces such as
gethostbyname(3) which are still mostly non-reentrant.

In all of these relevant functions, the thread-safety has been pushed
down as far as it seems possible right now. This means that operations
that are selected via nsdispatch(3) (i.e. files, yp, dns) are protected
still under global locks that getaddrinfo(3) defines, but where possible
the locking is greatly reduced. The most noticeable improvement is
that multiple DNS lookups can now be run at the same time, and this
shows major improvement in performance of DNS-lookup threaded programs,
and solves the "Mozilla tab serialization" problem.

No single-threaded applications need to be recompiled. Multi-threaded
applications that reference "_res" to change resolver(3) options will
need to be recompiled, and ones which reference "h_errno" will also
if they desire the correct h_errno values. If the applications already
understood that _res and h_errno were not thread-safe and had their own
locking, they will see no performance improvement but will not
actually break in any way.

Please note that when NSS modules are used, or when nsdispatch(3)
defaults to adding any lookups of its own to the individual libc
_nsdispatch() calls, those MUST be reentrant as well.


# b8b31f33 20-Feb-2004 Hajimu UMEMOTO <ume@FreeBSD.org>

add destination address selection support for getipnodebyname(3).
though getipnodebyname(3) is obsoleted api, some major applications
such as Mozilla are still using it. so, it will help ipv4 users.


# e8baaa70 04-May-2003 Daniel Eischen <deischen@FreeBSD.org>

Replace use of a spinlock with a mutex.


# 20e0e084 24-Apr-2003 Jacques Vidrine <nectar@FreeBSD.org>

Catch up with nsdispatch.c: nsdispatch(3) is now `hidden' by
namespace.h.

Sponsored by: DARPA, Network Associates Laboratories


# e0554a53 16-Feb-2003 Jacques Vidrine <nectar@FreeBSD.org>

Eliminate 61 warnings emitted at WARNS=2 (leaving 53 to go).
Only warnings that could be fixed without changing the generated object
code and without restructuring the source code have been handled.

Reviewed by: /sbin/md5


# aadad922 23-Oct-2002 Hajimu UMEMOTO <ume@FreeBSD.org>

query ip6.arpa then ip6.int for IPv6 reverse lookup. follows RFC3152.

Obtained from: KAME
MFC after: 1 week


# 71918af6 06-Oct-2002 Hajimu UMEMOTO <ume@FreeBSD.org>

Put giant locks due to make getaddrinfo(), getnameinfo()
and getipnodeby*() thread-safe.
Our res_*() is not thread-safe. So, we share lock between
getaddrinfo() and getipnodeby*(). Still, we cannot use
getaddrinfo() and getipnodeby*() in conjunction with other
functions which call res_*().

Requested by: many people


# 9832619c 16-Sep-2002 Hajimu UMEMOTO <ume@FreeBSD.org>

Allocate 64K recieve buffer for DNS responses.


# 54384cf3 15-Sep-2002 Jacques Vidrine <nectar@FreeBSD.org>

Check for truncation in calls to res_send/res_query/res_search.
Fail when it is detected.


# 7deb8a7d 14-Sep-2002 Jacques Vidrine <nectar@FreeBSD.org>

Backout the increase of MAXPACKET from 1024 to 65536: it
broke pthreads.

Reported by: mbr, tjr


# 2e4dbbaa 13-Sep-2002 Jacques Vidrine <nectar@FreeBSD.org>

When using res_send/res_query/res_search, the caller must either
insure enough space is available for the response, or be prepared
to resize the buffer and retry as necessary.

Do the conservative thing and make sure enough space is available.

Reviewed by: silence on freebsd-audit


# ecddb03f 26-Jun-2002 Warner Losh <imp@FreeBSD.org>

Remove two lines that were cvs merged that shouldn't have been. This
fixes the build.

Reported by: dillon.


# d6af58f5 26-Jun-2002 Warner Losh <imp@FreeBSD.org>

Include more robust checking of end of buffer that more completely
plugs the hole.


# 4cf07470 26-Jun-2002 Warner Losh <imp@FreeBSD.org>

Avoid remote buffer overflow on hostbuf[].

Submitted by: joost Pol <joost@pine.nl>


# 333fc21e 22-Mar-2002 David E. O'Brien <obrien@FreeBSD.org>

Fix the style of the SCM ID's.
I believe have made all of libc .c's as consistent as possible.


# 1372519b 22-Mar-2002 David E. O'Brien <obrien@FreeBSD.org>

Remove multi-line __P() usage.


# c05ac53b 21-Mar-2002 David E. O'Brien <obrien@FreeBSD.org>

Remove __P() usage.


# 8fb3f3f6 21-Mar-2002 David E. O'Brien <obrien@FreeBSD.org>

Remove 'register' keyword.


# d201fe46 24-Jan-2001 Daniel Eischen <deischen@FreeBSD.org>

Remove _THREAD_SAFE and make libc thread-safe by default by
adding (weak definitions to) stubs for some of the pthread
functions. If the threads library is linked in, the real
pthread functions will pulled in.

Use the following convention for system calls wrapped by the
threads library:
__sys_foo - actual system call
_foo - weak definition to __sys_foo
foo - weak definition to __sys_foo

Change all libc uses of system calls wrapped by the threads
library from foo to _foo. In order to define the prototypes
for _foo(), we introduce namespace.h and un-namespace.h
(suggested by bde). All files that need to reference these
system calls, should include namespace.h before any standard
includes, then include un-namespace.h after the standard
includes and before any local includes. <db.h> is an exception
and shouldn't be included in between namespace.h and
un-namespace.h namespace.h will define foo to _foo, and
un-namespace.h will undefine foo.

Try to eliminate some of the recursive calls to MT-safe
functions in libc/stdio in preparation for adding a mutex
to FILE. We have recursive mutexes, but would like to avoid
using them if possible.

Remove uneeded includes of <errno.h> from a few files.

Add $FreeBSD$ to a few files in order to pass commitprep.

Approved by: -arch


# cb0600bd 06-Sep-2000 Jacques Vidrine <nectar@FreeBSD.org>

Fix getipnodebyname(3) bug.

Submitted by: ume


# 248aee62 06-Sep-2000 Jacques Vidrine <nectar@FreeBSD.org>

Add nsswitch support. By creating an /etc/nsswitch.conf file, you can
configure FreeBSD so that various databases such as passwd and group can be
looked up using flat files, NIS, or Hesiod.

= Hesiod has been added to libc (see hesiod(3)).

= A library routine for parsing nsswitch.conf and invoking callback
functions as specified has been added to libc (see nsdispatch(3)).

= The following C library functions have been modified to use nsdispatch:
. getgrent, getgrnam, getgrgid
. getpwent, getpwnam, getpwuid
. getusershell
. getaddrinfo
. gethostbyname, gethostbyname2, gethostbyaddr
. getnetbyname, getnetbyaddr
. getipnodebyname, getipnodebyaddr, getnodebyname, getnodebyaddr

= host.conf has been removed from src/etc. rc.network has been modified
to warn that host.conf is no longer used at boot time. In addition, if
there is a host.conf but no nsswitch.conf, the latter is created at boot
time from the former.

Obtained from: NetBSD


# 05c36511 19-Jul-2000 Hajimu UMEMOTO <ume@FreeBSD.org>

To define A RR to root (.) is valid in DNS. So, h_name = "" shouldn't
be treated as NULL.

PR: bin/19816
Submitted by: Bill Fenner <fenner@research.att.com>
Reviewed by: Atsushi Onoe <onoe@sm.sony.co.jp>


# 3f587e57 02-Jul-2000 Kris Kennaway <kris@FreeBSD.org>

Previous commit broke the case of chained CNAME entries. Instead handle
the bogus case by being stricter about errors.

Submitted by: itojun
Obtained from: KAME


# dc578f25 02-Jul-2000 Kris Kennaway <kris@FreeBSD.org>

Fix a nasty bug which would leave the struct hostent incompletely filled out
when parsing certain DNS records during a reverse address resolution. Thus
when code tries to examine the returned host name, it dereferences a null
pointer :-(

Problem noticed by: ps


# e3975643 25-May-2000 Jake Burkholder <jake@FreeBSD.org>

Back out the previous change to the queue(3) interface.
It was not discussed and should probably not happen.

Requested by: msmith and others


# 740a1973 23-May-2000 Jake Burkholder <jake@FreeBSD.org>

Change the way that the queue(3) structures are declared; don't assume that
the type argument to *_HEAD and *_ENTRY is a struct.

Suggested by: phk
Reviewed by: phk
Approved by: mdodd


# 73b30f0c 09-May-2000 Jun-ichiro itojun Hagino <itojun@FreeBSD.org>

correct possible security issue(s) in name resolution, due to use of
pre-4.9.7 BIND resolver code.
ftp://ftp.kame.net/pub/mail-list/snap-users/2348 for details.

Reviewed by: ume


# e6f35403 19-Apr-2000 Yoshinobu Inoue <shin@FreeBSD.org>

Change getaddrinfo() resolve order
from
all AAAA trial, then all A trial
to
try AAAA and A for each trial

TODO: more fix for the case where IPv4 mapped IPv6 addr is disabled

Reviewed by: ume


# 38775c5e 15-Mar-2000 Jonathan Lemon <jlemon@FreeBSD.org>

Fix uninitialized variable.

Submitted by: tanimura


# 63858012 09-Mar-2000 Jonathan Lemon <jlemon@FreeBSD.org>

Add in IPV4 NIS support.

PR: 17290 (but not the same patch)
Approved by: jkh


# be26adb5 09-Feb-2000 Yoshinobu Inoue <shin@FreeBSD.org>

Let getaddrinfo() and related functions supports traditional IPv4 format
(shortend format, etc)

Current KAME getaddrinfo() supports only d.d.d.d format IPv4
addr. But traditionally inet_aton() and etc support other formats.
(shortend format and octal/deciaml/hex format)
Aboud this,
-As far as the discussion on freebsd-current, many people
think traditional format should also be supported by getaddrinfo().
-X/Open spec requires getaddrinfo() also support those
traditional IPv4 format.
-RFC2553 say nothing about it.
-As the result of confirmation in ietf/ipng list, there is
no clear concensus yet, and the reply was, "RFC2553 update
and X/Open spec will be in sync"

So takeing these conditions into account, I think
getaddrinfo() should also support traditional IPv4 format.

Specified by: Marc Schneiders <marc@oldserver.demon.nl>
Approved by: jkh


# 9233c4d9 27-Jan-2000 Jason Evans <jasone@FreeBSD.org>

Simplify sytem call renaming. Instead of _foo() <-- _libc_foo <-- foo(),
just use _foo() <-- foo(). In the case of a libpthread that doesn't do
call conversion (such as linuxthreads and our upcoming libpthread), this
is adequate. In the case of libc_r, we still need three names, which are
now _thread_sys_foo() <-- _foo() <-- foo().

Convert all internal libc usage of: aio_suspend(), close(), fsync(), msync(),
nanosleep(), open(), fcntl(), read(), and write() to _foo() instead of foo().

Remove all internal libc usage of: creat(), pause(), sleep(), system(),
tcdrain(), wait(), and waitpid().

Make thread cancellation fully POSIX-compliant.

Suggested by: deischen


# 3d670abc 12-Jan-2000 Yoshinobu Inoue <shin@FreeBSD.org>

added IPv6 unspecified addr check for getipnodebyaddr.


# 92927338 12-Jan-2000 Jason Evans <jasone@FreeBSD.org>

Add three-tier symbol naming in support of POSIX thread cancellation
points. For library functions, the pattern is __sleep() <--
_libc_sleep() <-- sleep(). The arrows represent weak aliases. For
system calls, the pattern is _read() <-- _libc_read() <-- read().


# 7d56d374 27-Dec-1999 Yoshinobu Inoue <shin@FreeBSD.org>

Getaddrinfo(), getnameinfo(), and etc support in libc/net.
Several udp and raw apps IPv6 support.

Reviewed by: freebsd-arch, cvs-committers
Obtained from: KAME project