Commit Graph

803 Commits

Author SHA1 Message Date
Hiroki Sato
c56e91b345 sdl->sdl_len in sockaddr_dl can be longer than
sizeof(struct sockaddr_dl).
2015-11-03 00:46:06 +00:00
Jason Helfman
816c67bac0 - address grammar
PR:		203440 (based on)
Submitted by:	ceratv@rpi.edu
Approved by:	wblock@ (mentor)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D3813
2015-10-05 18:09:43 +00:00
Hiroki Sato
4c60a05d25 - Move PF_LOCAL at the end of the array. PF_INET{,6} is used more often.
- Add SOCKTYPE_ANY to PF_LOCAL.

- Apply AI_CANONNAME to only AF_INET{,6}.  It is not meaningful for the
  other AFs.
2015-10-03 12:40:54 +00:00
Craig Rodrigues
3ba5ea2408 Use ANSI C prototypes. Eliminates -Wold-style-definition warnings. 2015-09-20 21:21:17 +00:00
Craig Rodrigues
626c9d7433 Use ANSI C prototypes. Eliminates -Wold-style-definition warnings. 2015-09-20 21:21:01 +00:00
Craig Rodrigues
9a50fd2d05 Add declarations to netdb_private.h to eliminate -Wmissing-prototypes warnings. 2015-09-20 04:20:31 +00:00
Craig Rodrigues
bf1aa507b0 Add declarations to eliminate -Wmissing-prototypes warnings 2015-09-20 04:17:53 +00:00
Craig Rodrigues
ae274020ba Define _NS_PRIVATE to make declarations visible.
This eliminates -Wmissing-prototypes warnings.
2015-09-20 04:17:03 +00:00
Craig Rodrigues
ffdd70376a Add missing includes to eliminate -Wmissing-prototypes warnings 2015-09-20 04:15:37 +00:00
Hiroki Sato
bb957021d7 Add PF_LOCAL support in getaddrinfo(3) and getnameinfo(3):
- In a PF_LOCAL address, "hostname" must begins with '/' and "servname"
  is always NULL.  All of ai_flags are ignored.

- PF_UNSPEC matches PF_LOCAL.  EAI_SERVICE is not returned to make
  AF-independent programming easier; "servname" is always ignored
  in PF_LOCAL.  In practice, PF_INET* and PF_LOCAL are
  mutually-exclusive because a hostname which begins with '/' is invalid
  in PF_INET*.  No domain name resolution is performed for a PF_LOCAL address.

Differential Revision:	https://reviews.freebsd.org/D3634
2015-09-20 01:09:23 +00:00
Jilles Tjoelker
1c0046d792 libc: Consistently call _ioctl() internally, not ioctl(). 2015-09-19 20:27:09 +00:00
Michael Tuexen
14914827f0 Zero out a local variable also when PURIFY is not defined.
This silence a warning brought up by valgrind whenever if_nametoindex
is used. This was already discussed in PR 166483, but the code
committed in r234329 guards the initilization with #ifdef PURIFY.
Therefore, valgrind still complains. Since this code is not performance
critical, always zero out the local variable to silence valgrind.

PR:		166483
Discussed with:	eadler@
MFC after:	4 weeks
2015-09-10 10:23:23 +00:00
Hiroki Sato
f9f9625d18 - Fix SIGSEGV when sa == NULL. NULL check in getnameinfo_inet()
did not work as expected.

- Simplify afdl table lookup.

MFC after:	3 days
2015-09-09 09:19:07 +00:00
Hiroki Sato
34e38a56b0 - snprintf() returns at most size-1 of the chars printed into
the buffer.  (n == hostlen) also means the buffer length was
  too short.

- Use sdl->sdl_data only when (sdl->sdl_nlen > 0 && sdl->sdl_alen == 0)
  to prevent redundant output.
2015-09-02 16:50:49 +00:00
Hiroki Sato
27a1ccfc19 Print sdl->sdl_data when sdl->sdl_nlen > 0 as link_ntoa(3) does.
MFC after:	1 week
2015-09-01 08:29:39 +00:00
Konstantin Belousov
bd6060a1c6 Switch libc from using _sig{procmask,action,suspend} symbols, which
are aliases for the syscall stubs and are plt-interposed, to the
libc-private aliases of internally interposed sigprocmask() etc.

Since e.g. _sigaction is not interposed by libthr, calling signal()
removes thr_sighandler() from the handler slot etc.  The result was
breaking signal semantic and rtld locking.

The added __libc_sigprocmask and other symbols are hidden, they are
not exported and cannot be called through PLT.  The setjmp/longjmp
functions for x86 were changed to use direct calls, and since
PIC_PROLOGUE only needed for functional PLT indirection on i386, it is
removed as well.

The PowerPC bug of calling the syscall directly in the setjmp/longjmp
implementation is kept as is.

Reported by:	Pete French <petefrench@ingresso.co.uk>
Tested by:	Michiel Boland <boland37@xs4all.nl>
Reviewed by:	jilles (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-08-29 14:25:01 +00:00
Xin LI
8823d24b48 - ANSIfy
- Remove the redundant _PATH_RSH definition (paths.h at r96194);
 - Use pid_t for PIDs
 - Note that we are at the same level of OpenBSD's counterpart of
   revision 1.7 (r94757).

No functional changes.

MFC after:	2 weeks
2015-08-18 22:37:25 +00:00
Michael Tuexen
b96e9390db Fix name of a constant.
MFC after: 3 days
2015-06-14 20:16:36 +00:00
Jilles Tjoelker
53d1c63711 recv(),send(): Directly call interposing entry instead of going through PLT.
recv() and send()'s calls to recvfrom() and sendto() are much like
waitpid()'s call to wait4(), and likewise need not allow PLT interposing on
the called function.
2015-05-10 14:50:50 +00:00
Michael Tuexen
446734c25e A complete user message is signalled with the MSG_EOR flag, not the MSG_EOF
flag.
Thanks to Valentin Nechayev for reporting the issue.

MFC after: 1 week
2015-04-23 13:10:03 +00:00
Gleb Smirnoff
56d5e0967c Stop including if_var.h from userland.
Sponsored by:	Nginx, Inc.
2015-04-06 09:42:23 +00:00
Michael Tuexen
4b2dd7af64 Add an SCTP symbol which was missed in
https://svnweb.freebsd.org/base?view=revision&revision=169622
This fixes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=197783
Thanks to Jukka Ukkonen for reporting the bug and providing a fix.

MFC after: 3 days
2015-03-28 09:08:57 +00:00
Michael Tuexen
59b6d5be4e Add a SCTP socket option to limit the cwnd for each path.
MFC after: 1 month
2015-03-10 19:49:25 +00:00
Pedro F. Giffuni
726b99f9f9 eui64_line(): plug memory leak.
CID:		978412
Reviewed by:	brooks, delphij
CodeReview:	https://reviews.freebsd.org/D1976
2015-02-27 18:13:06 +00:00
Pedro F. Giffuni
7c498a0950 Hint out check for unsigned negative values.
On FreeBSD socklen_t is unsigned so the check negative len
in inet6_opt_append() is redundant and likely to be optimized
away by the compiler.

On other operating systems this is not necessarily so, and
in the future we may want to sign it so leave the check in
but place it in a secondary position as a subtle indication
that the bogus check is intentional.

Discussed with:	rpaulo

CID:	1017783
2015-02-27 01:59:29 +00:00
Christian Brueffer
0aee91e1fb Various mdoc fixes and a few EOL whitespace removals.
Found with:	mandoc -Tlint
2014-12-21 12:36:36 +00:00
Michael Tuexen
2b8a4d8033 Initilize the msg_flags field consistently in all code paths.
Reported by:	Coverity
CID:		1018726
2014-12-17 07:47:25 +00:00
Michael Tuexen
0d958bd47a Fix a typo reported by Lennart Grahl.
MFC after: 3 days
2014-12-10 14:50:57 +00:00
Ed Maste
d4287c3092 ANSIfy b64_pton 2014-11-27 02:15:35 +00:00
Ed Maste
333cabbec5 Fix b64_pton output buffer overrun test for exact-sized buffer
b64_pton would sometimes erroneously fail to decode a base64 string into
a precisely sized buffer. The overflow check was a little too greedy.

Reported by:	Ted Unangst on freebsd-hackers@
Reviewed by:	loos, trasz
Obtained from:	OpenBSD
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D1218
2014-11-25 18:39:37 +00:00
Sergey Kandaurov
ac071896d1 Fix ifa_data description.
PR:		176583
Discussed with:	glebius
MFC after:	1 week
Sponsored by:	Nginx, Inc.
2014-11-25 15:09:34 +00:00
Dag-Erling Smørgrav
83804ea074 The fallback flag in nsdispatch prevents the fallback implementation of
getgroupmembership() from invoking the correct backend in the compat case.
Replace it with a nesting depth counter so it only blocks one level (the
first is the group -> group_compat translation, the second is the actual
backend).  This is one of two bugs that break getgrouplist() in the compat
case, the second being that the backend's own getgroupmembership() method
is ignored.  Unfortunately, that is not easily fixable without a redesign
of our nss implementation (which is also needed to implement the +@group
syntax in /etc/passwd).

PR:		190055
MFC after:	1 week
2014-11-25 09:47:15 +00:00
Alexander V. Chernikov
603eaf792b Renove faith(4) and faithd(8) from base. It looks like industry
have chosen different (and more traditional) stateless/statuful
NAT64 as translation mechanism. Last non-trivial commits to both
faith(4) and faithd(8) happened more than 12 years ago, so I assume
it is time to drop RFC3142 in FreeBSD.

No objections from:	net@
2014-11-09 21:33:01 +00:00
Mark Johnston
f53b045631 Eliminate conf_lock and instead rely on the NSS write lock to protect
NSS configuration state.

As a side effect, this fixes a race condition which can occur if multiple
threads call nsdispatch(3) concurrently before nsswitch.conf has been
parsed. Previously, the thread holding conf_lock could cause other threads
to return from nss_configure() before nsswitch.conf had been parsed, forcing
them to fall back to the default sources for their NSS methods.

Reviewed by:		jhb
Differential Revision:	https://reviews.freebsd.org/D994
MFC after:		1 month
Sponsored by:		EMC / Isilon Storage Division
2014-10-24 20:29:14 +00:00
Michael Tuexen
f0396ad15e Add support for the SCTP_PR_STREAM_STATUS and SCTP_PR_ASSOC_STATUS
socket options. This includes managing the correspoing stat counters.
Add the SCTP_DETAILED_STR_STATS kernel option to control per policy
counters on every stream. The default is off and only an aggregated
counter is available. This is sufficient for the RTCWeb usecase.

MFC after: 1 week
2014-08-13 15:50:16 +00:00
Michael Tuexen
c79bec9c75 Add support for the SCTP_AUTH_SUPPORTED and SCTP_ASCONF_SUPPORTED
socket options. Add also a sysctl to control the support of ASCONF.

MFC after: 1 week
2014-08-12 11:30:16 +00:00
Pedro F. Giffuni
905dd80f80 Const-ify character string
Obtained from:  Apple Inc. (Libc 997.90.3)
MFC after:	3 days
2014-08-07 22:14:37 +00:00
Michael Tuexen
317e00ef86 Add support for the SCTP_RECONFIG_SUPPORTED and the corresponding
sysctl controlling the negotiation of the RE-CONFIG extension.

MFC after: 3 days
2014-08-04 20:07:35 +00:00
Michael Tuexen
cb9b8e6f7d Add support for the SCTP_PKTDROP_SUPPORTED socket option and
the corresponding sysctl variable.
The default is off, since the specification is not an RFC yet.

MFC after: 1 week
2014-08-03 18:12:55 +00:00
Michael Tuexen
caea98793f Add SCTP socket option SCTP_NRSACK_SUPPORTED to control the
NRSACK extension. The default will still be off, since it
it not an RFC (yet).
Changing the sysctl name will be in a separate commit.

MFC after: 1 week
2014-08-03 14:10:10 +00:00
Michael Tuexen
dd973b0e15 Add support for the SCTP_PR_SUPPORTED socket option as specified in
http://tools.ietf.org/html/draft-ietf-tsvwg-sctp-prpolicies
Add also a sysctl controlling the default of the end-points.

MFC after: 1 week
2014-08-02 21:36:40 +00:00
Michael Tuexen
f342355a0e Cleanup the ECN configuration handling and provide an SCTP socket
option for controlling ECN on future associations and get the
status on current associations.
A simialar pattern will be used for controlling SCTP extensions in
upcoming commits.
2014-08-02 17:35:13 +00:00
Pedro F. Giffuni
65227e53ce Clean r268867.
Proposed by:	bde
2014-07-19 14:34:06 +00:00
Pedro F. Giffuni
bef4f148b1 Use unsigned optlen in getsourcefilter()
Sizes can not be negative and the functions that use it
expect an unsigned value anyways.

Obtained from:	Apple (Libc-997.90.3)
MFC after:	1 week
2014-07-19 01:53:52 +00:00
Julio Merino
b32cce1f82 Make generation of nslexer.c more robust.
Ensure that lex errors fail the build instead of being silently ignored
due to the piped call.  Also postpone the update of the nslexer.c file
until we are sure we have generated it properly.

These changes fix some very obscure build failures I encountered while
building FreeBSD within a chroot that did not have devfs mounted. The
specific errors looked like:

.../libc.so.7: undefined reference to `_nsyyerror'
.../libc.so.7: undefined reference to `_nsyyin'
.../libc.so.7: undefined reference to `_nsyylex'
.../libc.so.7: undefined reference to `_nsyylineno'
.../libc.so.7: undefined reference to `_nsyytext'

and were caused due to a mangled nslexer.c being linked into libc.
2014-07-14 13:53:10 +00:00
Hajimu UMEMOTO
5d9d18f283 Fix build with WITHOUT_INET6.
Spotted by:	bf
MFC after:	1 week
2014-06-26 14:24:31 +00:00
Hajimu UMEMOTO
17f53388d6 - Exclude loopback address rather than loopback interface.
- style(9)

TODO: When AI_ADDRCONFIG is specified, getaddrinfo() can
be quite slow for system with many interfaces.  We should
have some kernel sysctls to report IPv4/IPv6 status.

Spotted by:	melifaro
MFC after:	1 week
2014-06-26 12:12:18 +00:00
Hajimu UMEMOTO
290789099b Exclude IPv4 address from doing longest match.
It prevented DNS based load balancing.

MFC after:	1 week
2014-06-23 15:43:27 +00:00
Baptiste Daroussin
8fbf3d50e3 use .Mt to mark up email addresses consistently (part4)
PR:		191174
Submitted by:	Franco Fichtner  <franco at lastsummer.de>
2014-06-23 08:25:03 +00:00
Hajimu UMEMOTO
cfaa2a0955 Use SOCK_CLOEXEC.
MFC after:	1 week
2014-06-19 11:49:36 +00:00