Revision tags: release/14.2.0 |
|
#
e4e0f497 |
| 22-Oct-2024 |
Kristof Provost <kp@FreeBSD.org> |
in: add in_mask2len()
Similar to the existing in6_mask2len() function, but for IPv4. This will be used by pf's nat64 code.
Obtained from: OpenBSD Sponsored by: Rubicon Communications, LLC ("Netgate
in: add in_mask2len()
Similar to the existing in6_mask2len() function, but for IPv4. This will be used by pf's nat64 code.
Obtained from: OpenBSD Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D47785
show more ...
|
Revision tags: release/13.4.0 |
|
#
8f04209d |
| 05-Jun-2024 |
Kristof Provost <kp@FreeBSD.org> |
pf: simplify pf_addrcpy() and pf_match_addr()
Use the v4/v6 union members rather than the uint32_t ones. Export IN_ARE_MASKED_ADDR_EQUAL() in in_var.h and use it (and its IPv6 equivalent) for masked
pf: simplify pf_addrcpy() and pf_match_addr()
Use the v4/v6 union members rather than the uint32_t ones. Export IN_ARE_MASKED_ADDR_EQUAL() in in_var.h and use it (and its IPv6 equivalent) for masked comparisons rather than hand-rolled code.
Event: Kitchener-Waterloo Hackathon 202406
show more ...
|
Revision tags: release/14.1.0, release/13.3.0 |
|
#
29363fb4 |
| 23-Nov-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl s
sys: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script.
Sponsored by: Netflix
show more ...
|
Revision tags: release/14.0.0 |
|
#
2ff63af9 |
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove $FreeBSD$: one-line .h pattern
Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
|
#
bb06a80c |
| 29-Jun-2023 |
Alexander V. Chernikov <melifaro@FreeBSD.org> |
netinet[6]: make in[6]_control use ucred instead of td.
Reviewed by: markj, zlei Differential Revision: https://reviews.freebsd.org/D40793 MFC after: 2 weeks
|
Revision tags: release/13.2.0, release/12.4.0 |
|
#
1e9482f4 |
| 08-Oct-2022 |
Alexander Motin <mav@FreeBSD.org> |
inet: Simplify if_multiaddrs iteration.
Similar to 2cd6ad766eb23 for inet6 drop ifma_restart use, creating more problems than solving. It is no longer needed after epoch introduction.
While there,
inet: Simplify if_multiaddrs iteration.
Similar to 2cd6ad766eb23 for inet6 drop ifma_restart use, creating more problems than solving. It is no longer needed after epoch introduction.
While there, add NULL check for ifma_ifp in igmp_change_state(), that sometimes caused panics on interface destruction.
MFC after: 2 weeks
show more ...
|
#
fcb3f813 |
| 04-Oct-2022 |
Gleb Smirnoff <glebius@FreeBSD.org> |
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 ...
|
#
f277746e |
| 12-Aug-2022 |
Gleb Smirnoff <glebius@FreeBSD.org> |
protosw: change prototype for pr_control
For some reason protosw.h is used during world complation and userland is not aware of caddr_t, a relic from the first version of C. Broken buildworld is go
protosw: change prototype for pr_control
For some reason protosw.h is used during world complation and userland is not aware of caddr_t, a relic from the first version of C. Broken buildworld is good reason to get rid of yet another caddr_t in kernel.
Fixes: 886fc1e80490fb03e72e306774766cbb2c733ac6
show more ...
|
#
b8103ca7 |
| 11-Aug-2022 |
Gleb Smirnoff <glebius@FreeBSD.org> |
netinet: get interface event notifications directly via EVENTHANDLER(9)
The old mechanism of getting them via domains/protocols control input is a relict from the previous century, when nothing like
netinet: get interface event notifications directly via EVENTHANDLER(9)
The old mechanism of getting them via domains/protocols control input is a relict from the previous century, when nothing like EVENTHANDLER(9) existed yet. Retire PRC_IFDOWN/PRC_IFUP as netinet was the only one to use them.
Reviewed by: melifaro Differential revision: https://reviews.freebsd.org/D36116
show more ...
|
Revision tags: release/13.1.0, release/12.3.0 |
|
#
c8ee75f2 |
| 10-Oct-2021 |
Gleb Smirnoff <glebius@FreeBSD.org> |
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 ...
|
#
2144431c |
| 08-Oct-2021 |
Gleb Smirnoff <glebius@FreeBSD.org> |
Remove in_ifaddr_lock acquisiton to access in_ifaddrhead.
An IPv4 address is embedded into an ifaddr which is freed via epoch. And the in_ifaddrhead is already a CK list. Use the network epoch to pr
Remove in_ifaddr_lock acquisiton to access in_ifaddrhead.
An IPv4 address is embedded into an ifaddr which is freed via epoch. And the in_ifaddrhead is already a CK list. Use the network epoch to protect against use after free.
Next step would be to CK-ify the in_addr hash and get rid of the...
Reviewed by: melifaro Differential Revision: https://reviews.freebsd.org/D32434
show more ...
|
Revision tags: release/13.0.0 |
|
#
f3245be3 |
| 23-Feb-2021 |
Kristof Provost <kp@FreeBSD.org> |
net: remove legacy in_addmulti()
Despite the comment to the contrary neither pf nor carp use in_addmulti(). Nothing does, so get rid of it.
Carp stopped using it in 08b68b0e4c6b132127919cfbaf7275c7
net: remove legacy in_addmulti()
Despite the comment to the contrary neither pf nor carp use in_addmulti(). Nothing does, so get rid of it.
Carp stopped using it in 08b68b0e4c6b132127919cfbaf7275c727ca7843 (2011). It's unclear when pf stopped using it, but before d6d3f01e0a3395c1fae34a3c4be7b051cb2d7581 (2012).
Reviewed by: bz@, melifaro@ Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D28918
show more ...
|
#
130aebba |
| 20-Jan-2021 |
Alexander V. Chernikov <melifaro@FreeBSD.org> |
Further refactor IPv4 interface route creation.
* Fix bug with /32 aliases introduced in 81728a538d24. * Explicitly document business logic for IPv4 ifa routes. * Remove remnants of rtinit() * Dedup
Further refactor IPv4 interface route creation.
* Fix bug with /32 aliases introduced in 81728a538d24. * Explicitly document business logic for IPv4 ifa routes. * Remove remnants of rtinit() * Deduplicate ifa->route prefix code by moving it into ia_getrtprefix() * Deduplicate conditional check for ifa_maintain_loopback_route() by moving into ia_need_loopback_route() * Remove now-unused flags argument from in_addprefix().
Reviewed by: donner PR: 252883 Differential Revision: https://reviews.freebsd.org/D28246
show more ...
|
#
81728a53 |
| 09-Jan-2021 |
Alexander V. Chernikov <melifaro@FreeBSD.org> |
Split rtinit() into multiple functions.
rtinit[1]() is a function used to add or remove interface address prefix routes, similar to ifa_maintain_loopback_route(). It was intended to be family-agno
Split rtinit() into multiple functions.
rtinit[1]() is a function used to add or remove interface address prefix routes, similar to ifa_maintain_loopback_route(). It was intended to be family-agnostic. There is a problem with this approach in reality.
1) IPv6 code does not use it for the ifa routes. There is a separate layer, nd6_prelist_(), providing interface for maintaining interface routes. Its part, responsible for the actual route table interaction, mimics rtenty() code.
2) rtinit tries to combine multiple actions in the same function: constructing proper route attributes and handling iterations over multiple fibs, for the non-zero net.add_addr_allfibs use case. It notably increases the code complexity.
3) dstaddr handling. flags parameter re-uses RTF_ flags. As there is no special flag for p2p connections, host routes and p2p routes are handled in the same way. Additionally, mapping IFA flags to RTF flags makes the interface pretty messy. It make rtinit() to clash with ifa_mainain_loopback_route() for IPV4 interface aliases.
4) rtinit() is the last customer passing non-masked prefixes to rib_action(), complicating rib_action() implementation.
5) rtinit() coupled ifa announce/withdrawal notifications, producing "false positive" ifa messages in certain corner cases.
To address all these points, the following has been done:
* rtinit() has been split into multiple functions: - Route attribute construction were moved to the per-address-family functions, dealing with (2), (3) and (4). - funnction providing net.add_addr_allfibs handling and route rtsock notificaions is the new routing table inteface. - rtsock ifa notificaion has been moved out as well. resulting set of funcion are only responsible for the actual route notifications.
Side effects: * /32 alias does not result in interface routes (/32 route and "host" route) * RTF_PINNED is now set for IPv6 prefixes corresponding to the interface addresses
Differential revision: https://reviews.freebsd.org/D28186
show more ...
|
Revision tags: release/12.2.0 |
|
#
e2515283 |
| 27-Aug-2020 |
Glen Barber <gjb@FreeBSD.org> |
MFH
Sponsored by: Rubicon Communications, LLC (netgate.com)
|
#
de6fc2e3 |
| 15-Aug-2020 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r364082 through r364250.
|
#
2f23f45b |
| 14-Aug-2020 |
Alexander V. Chernikov <melifaro@FreeBSD.org> |
Simplify dom_<rtattach|rtdetach>.
Remove unused arguments from dom_rtattach/dom_rtdetach functions and make them return/accept 'struct rib_head' instead of 'void **'. Declare inet/inet6 implementa
Simplify dom_<rtattach|rtdetach>.
Remove unused arguments from dom_rtattach/dom_rtdetach functions and make them return/accept 'struct rib_head' instead of 'void **'. Declare inet/inet6 implementations in the relevant _var.h headers similar to domifattach / domifdetach. Add rib_subscribe_internal() function to accept subscriptions to the rnh directly.
Differential Revision: https://reviews.freebsd.org/D26053
show more ...
|
#
440cec3f |
| 12-Aug-2020 |
Glen Barber <gjb@FreeBSD.org> |
MFH
Sponsored by: Rubicon Communications, LLC (netgate.com)
|
#
8460d754 |
| 10-Aug-2020 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r364051 through r364081.
|
#
3689652c |
| 10-Aug-2020 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
Make sure the multicast release tasks are properly drained when destroying a VNET or a network interface.
Else the inm release tasks, both IPv4 and IPv6 may cause a panic accessing a freed VNET or n
Make sure the multicast release tasks are properly drained when destroying a VNET or a network interface.
Else the inm release tasks, both IPv4 and IPv6 may cause a panic accessing a freed VNET or network interface.
Reviewed by: jmg@ Discussed with: bz@ Differential Revision: https://reviews.freebsd.org/D24914 MFC after: 1 week Sponsored by: Mellanox Technologies
show more ...
|
Revision tags: release/11.4.0 |
|
#
1b0051ba |
| 28-Apr-2020 |
Alexander V. Chernikov <melifaro@FreeBSD.org> |
Eliminate now-unused parts of old routing KPI.
r360292 switched most of the remaining routing customers to a new KPI, leaving a bunch of wrappers for old routing lookup functions unused.
Remove th
Eliminate now-unused parts of old routing KPI.
r360292 switched most of the remaining routing customers to a new KPI, leaving a bunch of wrappers for old routing lookup functions unused.
Remove them from the tree as a part of routing cleanup.
Differential Revision: https://reviews.freebsd.org/D24569
show more ...
|
#
051669e8 |
| 25-Jan-2020 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r356931 through r357118.
|
#
34a5582c |
| 22-Jan-2020 |
Alexander V. Chernikov <melifaro@FreeBSD.org> |
Bring back redirect route expiration.
Redirect (and temporal) route expiration was broken a while ago. This change brings route expiration back, with unified IPv4/IPv6 handling code.
It introduces
Bring back redirect route expiration.
Redirect (and temporal) route expiration was broken a while ago. This change brings route expiration back, with unified IPv4/IPv6 handling code.
It introduces net.inet.icmp.redirtimeout sysctl, allowing to set an expiration time for redirected routes. It defaults to 10 minutes, analogues with net.inet6.icmp6.redirtimeout.
Implementation uses separate file, route_temporal.c, as route.c is already bloated with tons of different functions. Internally, expiration is implemented as an per-rnh callout scheduled when route with non-zero rt_expire time is added or rt_expire is changed. It does not add any overhead when no temporal routes are present.
Callout traverses entire routing tree under wlock, scheduling expired routes for deletion and calculating the next time it needs to be run. The rationale for such implemention is the following: typically workloads requiring large amount of routes have redirects turned off already, while the systems with small amount of routes will not inhibit large overhead during tree traversal.
This changes also fixes netstat -rn display of route expiration time, which has been broken since the conversion from kread() to sysctl.
Reviewed by: bz MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D23075
show more ...
|
Revision tags: release/12.1.0 |
|
#
8b3bc70a |
| 08-Oct-2019 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r352764 through r353315.
|
#
b8a6e03f |
| 08-Oct-2019 |
Gleb Smirnoff <glebius@FreeBSD.org> |
Widen NET_EPOCH coverage.
When epoch(9) was introduced to network stack, it was basically dropped in place of existing locking, which was mutexes and rwlocks. For the sake of performance mutex cover
Widen NET_EPOCH coverage.
When epoch(9) was introduced to network stack, it was basically dropped in place of existing locking, which was mutexes and rwlocks. For the sake of performance mutex covered areas were as small as possible, so became epoch covered areas.
However, epoch doesn't introduce any contention, it just delays memory reclaim. So, there is no point to minimise epoch covered areas in sense of performance. Meanwhile entering/exiting epoch also has non-zero CPU usage, so doing this less often is a win.
Not the least is also code maintainability. In the new paradigm we can assume that at any stage of processing a packet, we are inside network epoch. This makes coding both input and output path way easier.
On output path we already enter epoch quite early - in the ip_output(), in the ip6_output().
This patch does the same for the input path. All ISR processing, network related callouts, other ways of packet injection to the network stack shall be performed in net_epoch. Any leaf function that walks network configuration now asserts epoch.
Tricky part is configuration code paths - ioctls, sysctls. They also call into leaf functions, so some need to be changed.
This patch would introduce more epoch recursions (see EPOCH_TRACE) than we had before. They will be cleaned up separately, as several of them aren't trivial. Note, that unlike a lock recursion the epoch recursion is safe and just wastes a bit of resources.
Reviewed by: gallatin, hselasky, cy, adrian, kristof Differential Revision: https://reviews.freebsd.org/D19111
show more ...
|