Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kernel/Net: Minimal amount of IPv6 for ping replies #25009

Merged
merged 9 commits into from
Oct 4, 2024

Commits on Oct 3, 2024

  1. Kernel/Net: Rename "IPv4Protocol" to "TransportProtocol"

    This enum is neither IPv4-specific, nor does it
    have to do anything with the network layer, as the
    name may imply. The enum is moved to a new header
    containing common IPv4/IPv6 definitions.
    kleinesfilmroellchen authored and sdomi committed Oct 3, 2024
    Configuration menu
    Copy the full SHA
    073ef37 View commit details
    Browse the repository at this point in the history

Commits on Oct 4, 2024

  1. Kernel/Net: Rename IPv4 directory to IP

    Commit ad73ade needlessly introduced an IPv4 directory.
    If we were to keep it, sharing common headers between IPv4 and IPv6
    would be much messier, and may potentially increase code duplication.
    
    This change renames the IPv4 directory to IP to aid with later IPv6
    porting efforts.
    sdomi authored and timschumi committed Oct 4, 2024
    Configuration menu
    Copy the full SHA
    e838e3c View commit details
    Browse the repository at this point in the history
  2. Kernel/Net: Move internet_checksum to a more general file

    Up until now, the internet_checksum function lived in IPv4.h. Due to
    its use in IPv6, a better place for it nowadays would be in IP.h.
    
    Due to how it gets used in IPv6 scenarios, it makes sense to extend it
    to run over multiple smaller structs instead of one big continous chunk
    of memory. This change converts internet_checksum into a class with
    methods "add" and "finish", which process data and return the final
    result, respectively.
    
    This commit also fixes proper hash computation for payloads that have
    an odd length. Furthermore, the function was refactored to use
    a ReadonlyBytes object instead of separate data and size.
    
    Co-Authored-By: Wanda <[email protected]>
    2 people authored and timschumi committed Oct 4, 2024
    Configuration menu
    Copy the full SHA
    773e728 View commit details
    Browse the repository at this point in the history
  3. Kernel/Net: Directly pass adapter to protocol handler calls

    Up until now, protocol handlers for IPv4 and ARP had to rediscover the
    adapter based on trying to match the address to all interfaces. This
    approach is relatively slow, introduces more code duplication, and
    doesn't work with multiple IPs per interface (as is the case with
    IPv6).
    
    This change introduces directly passing the adapter to all handlers
    that need it, cutting out the retrieval process. Furthermore, we
    discard the packet much faster if the IP doesn't match.
    sdomi authored and timschumi committed Oct 4, 2024
    Configuration menu
    Copy the full SHA
    dfc074d View commit details
    Browse the repository at this point in the history
  4. Kernel/Net: Start work on IPv6

    This commit introduces the first bit of IPv6 support into
    SerenityOS. An IPv6 packet header structure allows NetworkTask to
    recognize and log correctly shaped IPv6 packets, but nothing is done
    with those yet. A new logging flag, IPV6_DEBUG, allows debugging of
    IPv6 internals.
    
    Co-Authored-By: sdomi <[email protected]>
    2 people authored and timschumi committed Oct 4, 2024
    Configuration menu
    Copy the full SHA
    f2414e5 View commit details
    Browse the repository at this point in the history
  5. Kernel/Net: Add support functions for filling out IPv6 packets

    This change also migrates the existing fill_in_ipv4_header from C-style
    casts to proper C++ casts.
    sdomi authored and timschumi committed Oct 4, 2024
    Configuration menu
    Copy the full SHA
    6788578 View commit details
    Browse the repository at this point in the history
  6. Net/Kernel: Add basic ICMPv6 support

    This commit adds the minimum amount of code to make Serenity reply to
    ICMPv6 ping packets. This includes basic Network Discovery Protocol
    support, as well as a basic ICMPv6 Echo Request/Response handler.
    
    This change also introduces a new debug flag, ICMPV6_DEBUG.
    
    Co-Authored-By: kleines Filmröllchen <[email protected]>
    2 people authored and timschumi committed Oct 4, 2024
    Configuration menu
    Copy the full SHA
    9028fee View commit details
    Browse the repository at this point in the history
  7. Kernel/Net: Remove useless checks from handle_arp

    According to ARP.h, address lengths default to size of their
    underlying types (IPv4Address and MACAddress respectively). We never
    modify those values, and in reality, ARP never carries anything else.
    Hence, those checks resolved to comparing sizeof to itself, which
    probably gets optimized out of the compiler anyways.
    
    This change removes the checks that will never fail, plus changes the
    function definition to pass adapter directly, matching other handlers.
    sdomi authored and timschumi committed Oct 4, 2024
    Configuration menu
    Copy the full SHA
    81931d1 View commit details
    Browse the repository at this point in the history
  8. Kernel/Net: Introduce proper pointers for payload calls

    Unifying with other structures, this introduces m_payload for all
    relevant structures, except the TCP header (which has a different
    concept of payload than the rest).
    
    This allows us to return a pointer directly instead of doing pointer
    arithmetic to point to the end of the structure.
    sdomi authored and timschumi committed Oct 4, 2024
    Configuration menu
    Copy the full SHA
    314d768 View commit details
    Browse the repository at this point in the history