|
Revision tags: release/13.4.0-p5, release/13.5.0-p1, release/14.2.0-p3, release/13.5.0, release/14.2.0-p2, release/14.1.0-p8, release/13.4.0-p4, release/14.1.0-p7, release/14.2.0-p1, release/13.4.0-p3, release/14.2.0, release/13.4.0, release/14.1.0, release/13.3.0, release/14.0.0 |
|
| #
685dc743 |
| 16-Aug-2023 |
Warner Losh <[email protected]> |
sys: Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
|
| #
5ab15157 |
| 24-May-2023 |
Doug Rabson <[email protected]> |
netinet*: Fix redirects for connections from localhost
Redirect rules use PFIL_IN and PFIL_OUT events to allow packet filter rules to change the destination address and port for a connection. Typica
netinet*: Fix redirects for connections from localhost
Redirect rules use PFIL_IN and PFIL_OUT events to allow packet filter rules to change the destination address and port for a connection. Typically, the rule triggers on an input event when a packet is received by a router and the destination address and/or port is changed to implement the redirect. When a reply packet on this connection is output to the network, the rule triggers again, reversing the modification.
When the connection is initiated on the same host as the packet filter, it is initially output via lo0 which queues it for input processing. This causes an input event on the lo0 interface, allowing redirect processing to rewrite the destination and create state for the connection. However, when the reply is received, no corresponding output event is generated; instead, the packet is delivered to the higher level protocol (e.g. tcp or udp) without reversing the redirect, the reply is not matched to the connection and the packet is dropped (for tcp, a connection reset is also sent).
This commit fixes the problem by adding a second packet filter call in the input path. The second call happens right before the handoff to higher level processing and provides the missing output event to allow the redirect's reply processing to perform its rewrite. This extra processing is disabled by default and can be enabled using pfilctl:
pfilctl link -o pf:default-out inet-local pfilctl link -o pf:default-out6 inet6-local
PR: 268717 Reviewed-by: kp, melifaro MFC-after: 2 weeks Differential Revision: https://reviews.freebsd.org/D40256
show more ...
|
|
Revision tags: release/13.2.0 |
|
| #
713264f6 |
| 06-Mar-2023 |
Mark Johnston <[email protected]> |
netinet: Tighten checks for unspecified source addresses
The assertions added in commit b0ccf53f2455 ("inpcb: Assert against wildcard addrs in in_pcblookup_hash_locked()") revealed that protocol lay
netinet: Tighten checks for unspecified source addresses
The assertions added in commit b0ccf53f2455 ("inpcb: Assert against wildcard addrs in in_pcblookup_hash_locked()") revealed that protocol layers may pass the unspecified address to in_pcblookup().
Add some checks to filter out such packets before we attempt an inpcb lookup: - Disallow the use of an unspecified source address in in_pcbladdr() and in6_pcbladdr(). - Disallow IP packets with an unspecified destination address. - Disallow TCP packets with an unspecified source address, and add an assertion to verify the comment claiming that the case of an unspecified destination address is handled by the IP layer.
Reported by: [email protected] Reported by: [email protected] Reported by: [email protected] Reviewed by: glebius, melifaro MFC after: 2 weeks Sponsored by: Klara, Inc. Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D38570
show more ...
|
| #
3d0d5b21 |
| 23-Jan-2023 |
Justin Hibbits <[email protected]> |
IfAPI: Explicitly include <net/if_private.h> in netstack
Summary: In preparation of making if_t completely opaque outside of the netstack, explicitly include the header. <net/if_var.h> will stop in
IfAPI: Explicitly include <net/if_private.h> in netstack
Summary: In preparation of making if_t completely opaque outside of the netstack, explicitly include the header. <net/if_var.h> will stop including the header in the future.
Sponsored by: Juniper Networks, Inc. Reviewed by: glebius, melifaro Differential Revision: https://reviews.freebsd.org/D38200
show more ...
|
|
Revision tags: release/12.4.0 |
|
| #
126f8248 |
| 07-Nov-2022 |
Michael Tuexen <[email protected]> |
Unbreak builds having SCTP support compiled in
Including sctp_var.h requires INET to be defined if IPv4 support is needed.
|
| #
fcb3f813 |
| 04-Oct-2022 |
Gleb Smirnoff <[email protected]> |
netinet*: remove PRC_ constants and streamline ICMP processing
In the original design of the network stack from the protocol control input method pr_ctlinput was used notify the protocols about two
netinet*: remove PRC_ constants and streamline ICMP processing
In the original design of the network stack from the protocol control input method pr_ctlinput was used notify the protocols about two very different kinds of events: internal system events and receival of an ICMP messages from outside. These events were coded with PRC_ codes. Today these methods are removed from the protosw(9) and are isolated to IPv4 and IPv6 stacks and are called only from icmp*_input(). The PRC_ codes now just create a shim layer between ICMP codes and errors or actions taken by protocols.
- Change ipproto_ctlinput_t to pass just pointer to ICMP header. This allows protocols to not deduct it from the internal IP header. - Change ip6proto_ctlinput_t to pass just struct ip6ctlparam pointer. It has all the information needed to the protocols. In the structure, change ip6c_finaldst fields to sockaddr_in6. The reason is that icmp6_input() already has this address wrapped in sockaddr, and the protocols want this address as sockaddr. - For UDP tunneling control input, as well as for IPSEC control input, change the prototypes to accept a transparent union of either ICMP header pointer or struct ip6ctlparam pointer. - In icmp_input() and icmp6_input() do only validation of ICMP header and count bad packets. The translation of ICMP codes to errors/actions is done by protocols. - Provide icmp_errmap() and icmp6_errmap() as substitute to inetctlerrmap, inet6ctlerrmap arrays. - In protocol ctlinput methods either trust what icmp_errmap() recommend, or do our own logic based on the ICMP header.
Differential revision: https://reviews.freebsd.org/D36731
show more ...
|
| #
53807a8a |
| 04-Oct-2022 |
Gleb Smirnoff <[email protected]> |
netinet*: use sparse C99 initializer for inetctlerrmap
and mark those PRC_* codes, that are used. The rest are dead code. This is not a functional change, but illustrative to make easier review of
netinet*: use sparse C99 initializer for inetctlerrmap
and mark those PRC_* codes, that are used. The rest are dead code. This is not a functional change, but illustrative to make easier review of following changes.
show more ...
|
| #
dda6376b |
| 08-Sep-2022 |
Mateusz Guzik <[email protected]> |
net: employ newly added pfil_mbuf_{in,out} where approriate
Reviewed by: glebius Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D36454
|
| #
223a73a1 |
| 06-Sep-2022 |
Mateusz Guzik <[email protected]> |
net: remove stale altq_input reference
Code setting it was removed in: commit 325fab802e1f40c992141f945d0788c0edfdb1a4 Author: Eric van Gyzen <[email protected]> Date: Tue Dec 4 23:46:43 2018 +
net: remove stale altq_input reference
Code setting it was removed in: commit 325fab802e1f40c992141f945d0788c0edfdb1a4 Author: Eric van Gyzen <[email protected]> Date: Tue Dec 4 23:46:43 2018 +0000
altq: remove ALTQ3_COMPAT code
Reviewed by: glebius, kp Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D36471
show more ...
|
| #
74ed2e8a |
| 02-Sep-2022 |
Gleb Smirnoff <[email protected]> |
raw ip: fix regression with multicast and RSVP
With 61f7427f02a raw sockets protosw has wildcard pr_protocol. Protocol of a specific pcb is stored in inp_ip_p.
Reviewed by: karels Reported by: k
raw ip: fix regression with multicast and RSVP
With 61f7427f02a raw sockets protosw has wildcard pr_protocol. Protocol of a specific pcb is stored in inp_ip_p.
Reviewed by: karels Reported by: karels Differential revision: https://reviews.freebsd.org/D36429 Fixes: 61f7427f02a307d28af674a12c45dd546e3898e4
show more ...
|
| #
aea0cd04 |
| 17-Aug-2022 |
Gleb Smirnoff <[email protected]> |
ip_reass: separate ipreass_init() into global and VIMAGE parts
Should have been done in 89128ff3e42.
|
| #
81a34d37 |
| 17-Aug-2022 |
Gleb Smirnoff <[email protected]> |
protosw: retire pr_drain and use EVENTHANDLER(9) directly
The method was called for two different conditions: 1) the VM layer is low on pages or 2) one of UMA zones of mbuf allocator exhausted. This
protosw: retire pr_drain and use EVENTHANDLER(9) directly
The method was called for two different conditions: 1) the VM layer is low on pages or 2) one of UMA zones of mbuf allocator exhausted. This change 2) into a new event handler, but all affected network subsystems modified to subscribe to both, so this change shall not bring functional changes under different low memory situations.
There were three subsystems still using pr_drain: TCP, SCTP and frag6. The latter had its protosw entry for the only reason to register its pr_drain method.
Reviewed by: tuexen, melifaro Differential revision: https://reviews.freebsd.org/D36164
show more ...
|
| #
160f01f0 |
| 17-Aug-2022 |
Gleb Smirnoff <[email protected]> |
ip_reass: use callout(9) directly instead of pr_slowtimo
Reviewed by: melifaro Differential revision: https://reviews.freebsd.org/D36236
|
| #
78b1fc05 |
| 17-Aug-2022 |
Gleb Smirnoff <[email protected]> |
protosw: separate pr_input and pr_ctlinput out of protosw
The protosw KPI historically has implemented two quite orthogonal things: protocols that implement a certain kind of socket, and protocols t
protosw: separate pr_input and pr_ctlinput out of protosw
The protosw KPI historically has implemented two quite orthogonal things: protocols that implement a certain kind of socket, and protocols that are IPv4/IPv6 protocol. These two things do not make one-to-one correspondence. The pr_input and pr_ctlinput methods were utilized only in IP protocols. This strange duality required IP protocols that doesn't have a socket to declare protosw, e.g. carp(4). On the other hand developers of socket protocols thought that they need to define pr_input/pr_ctlinput always, which lead to strange dead code, e.g. div_input() or sdp_ctlinput().
With this change pr_input and pr_ctlinput as part of protosw disappear and IPv4/IPv6 get their private single level protocol switch table ip_protox[] and ip6_protox[] respectively, pointing at array of ipproto_input_t functions. The pr_ctlinput that was used for control input coming from the network (ICMP, ICMPv6) is now represented by ip_ctlprotox[] and ip6_ctlprotox[].
ipproto_register() becomes the only official way to register in the table. Those protocols that were always static and unlikely anybody is interested in making them loadable, are now registered by ip_init(), ip6_init(). An IP protocol that considers itself unloadable shall register itself within its own private SYSINIT().
Reviewed by: tuexen, melifaro Differential revision: https://reviews.freebsd.org/D36157
show more ...
|
| #
b46667c6 |
| 17-May-2022 |
Gleb Smirnoff <[email protected]> |
sockbuf: merge two versions of sbcreatecontrol() into one
No functional change.
|
|
Revision tags: release/13.1.0 |
|
| #
77223d98 |
| 25-Jan-2022 |
Wojciech Macek <[email protected]> |
ip_mroute: refactor epoch-basd locking
Remove duplicated epoch_enter and epoch_exit in IP inp/outp routines. Remove unnecessary macros as well.
Obtained from: Semihalf Spponsored by: Stormshield
ip_mroute: refactor epoch-basd locking
Remove duplicated epoch_enter and epoch_exit in IP inp/outp routines. Remove unnecessary macros as well.
Obtained from: Semihalf Spponsored by: Stormshield Reviewed by: glebius Differential revision: https://reviews.freebsd.org/D34030
show more ...
|
| #
89128ff3 |
| 03-Jan-2022 |
Gleb Smirnoff <[email protected]> |
protocols: init with standard SYSINIT(9) or VNET_SYSINIT
The historical BSD network stack loop that rolls over domains and over protocols has no advantages over more modern SYSINIT(9). While doing t
protocols: init with standard SYSINIT(9) or VNET_SYSINIT
The historical BSD network stack loop that rolls over domains and over protocols has no advantages over more modern SYSINIT(9). While doing the sweep, split global and per-VNET initializers.
Getting rid of pr_init allows to achieve several things: o Get rid of ifdef's that protect against double foo_init() when both INET and INET6 are compiled in. o Isolate initializers statically to the module they init. o Makes code easier to understand and maintain.
Reviewed by: melifaro Differential revision: https://reviews.freebsd.org/D33537
show more ...
|
| #
f389439f |
| 26-Dec-2021 |
Bjoern A. Zeeb <[email protected]> |
IPv4: fix redirect sending conditions
RFC792,1009,1122 state the original conditions for sending a redirect. RFC1812 further refine these. ip_forward() still sepcifies the checks originally implemen
IPv4: fix redirect sending conditions
RFC792,1009,1122 state the original conditions for sending a redirect. RFC1812 further refine these. ip_forward() still sepcifies the checks originally implemented for these (we do slightly more/different than suggested as makes sense). The implementation added in 8ad114c082a159c0dde95aa35d2e3e108aa30a75 to ip_tryforward() however is flawed and may send a "multi-hop" redirects (to a host not on the directly connected network).
Do proper checks in ip_tryforward() to stop us from sending redirects in situations we may not. Keep as much logic out of ip_tryforward() and in ip_redir_alloc() and only do the mbuf copy once we are sure we will send a redirect.
While here enhance and fix comments as to which conditions are handled for sending redirects in various places.
Reported by: pi (on net@ 2021-12-04) MFC after: 3 days Sponsored by: Dr.-Ing. Nepustil & Co. GmbH Reviewed by: cy, others (earlier versions) Differential Revision: https://reviews.freebsd.org/D33274
show more ...
|
| #
db0ac6de |
| 02-Dec-2021 |
Cy Schubert <[email protected]> |
Revert "wpa: Import wpa_supplicant/hostapd commit 14ab4a816"
This reverts commit 266f97b5e9a7958e365e78288616a459b40d924a, reversing changes made to a10253cffea84c0c980a36ba6776b00ed96c3e3b.
A mism
Revert "wpa: Import wpa_supplicant/hostapd commit 14ab4a816"
This reverts commit 266f97b5e9a7958e365e78288616a459b40d924a, reversing changes made to a10253cffea84c0c980a36ba6776b00ed96c3e3b.
A mismerge of a merge to catch up to main resulted in files being committed which should not have been.
show more ...
|
| #
3cce6164 |
| 02-Dec-2021 |
Gleb Smirnoff <[email protected]> |
ip_input: remove pointless check in INP_RECVIF handling
An mbuf rcvif pointer is supposed to be valid and doesn't need extra checks. The code appeared in d314ad7b73639.
|
|
Revision tags: release/12.3.0 |
|
| #
2ce85919 |
| 12-Nov-2021 |
Gleb Smirnoff <[email protected]> |
Add net.inet.ip.source_address_validation
Drop packets arriving from the network that have our source IP address. If maliciously crafted they can create evil effects like an RST exchange between tw
Add net.inet.ip.source_address_validation
Drop packets arriving from the network that have our source IP address. If maliciously crafted they can create evil effects like an RST exchange between two of our listening TCP ports. Such packets just can't be legitimate. Enable the tunable by default. Long time due for a modern Internet host.
Reviewed by: donner, melifaro Differential revision: https://reviews.freebsd.org/D32914
show more ...
|
| #
81674f12 |
| 12-Nov-2021 |
Gleb Smirnoff <[email protected]> |
ip_input: packet filters shall not modify m_pkthdr.rcvif
Quick review confirms that they do not, also IPv6 doesn't expect such a change in mbuf. In IPv4 this appeared in 0aade26e6d061, which doesn'
ip_input: packet filters shall not modify m_pkthdr.rcvif
Quick review confirms that they do not, also IPv6 doesn't expect such a change in mbuf. In IPv4 this appeared in 0aade26e6d061, which doesn't seem to have a valid explanation why.
Reviewed by: donner, kp, melifaro Differential revision: https://reviews.freebsd.org/D32913
show more ...
|
| #
94df3271 |
| 12-Nov-2021 |
Gleb Smirnoff <[email protected]> |
Rename net.inet.ip.check_interface to rfc1122_strong_es and document it.
This very questionable feature was enabled in FreeBSD for a very short time. It was disabled very soon upon merging to RELEN
Rename net.inet.ip.check_interface to rfc1122_strong_es and document it.
This very questionable feature was enabled in FreeBSD for a very short time. It was disabled very soon upon merging to RELENG_4 - 23d7f14119bf. And in HEAD was also disabled pretty soon - 4bc37f9836fb1.
The tunable has very vague name. Check interface for what? Given that it was never documented and almost never enabled, I think it is fine to rename it together with documenting it.
Also, count packets dropped by this tunable as ips_badaddr, otherwise they fall down to ips_cantforward counter, which is misleading, as packet was not supposed to be forwarded, it was destined locally.
Reviewed by: donner, kp Differential revision: https://reviews.freebsd.org/D32912
show more ...
|
| #
0359e7a5 |
| 10-Nov-2021 |
Mateusz Guzik <[email protected]> |
net: sprinkle __predict_false in ip_input on error conditions
While here rearrange the RVSP check to inspect proto first and avoid evaluating V_rsvp in the common case to begin with (most notably av
net: sprinkle __predict_false in ip_input on error conditions
While here rearrange the RVSP check to inspect proto first and avoid evaluating V_rsvp in the common case to begin with (most notably avoid the expensive read).
Reviewed by: glebius Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D32929
show more ...
|
| #
c8ee75f2 |
| 10-Oct-2021 |
Gleb Smirnoff <[email protected]> |
Use network epoch to protect local IPv4 addresses hash.
The modification to the hash are already naturally locked by in_control_sx. Convert the hash lists to CK lists. Remove the in_ifaddr_rmlock.
Use network epoch to protect local IPv4 addresses hash.
The modification to the hash are already naturally locked by in_control_sx. Convert the hash lists to CK lists. Remove the in_ifaddr_rmlock. Assert the network epoch where necessary.
Most cases when the hash lookup is done the epoch is already entered. Cover a few cases, that need entering the epoch, which mostly is initial configuration of tunnel interfaces and multicast addresses.
Reviewed by: melifaro Differential revision: https://reviews.freebsd.org/D32584
show more ...
|