Page MenuHomeFreeBSD

netinet*: remove PRC_ constants and streamline ICMP processing
AbandonedPublic

Authored by glebius on Sep 26 2022, 7:03 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Apr 19, 12:47 AM
Unknown Object (File)
Mar 14 2024, 6:14 AM
Unknown Object (File)
Mar 14 2024, 6:14 AM
Unknown Object (File)
Mar 14 2024, 6:14 AM
Unknown Object (File)
Mar 10 2024, 10:29 PM
Unknown Object (File)
Feb 8 2024, 2:43 PM
Unknown Object (File)
Jan 7 2024, 7:00 AM
Unknown Object (File)
Jan 6 2024, 7:34 AM
Subscribers

Details

Summary

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.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 47560
Build 44447: arc lint + arc unit

Event Timeline

Shrink TCP code a bit. Mostly trust generic icmp_errmap() with a few
exclusions.