aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/net
Commit message (Collapse)AuthorAgeFilesLines
* libc/getnameinfo: stop adding NI_NUMERICHOST where inappropriateBjoern A. Zeeb2024-09-281-17/+37
| | | | | | | | | | | | | | | | | | | | | | | | | Checking the first nibble of the IPv6 address to be 0 and then excluding two well known cases (v4-mapped, loopback) leaves us with more cases where the first nibble could be 0, e.g., the RFC 6052, 2.1 Well-Known Prefix 64:ff9b::/96. It is not practical to track them all and it is not clear what lead to this special casing originally, so remove them. While here also remove the IN6_IS_ADDR_LINKLOCAL() + NI_NUMERICHOST case as link-local address resolution does exist. We do leave the IN6_IS_ADDR_MULTICAST() case for now as I could not find any references to any official reverse lookups for these. Adding comments for more case (and some historic behaviour) in order to make it easier to follow the logic. PR: 279618 Fixes: 6cb9418289f90 Reviewed by: hrs Differential Revision: https://reviews.freebsd.org/D45547 (cherry picked from commit c179937b986ec3959d89bfeb8eed0a6f58a28649)
* sctp: document sctp_recvmsg as implementedMichael Tuexen2024-08-011-3/+3
| | | | | | PR: 275990 (cherry picked from commit eee88ef45f78d7f9996a740c2a554bc6e8496114)
* inet(3): clarify syntax accepted by inet_ptonMike Karels2024-01-301-9/+15
| | | | | | | | | | | | | | | The section INTERNET ADDRESSES describes the acceptance of dotted values with varying number of parts in multiple bases. This applies to inet_aton and inet_addr, but not to inet_pton. Clarify this section by listing the functions to which this applies. Move the description of what inet_pton accepts into this section from STANDARDS, where it is easily missed. Rename the section to clarify that it applies only to IPv4. (inet_pton also works with IPv6.) Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D43537 (cherry picked from commit 9231c42127bf8e47588169ecc395f57cae0e15fb)
* resolv: Add a required include to resolv.hJan Beich2024-01-151-4/+1
| | | | | | | | | | Add a required include to resolv.h for sockaddr_in. This should reduce patching required when porting code written with Linux or NetBSD in mind. PR: 182466 MFC after: 1 week (cherry picked from commit 58cf91d3b72a01777bacf72d66a648a744ae3143)
* hesiod: Modernize.Dag-Erling Smørgrav2023-12-131-29/+13
| | | | | | | Reviewed by: zlei Differential Revision: https://reviews.freebsd.org/D42190 (cherry picked from commit 64fc8a936c868345a8f687fe2797474c5fcf35cb)
* Purge more stray embedded $FreeBSD$ stringsJohn Baldwin2023-10-241-6/+0
| | | | | | | | | These do not use __FBSDID but instead use bare char arrays. Reviewed by: imp, emaste Differential Revision: https://reviews.freebsd.org/D41957 (cherry picked from commit eba230afba4932f02a1ca44efc797cf7499a5cb0)
* Remove $FreeBSD$: one-line nroff patternWarner Losh2023-08-2316-16/+0
| | | | | | | Remove /^\.\\"\s*\$FreeBSD\$$\n/ Similar commit in main: (cherry picked from commit b2c76c41be32)
* Remove $FreeBSD$: two-line nroff patternWarner Losh2023-08-2322-44/+0
| | | | | | | Remove /^\.\\"\n\.\\"\s*\$FreeBSD\$$\n/ Similar commit in main: (cherry picked from commit fa9896e082a1)
* Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-236-6/+0
| | | | | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/ Similar commit in main: (cherry picked from commit d0b2dbfa0ecf)
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-2342-84/+0
| | | | | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/ Similar commit in main: (cherry picked from commit 1d386b48a555)
* Remove $FreeBSD$: one-line .c comment patternWarner Losh2023-08-231-1/+0
| | | | | | | Remove /^/[*/]\s*\$FreeBSD\$.*\n/ Similar commit in main: (cherry picked from commit 2a63c3be1582)
* Remove $FreeBSD$: one-line .h patternWarner Losh2023-08-231-1/+0
| | | | | | | Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/ Similar commit in main: (cherry picked from commit 42b388439bd3)
* Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-233-6/+0
| | | | | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/ Similar commit in main: (cherry picked from commit b3e7694832e8)
* inet.3: remove mention of VAX endiannessEd Maste2023-08-101-11/+0
| | | | | | | | | | Machine endianness is not very important in understanding the inet* functions; the endianness of the VAX is especially so. PR: 272728 Sponsored by: The FreeBSD Foundation (cherry picked from commit 89c762c815dae64a39221956070af549b11ceb80)
* spdx: The BSD-2-Clause-NetBSD identifier is obsolete, drop -NetBSDWarner Losh2023-07-253-3/+3
| | | | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-NetBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix (cherry picked from commit b61a573019428cbdc38ed03be9ecd2482011ea66)
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-07-2513-13/+13
| | | | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix (cherry picked from commit 4d846d260e2b9a3d4d0a701462568268cbfe7a5b)
* inet6_opt_init.3: Some enhancementsGordon Bergling2023-03-051-13/+15
| | | | | | | | | | | - Be consistent with RFC references, so add a space after 'RFC' - Add a LIBRARY section - Use standard integer types in the SYNOPSIS section Obtained from: DragonflyBSD Differential Revision: https://reviews.freebsd.org/D27548 (cherry picked from commit 211ceb62e85d8d01ea89af0de8e43430de550e72)
* getservent.3: Mention the service.dbGordon Bergling2022-12-101-2/+4
| | | | | | | | | - reference /var/db/services.db - reference services_mkdb(8) Obtained from: NetBSD (cherry picked from commit 0393604aa86c7177162a0e6a288a8542a139273e)
* getaddrinfo: distinguish missing addrs from unresolvable namesMike Karels2022-12-031-5/+11
| | | | | | | | | | | | | | | | | | | | Rework getaddrinfo(3) to return different error values for unresolvable names (same as before, EAI_NONAME) and those without a requested addr (EAI_ADDRFAMILY) when using DNS. This is implemented via an added error in the nsswitch layer, NS_ADDRFAMILY, which is used only by getaddrinfo(). The error is passed through nsdispatch(3), but that routine has no changes to handle this error. The error originates in the getaddrinfo DNS layer called via nsdispatch(), and is processed by the search layer that calls nsdispatch(). While here, add a little style to returns near those that were modified. Reviewed in https://reviews.freebsd.org/D37139 with related changes. Reviewed by: bz (cherry picked from commit 144361386696582c04592f200a4c2e3339c81a25)
* gai_strerror.[c3]: re-enable EAI_ADDRFAMILY, EAI_NODATAMike Karels2022-12-032-7/+20
| | | | | | | | | | | | | gai_strerror.c still has messages for EAI_ADDRFAMILY and EAI_NODATA, but not the man page. Re-add to the man page, and update comments in the source. Document the errors that are not in RFC 3493 or POSIX. Reviewed in https://reviews.freebsd.org/D37139 with related changes. Reviewed by: bz, pauamma (cherry picked from commit e34adc71d3724a8b1add483310efbc63db9290a6)
* libc: Don't warn about RRSIG replies.Dag-Erling Smørgrav2022-11-142-2/+5
| | | | | | | | PR: 213178 MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D37303 (cherry picked from commit 817f1f3064db25f821032c8fffb131183206bba1)
* Update SEE ALSO sections for resolver.{3,5} and hosts.5Gordon Bergling2022-09-241-4/+1
| | | | | | | | | | | | | The mentioned document "Name Server Operations Guide for BIND" is outdated, so remove it from the SEE ALSO section of hosts.5 and resolver.{3,5}. PR: 266360 Reported by: Graham Perrin <grahamperrin at FreeBSD dot org> Reviewed by: karels Differential Revision: https://reviews.freebsd.org/D36557 (cherry picked from commit 0090d18235269cc5f9582712a42fb5641d5b6f71)
* Bump .Dd for recently modified manual pagesFernando Apesteguía2022-09-247-7/+7
| | | | | | | | | | During the removal of named(8) references, some pages were modified but their .Dd where not updated accordingly. Reported by: lwhsu@ Fixes: 942e234d868d (cherry picked from commit 4a3c598f352064cc4d2de588bf0058a7417f2402)
* getnetent(3): Add missing reentrant functionsFernando Apesteguía2022-09-242-5/+35
| | | | | | | | | | | | | Add documentation for gethostbyname_r, gethostbyname2_r and gethostbyaddr_r Create proper MLINKs for the new functions. PR: 249154 Reported by: asomers@ Approved by: manpages (0mp@), Pau Amma Differential Revision: https://reviews.freebsd.org/D30469 (cherry picked from commit dc68997328ec6cec41ad3b818c1846c8217e0c68)
* Remove references to named(8)Fernando Apesteguía2022-09-247-18/+8
| | | | | | | | | | named(8) hasn't been in base for some time. Remove all references to it in manual pages. Approved by: manpages (Pau Amma) Differential Revision: https://reviews.freebsd.org/D35586 (cherry picked from commit 942e234d868ddc64a11b6af0ee78d47ccb44de1f)
* sockatmark(3): Add references to 4.4BSD IPC tutorialsGordon Bergling2022-07-081-1/+16
| | | | | | Obtained from: NetBSD (cherry picked from commit 6cea3be922110647df84a08e3a57cc395bec1d24)
* if_indextoname(3): Correct the RFC in a commentGordon Bergling2022-04-101-1/+1
| | | | | | | | | | RFC 2533 refers to 'A Syntax for Describing Media Feature Sets', which is wrong since the correct reference should be RFC 2553 'Basic Socket Interface Extensions for IPv6'. Obtained from: OpenBSD (cherry picked from commit fa556e83be84c588704ce0d652803eb7187bcd30)
* libc: Fix build with -DNS_REREAD_CONF.Alexander Motin2022-01-011-0/+2
| | | | | | MFC after: 3 days (cherry picked from commit 62ed2d0152dce6da883fef753e0995e6d85e0cf1)
* man pages: deprecate Internet Class A/B/CMike Karels2021-12-102-23/+13
| | | | | | | | | Mark functions inet_netof(), inet_lnaof(), and inet_makeaddr() as deprecated, as they assume Class A/B/C. inet_makeaddr() mostly works when networks are a multiple of 8 bits, but warn for anything other than historical classes. Reduce other mentions of network classes. (cherry picked from commit 12bd931d8c64ad2d5e78c7ab917efbff326152ca)
* libc sctp: improve conformance of sctp_getpaddrs()Michael Tuexen2021-12-101-1/+5
| | | | | | | | | | When there is no association, don't return -1 and indicate ENOENT, but return 0 instead. This is specified in RFC 6458. PR: 260117 MFC after: 1 week (cherry picked from commit 83a103ec429a6dd862a73857ebeeff863a41a34d)
* libc sctp: fix sctp_getladdrs() when reporting no addressesMichael Tuexen2021-12-101-4/+4
| | | | | | | | | | | | Section 9.5 of RFC 6458 (SCTP Socket API) requires that sctp_getladdrs() returns 0 in case the socket is unbound. This is the cause of reporting 0 addresses. So don't indicate an error, just report this case as required. PR: 260117 MFC after: 1 week (cherry picked from commit 071966e874ed472bdac031b7e89d08bacf8bbbc4)
* libc sctp: improve error reporting of sctp_getladdrs()Michael Tuexen2021-12-101-2/+0
| | | | | | | | Do not hide errno from getsockopt() called internally. MFC after: 1 week (cherry picked from commit 6e9309bd3b04501b69593900a14e01114c7f2404)
* libc sctp: fix sctp_getladdrs() for 64-bit BE platformsMichael Tuexen2021-12-101-10/+10
| | | | | | | | | | | When calling getsockopt() with SCTP_GET_LOCAL_ADDR_SIZE, use a pointer to a 32-bit variable, since this is what the kernel expects. While there, do some cleanups. MFC after: 1 week (cherry picked from commit dabd8bf9145a0a7255473a482e2ccf31919c3089)
* libc/net/nscachedcli.c: remove write-only variablesKonstantin Belousov2021-12-061-4/+2
| | | | (cherry picked from commit 0e00befcaf6614c513fb32485ea9a2b188169bc2)
* libc/net/getservent.c: Mark write-only variables as unusedKonstantin Belousov2021-12-061-8/+8
| | | | (cherry picked from commit 346eaa41f89aaf1545b89f77a88fd1cdd3c37456)
* libc/net/getprotoent.c: Mark write-only variables as unusedKonstantin Belousov2021-12-061-6/+6
| | | | (cherry picked from commit f6d403743c9eb1facdfcc0fdfbec74fb19dbbc21)
* libc/net/getnetnamadr.c: Mark write-only variables as unusedKonstantin Belousov2021-12-061-8/+8
| | | | (cherry picked from commit 1c4f305d21c069ebfdab6baada0837f7ecc810ea)
* libc/net/gethostnamadr.c: mark write-only variables as __unusedKonstantin Belousov2021-12-061-8/+8
| | | | (cherry picked from commit 024547c9bd6f7e65d383199aab80dae08824ae48)
* Correct section reference for examples in RFC3542Tom Jones2021-08-041-2/+2
| | | | | | | | Reviewed by: bz, network MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D26272 (cherry picked from commit 44752e92e134167e9a0ecd277e32608a5595e6d1)
* Revert "lib/libc/net/nsdispatch.c: Fix missing unlock and add locking ↵Alex Richardson2021-04-191-129/+72
| | | | | | | | | | | | | annotations" This commit should not have introduced any functional changes, but apparently it did. This appears to have broken LDAP setups. Reverting for now. Will reland once I have fixed the breakage. This reverts commit 3496971e61dc9f6e725e57fb7b5f0c57631bbfc2. Reported By: Александр Недоцуков, brd (cherry picked from commit 738314e445ceac4d3dd6c77c636044141623b8dc)
* lib/libc/net/nsdispatch.c: Fix missing unlock and add locking annotationsAlex Richardson2021-04-101-72/+129
| | | | | | | | | | | | | | | The error cases (goto fin) of _nsdispatch were missing the unlock. This change also drops the checks for __isthreaded since the pthread stubs are already no-ops if threads are not being used. Dropping those conditionals allows clang's thread safety analysis to deal with the file and also makes the code a bit more readable. While touching the file also add a few more assertions in debug mode that the right locks are held. Reviewed By: markj Differential Revision: https://reviews.freebsd.org/D29372 (cherry picked from commit 5245bf7b92b74e556527b4916a8deba386fe5772)
* 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