aboutsummaryrefslogtreecommitdiffstats
path: root/lib/libc/net
Commit message (Collapse)AuthorAgeFilesLines
* libc: Fix most issues reported by mandocGordon Bergling2020-12-191-20/+20
| | | | | | | | | | | | | | - varios "new sentence, new line" warnings - varios "sections out of conventional order" warnings - varios "unusual Xr order" warnings - varios "missing section argument" warnings - varios "no blank before trailing delimiter" warnings - varios "normalizing date format" warnings MFC after: 1 month Notes: svn path=/head/; revision=368817
* Eliminate duplicate `afterinstallconfigs` targetEnji Cooper2020-10-011-1/+2
| | | | | | | | | | | | | | | | | Define separate dependent targets which `afterinstallconfigs` relies on, in order to modify `${DESTDIR}/etc/master.passwd` and `${DESTDIR}/etc/nsswitch.conf`. Mark these targets .PHONY, since they manipulate configurations on the fly and the generation logic isn't 100% defined in terms of the source files/logic, and is variable, based on MK_foo flags. MFC after: 2 weeks Reviewed by: bapt, brd Differential Revision: https://reviews.freebsd.org/D20330 Notes: svn path=/head/; revision=366327
* Add include missing from my last commit.Michael Tuexen2020-06-211-0/+1
| | | | Notes: svn path=/head/; revision=362474
* Cleanup the defintion of struct sctp_getaddresses. This stuctureMichael Tuexen2020-06-211-8/+8
| | | | | | | | | | is used by the IPPROTO_SCTP level socket options SCTP_GET_PEER_ADDRESSES and SCTP_GET_LOCAL_ADDRESSES, which are used by libc to implement sctp_getladdrs() and sctp_getpaddrs(). These changes allow an old libc to work on a newer kernel. Notes: svn path=/head/; revision=362473
* Use a struct sockaddr_in pr struct sockaddr_in6 as the option valueMichael Tuexen2020-06-201-22/+13
| | | | | | | | | | | for the IPPROTO_SCTP level socket options SCTP_BINDX_ADD_ADDR and SCTP_BINDX_REM_ADDR. These socket option are intended for internal use only to implement sctp_bindx(). This is one user of struct sctp_getaddresses less. struct sctp_getaddresses is strange and will be changed shortly. Notes: svn path=/head/; revision=362451
* Whitespace changes, not functional change intended.Michael Tuexen2020-06-181-22/+23
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=362332
* libc: Shortcut if_indextoname() if index == 0Kristof Provost2020-04-231-0/+5
| | | | | | | | | | | | | | | If the index we're trying to convert is 0 we can avoid a potentially expensive call to getifaddrs(). No interface has an ifindex of zero, so we can handle this as an error: set the errno to ENXIO and return NULL. Submitted by: Nick Rogers Reviewed by: lutz at donnerhacke.de MFC after: 2 weeks Sponsored by: RG Nets Differential Revision: https://reviews.freebsd.org/D24524 Notes: svn path=/head/; revision=360231
* Fix -Wvoid-pointer-to-enum-cast warnings.Brooks Davis2020-04-154-18/+18
| | | | | | | | | | | | | | | | | This pattern is used in callbacks with void * data arguments and seems both relatively uncommon and relatively harmless. Silence the warning by casting through uintptr_t. This warning is on by default in Clang 11. Reviewed by: arichardson Obtained from: CheriBSD (partial) MFC after: 1 week Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D24425 Notes: svn path=/head/; revision=359978
* Improve validation of the sockaddr length in iruserok_sa().Mark Johnston2020-02-051-2/+2
| | | | | | | | | | | Negative numbers are not valid sockaddr lengths. PR: 243747 Submitted by: Andrew Reiter <areiter@veracode.com> MFC after: 1 week Notes: svn path=/head/; revision=357575
* Increase YPMAXRECORD to 16M to be compatible with Linux.Konstantin Belousov2019-08-123-10/+19
| | | | | | | | | | | | | | | | | | | | | | | Since YP protocol definition uses the constant to declare variable-size opaque byte strings, the change should be binary compatible with existing installations which do not expose keys or values larger than 1024 bytes. All uses of local variables with YPMAXRECORD sizes were removed to avoid insane stack use. On the other hand, variables with static lifetime should be fine and only result in increased VA use. Glibc made same change, increasing the allowed length for keys and values in YP to 16M, in 2013. Reviewed by: markj Discussed with: ian Sponsored by: Mellanox Technologies MFC after: 3 weeks Differential revision: https://reviews.freebsd.org/D20900 Notes: svn path=/head/; revision=350957
* typo: suppported.Pedro F. Giffuni2019-05-291-1/+1
| | | | Notes: svn path=/head/; revision=348349
* Use IN_foo() macros from sys/netinet/in.h inplace of handcrafted codeRodney W. Grimes2019-04-041-4/+2
| | | | | | | | | | | | | | | | There are a few places that use hand crafted versions of the macros from sys/netinet/in.h making it difficult to actually alter the values in use by these macros. Correct that by replacing handcrafted code with proper macro usage. Reviewed by: karels, kristof Approved by: bde (mentor) MFC after: 3 weeks Sponsored by: John Gilmore Differential Revision: https://reviews.freebsd.org/D19317 Notes: svn path=/head/; revision=345888
* Use correct buffer sizes in sctp_get[lp]addrs().Michael Tuexen2019-03-021-4/+2
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=344722
* Sync "struct addrinfo" declaration with netdb.h.Sergey Kandaurov2019-02-101-9/+9
| | | | | | | | | | | Notably, unlike in OpenBSD, which the man page was copied from, ai_canonname and ai_addr come in different order. PR: 225880 MFC after: 1 week Notes: svn path=/head/; revision=343967
* gai_strerror() - Update string error messages according to RFC 3493.Pedro F. Giffuni2018-12-232-28/+25
| | | | | | | | | | | | | | | | | | | Error messages in gai_strerror(3) vary largely among OSs. For new software we largely replaced the obsoleted EAI_NONAME and with EAI_NODATA but we never updated the corresponding message to better match the intended use. We also have references to ai_flags and ai_family which are not very descriptive for non-developer end users. Bring new new error messages based on informational RFC 3493, which has obsoleted RFC 2553, and make them consistent among the header adn manpage. MFC after: 1 month Differentical Revision: D18630 Notes: svn path=/head/; revision=342379
* Style cleanup.Dag-Erling Smørgrav2018-11-271-16/+14
| | | | Notes: svn path=/head/; revision=341009
* Don't call stat(2) on nsswitch.conf(5) every time nsdispatch(3)Edward Tomasz Napierala2018-11-101-0/+11
| | | | | | | | | | | | | | | | | | | and dependent functions (eg getpwname(3)) get called. This can improve performance of binaries that perform a lot of name lookups, such as gssd(8). It also matches documented behaviour of Linux and Solaris. The old code is left in place, should anyone need it, guarded by #ifdef NS_REREAD_CONF. Reviewed by: imp, bcr MFC after: 2 weeks Relnotes: yes Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D17934 Notes: svn path=/head/; revision=340339
* Prevent flex(1) from generating calls to isatty(3) - and, in turn,Edward Tomasz Napierala2018-10-151-0/+1
| | | | | | | | | | | | | TIOCGETA ioctls - when parsing nsswitch.conf(5). Reviewed by: imp, markj Approved by: re (gjb) MFC after: 2 weeks Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D17564 Notes: svn path=/head/; revision=339368
* Don't call dlopen(3) for built-in NSS types - "cache", "compat",Edward Tomasz Napierala2018-10-152-7/+14
| | | | | | | | | | | | | | "dns", "files", "db", and "nis". It saves some path lookups during binary startup. Reviewed by: markj Approved by: re (gjb, kib) MFC after: 2 weeks Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D17557 Notes: svn path=/head/; revision=339363
* Move hosts, hosts.equiv, networks, nsswitch.conf, protocols to lib/libc/net/Brad Davis2018-09-176-0/+232
| | | | | | | | | | | | | | This uses relative paths to make it more specific to avoid any potential future problems with .PATH and leverages CONFS. libc was picked as the destination location for these because of the syscalls that use these files as the lowest level place they are referenced. Approved by: re (gjb), will (mentor) Differential Revision: https://reviews.freebsd.org/D17164 Notes: svn path=/head/; revision=338729
* Remove support for the Arcnet protocol.Brooks Davis2018-04-131-1/+0
| | | | | | | | | | | | | | | | | | While Arcnet has some continued deployment in industrial controls, the lack of drivers for any of the PCI, USB, or PCIe NICs on the market suggests such users aren't running FreeBSD. Evidence in the PR database suggests that the cm(4) driver (our sole Arcnet NIC) was broken in 5.0 and has not worked since. PR: 182297 Reviewed by: jhibbits, vangyzen Relnotes: yes Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D15057 Notes: svn path=/head/; revision=332490
* Make getnameinfo(3) salen requirement less strict andHiroki Sato2018-03-152-9/+33
| | | | | | | | | | | | | | | | | | | | | | | document details of salen in getnameinfo(3) manual page. getnameinfo(3) returned EAI_FAIL when salen was not equal to the length corresponding to the value specified by sa->sa_family. However, POSIX or RFC 3493 does not require it and RFC 4038 Sec.6.2.3 shows an example passing sizeof(struct sockaddr_storage) to salen. This change makes the requirement less strict by accepting salen up to sizeof(struct sockaddr_storage). It also includes two more changes: one is to fix return values because both SUSv4 and RFC 3493 require EAI_FAMILY when the address length is invalid, another is to fix sa_len dependency in PF_LOCAL. Pointed out by: Christophe Beauval Reviewed by: ae Differential Revision: https://reviews.freebsd.org/D14585 Notes: svn path=/head/; revision=331000
* The source strings are from the password database which guaranteesWarner Losh2018-01-061-2/+2
| | | | | | | | | | that the data going into it is sane. Out of an abundance of caution, limit the string copies to prevent an overflow. CID: 1019035 Notes: svn path=/head/; revision=327619
* Don't ignore trailing spaces after numerical IP addresses.Hajimu UMEMOTO2017-12-201-1/+2
| | | | | | | | | | PR: 224403 Reported by: Michael Kaufmann Reviewed by: Michael Kaufmann MFC after: 1 week Notes: svn path=/head/; revision=327029
* SPDX: mostly fixes to previous changes.Pedro F. Giffuni2017-12-134-1/+9
| | | | | | | | Introduce the recently approved BSD-1-Clause and replace 0BSD which never did fit well our use cases. Notes: svn path=/head/; revision=326823
* libc: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-2516-2/+34
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using mis-identified many licenses so this was mostly a manual - error prone - task. 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. Notes: svn path=/head/; revision=326193
* General further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-2022-18/+62
| | | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=326025
* spdx: initial adoption of licensing ID tags.Pedro F. Giffuni2017-11-181-1/+3
| | | | | | | | | | | | | | | | | | | | 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. Initially, only tag files that use BSD 4-Clause "Original" license. RelNotes: yes Differential Revision: https://reviews.freebsd.org/D13133 Notes: svn path=/head/; revision=325966
* mdoc style: start new sentence on new lineBenjamin Kaduk2017-10-041-2/+4
| | | | Notes: svn path=/head/; revision=324277
* Fix typo.Cy Schubert2017-10-041-1/+1
| | | | | | | Reported by: se Notes: svn path=/head/; revision=324260
* Clarify the wording describing the stayopen flag.Cy Schubert2017-10-041-9/+8
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=324249
* Silently handle freeaddrinfo(NULL) for compatibility with code whichKonstantin Belousov2017-09-142-6/+16
| | | | | | | | | | | | | works on other OSes. Also avoid unnecessary NULL check, free(NULL) is valid. Reviewed by: bjk (man page), hrs, hselasky, ume Sponsored by: Mellanox Technologies MFC after: 1 week Differential revision: https://reviews.freebsd.org/D12354 Notes: svn path=/head/; revision=323597
* Don't dlclose NSS modules from nss_atexit().Mark Johnston2017-07-111-6/+3
| | | | | | | | | | | | | As hinted in the commit log message for r259042, this is unnecessary. Moreover, as a result of that change we may invoke a DSO's atexit handler after it has been unmapped. Reviewed by: bdrewery, cem MFC after: 1 week Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=320895
* Don't end up manpage titles with a full stop.Edward Tomasz Napierala2017-05-242-2/+2
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=318816
* sctp_send(3): start sentences on new linesEnji Cooper2017-05-231-2/+2
| | | | | | | | | Reported by: make manlint MFC after: 2 weeks Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=318707
* Remove the NATM framework including the en(4), fatm(4), hatm(4), andBrooks Davis2017-04-241-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | patm(4) devices. Maintaining an address family and framework has real costs when we make infrastructure improvements. In the case of NATM we support no devices manufactured in the last 20 years and some will not even work in modern motherboards (some newer devices that patm(4) could be updated to support apparently exist, but we do not currently have support). With this change, support remains for some netgraph modules that don't require NATM support code. It is unclear if all these should remain, though ng_atmllc certainly stands alone. Note well: FreeBSD 11 supports NATM and will continue to do so until at least September 30, 2021. Improvements to the code in FreeBSD 11 are certainly welcome. Reviewed by: philip Approved by: harti Notes: svn path=/head/; revision=317383
* libc: provide some bounds-checking through reallocarray(3).Pedro F. Giffuni2017-03-121-1/+1
| | | | | | | | | | | | reallocarray(3) is a non portable extension that originated in OpenBSD. Given that it is already in FreeBSD's libc it is useful for the cases where reallocation involves a multiplication. MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D9955 Notes: svn path=/head/; revision=315162
* Renumber copyright clause 4Warner Losh2017-02-2826-26/+26
| | | | | | | | | | | | Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point. Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96 Notes: svn path=/head/; revision=314436
* Fix indentation in nss_configure().Mark Johnston2017-02-141-13/+13
| | | | | | | | MFC after: 1 week Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=313749
* Register nss_atexit() before parsing nsswitch.conf for the first time.Mark Johnston2017-02-141-2/+2
| | | | | | | | | | | | | NSS modules are loaded when nsswitch.conf is parsed and may register their own atexit handlers with libc. nss_atexit() unloads any dynamically loaded NSS modules, so it should run only after the modules' atexit handlers have been invoked. MFC after: 2 weeks Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=313748
* Cleanup inelegant calloc(3) introduced in r310984.Pedro F. Giffuni2017-01-021-1/+1
| | | | Notes: svn path=/head/; revision=311102
* Use calloc instead of malloc + memset(.., 0, ..)Enji Cooper2016-12-311-8/+4
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=310984
* Address regressions in SA-16:37.libc.Gleb Smirnoff2016-12-071-6/+5
| | | | | | | | PR: 215105 Submitted by: <jtd2004a sbcglobal.net> Notes: svn path=/head/; revision=309688
* Fix a bug in sctp_sendmsgx(), where the sid provided by the userMichael Tuexen2016-12-071-1/+1
| | | | | | | | | was hot honored. MFC after: 3 days Notes: svn path=/head/; revision=309683
* Fix possible buffer overflow(s) in link_ntoa(3).Gleb Smirnoff2016-12-061-17/+34
| | | | | | | | | | | | A specially crafted sockaddr_dl argument can trigger a static buffer overflow in the libc library, with possibility to rewrite with arbitrary data following static buffers that belong to other library functions. Reviewed by: kib Security: FreeBSD-SA-16:37.libc Notes: svn path=/head/; revision=309639
* 'addrlen' does not matter when we need to find the first non-zero bit inAndrey A. Chernov2016-08-312-2/+2
| | | | | | | | | | | the byte from the left and 'addrlen' already counted in 'lim'. PR: 212121 Submitted by: Herbie.Robinson@stratus.com MFC after: 7 days Notes: svn path=/head/; revision=305144
* Apply the same qsort() usage fix as in r304911 getaddrinfo.cAndrey A. Chernov2016-08-311-0/+19
| | | | | | | | | qsort() can't be stabilized with just return(-1) alone. MFC after: 3 days Notes: svn path=/head/; revision=305133
* The formal behavior of qsort is unstable with regard to objects thatAndrey A. Chernov2016-08-271-0/+19
| | | | | | | | | | | | | | | | are equal. Unfortunately, RFC 3484 requires that otherwise equal objects remain in the order supplied by the DNS server. The present code attempts to deal with this by returning -1 for objects that are equal (i.e., returns that the first parameter is less then the second parameter). Unfortunately, the qsort API does not state that the first parameter passed in is in any particular position in the list. PR: 212122 Submitted by: Herbie.Robinson@stratus.com MFC after: 3 days Notes: svn path=/head/; revision=304911
* Remove <sys/types.h> from the SYNOPSIS.Kevin Lo2016-08-181-2/+1
| | | | Notes: svn path=/head/; revision=304334
* Don't conflate enum nss_status return values values with int (NS_SUCCESS,Brooks Davis2016-08-161-38/+38
| | | | | | | | | | NS_RETURN) values. Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D6046 Notes: svn path=/head/; revision=304216