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)
Wed, Oct 30, 6:30 AM
Unknown Object (File)
Wed, Oct 30, 6:29 AM
Unknown Object (File)
Wed, Oct 30, 6:05 AM
Unknown Object (File)
Mon, Oct 28, 3:05 AM
Unknown Object (File)
Thu, Oct 17, 5:59 PM
Unknown Object (File)
Thu, Oct 17, 5:27 PM
Unknown Object (File)
Oct 3 2024, 4:14 PM
Unknown Object (File)
Oct 3 2024, 11:58 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 47550
Build 44437: arc lint + arc unit

Event Timeline

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