Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.

host lookup simplifications and refactorings #2

Merged
merged 7 commits into from
Nov 14, 2022
Merged

Commits on Nov 11, 2022

  1. Remove useless lambda and lambda call in serialize_host

    We don't have to use a lambda to return a value from a
    sub-expression. Rust takes the last value in a scope as return value
    even if it isn't a function.
    andir authored and flokli committed Nov 11, 2022
    Configuration menu
    Copy the full SHA
    164f831 View commit details
    Browse the repository at this point in the history
  2. Move the host serialize code to a associated function

    The function belongs to the data format and not to the actual
    processing logic. This isn't a clean cut just yet all over the
    codebase but moving this very fragile piece into its own function will
    enable us to test it in isolation.
    andir authored and flokli committed Nov 11, 2022
    Configuration menu
    Copy the full SHA
    56a0a21 View commit details
    Browse the repository at this point in the history
  3. Make the GETHOSTBYNAMEv6 handling similar to the v4 equivalent

    This makes the result filtering similar and thus should be less confusing.
    andir authored and flokli committed Nov 11, 2022
    Configuration menu
    Copy the full SHA
    d9f3bb1 View commit details
    Browse the repository at this point in the history
  4. Use as_slice().to_vec() instead of manually pre-allocated buffers

    This is as efficient as doing the manual pre-allocation as the
    `to_vec` method will use the length of the slice for the initial size
    allocation of the vector.
    andir authored and flokli committed Nov 11, 2022
    Configuration menu
    Copy the full SHA
    b2f73c7 View commit details
    Browse the repository at this point in the history
  5. Make Host::serialize able to serialize empty address lists

    Previously this would produce a malformed packet as far as glibc is
    concerned.
    
    If there are no addresses the "found" field should not be one and the
    other lookup fields can also be left blank.
    andir authored and flokli committed Nov 11, 2022
    Configuration menu
    Copy the full SHA
    5c2f843 View commit details
    Browse the repository at this point in the history
  6. Move common HostResponseHeader to const structs

    This moves the "well-known" wire format structs to constants that can
    be reused without having to duplicate their definition all the time.
    andir authored and flokli committed Nov 11, 2022
    Configuration menu
    Copy the full SHA
    092cab9 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    5832ab3 View commit details
    Browse the repository at this point in the history