libc: fix description issues in mac_text(3)/mac_free(3)mac_text(3) as-written would seem to indicate that a `mac_t` should be
freed with free(3), but this isn't the case. One can derive from
context from when the change was introduced and COMPATIBILITY that this
was intended to talk about *text in `mac_to_text`, so move the comment
there.
PR: 179832
Co-authored-by: Priit Järv <priit cc ttu ee>
MFC after: 3 days
sndctl(8): Modify vchans only on supported directions
Currently mod_play_vchans() and mod_rec_vchans() run unconditionally,
even if the direction (playback, recording) is not supported by the
device. This results in the "autoconv" (see mod_autoconv()) control
failing when run on simplex devices, because we'll be trying to modify
vchans on an unsupported direction.
Test whether the direction is supported and silently move on if it
isn't.
Sponsored by: The FreeBSD Foundation
MFC after: 4 days
Differential Revision: https://reviews.freebsd.org/D53233
(cherry picked from commit 70b34fbdbea13c006a724844caa53f59e0e53bd0)
tcp over udp: don't copy more bytes than avaiable
When copying the data in the first mbuf to get rid of the UDP
header, use the correct length. It was copying too much (8 bytes,
the length of the UDP header).
This only applies to handling TCP over UDP packets. The support for
TCP over UDP is disabled by default.
Reported by: jtl
Reviewed by: Peter Lei
Sponsored by: Netflix, Inc.
(cherry picked from commit bfda98a42027417b2fa74738c63327532013e93b)
arp: fix adding proxy entries for P2P interfaces
The old rtsock implementation used in-kernel workaround to do so.
When route to specified destination address used P2P interface, the
kernel did the search with ifa_ifwithnet() for most suitable network
and then add proxy entry to this interface.
Use similar approach with netlink implementation. We already have
get_ether_addr() function that does almost the same thing as
ifa_ifwithnet(). Use it when we find that destination route uses
P2P interface and then try to guess suitable interface. This should
fix the use of netlink-based arp(8) in mpd5.
Rename get_ether_addr() to get_ifinfo(), since now it is used to find
only ifindex in case when hwaddr is specified by user.
Also make set_nl() and delete_nl() prototype similar to rtsock.
And allow '-i' to be used with '-S', since we already allow the same
for '-s'.
[6 lines not shown]
arp: fix adding proxy entries for P2P interfaces
The old rtsock implementation used in-kernel workaround to do so.
When route to specified destination address used P2P interface, the
kernel did the search with ifa_ifwithnet() for most suitable network
and then add proxy entry to this interface.
Use similar approach with netlink implementation. We already have
get_ether_addr() function that does almost the same thing as
ifa_ifwithnet(). Use it when we find that destination route uses
P2P interface and then try to guess suitable interface. This should
fix the use of netlink-based arp(8) in mpd5.
Rename get_ether_addr() to get_ifinfo(), since now it is used to find
only ifindex in case when hwaddr is specified by user.
Also make set_nl() and delete_nl() prototype similar to rtsock.
And allow '-i' to be used with '-S', since we already allow the same
for '-s'.
[6 lines not shown]
inet_net_test: Use int to hold expected return values from inet_net_pton
GCC warns about the sign mismatch in comparisons:
lib/libc/tests/net/inet_net_test.cc: In member function 'virtual void {anonymous}::atfu_tc_inet_net_inet4::body() const':
lib/libc/tests/net/inet_net_test.cc:86:17: error: comparison of integer expressions of different signedness: 'int' and 'const unsigned int' [-Werror=sign-compare]
86 | ATF_REQUIRE_EQ(bits, addr.bits);
| ^~~~~~~~~~~~~~
lib/libc/tests/net/inet_net_test.cc: In member function 'virtual void {anonymous}::atfu_tc_inet_net_inet6::body() const':
lib/libc/tests/net/inet_net_test.cc:205:17: error: comparison of integer expressions of different signedness: 'int' and 'const unsigned int' [-Werror=sign-compare]
205 | ATF_REQUIRE_EQ(bits, addr.bits);
| ^~~~~~~~~~~~~~
Approved by: re (cperciva)
Fixes: 8f4a0d2f7b96 ("libc: Import OpenBSD's inet_net_{ntop,pton}")
(cherry picked from commit e1aeb58cbbc3839db93ec38ce491b7b9383d5649)
(cherry picked from commit 7ffd190ae9c82e4359d8a6f6ae2d1b82e8eb6453)