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

netplan status --diff fixes and improvements #466

Merged
merged 10 commits into from
Jun 26, 2024

Commits on Jun 12, 2024

  1. Configuration menu
    Copy the full SHA
    c77f93c View commit details
    Browse the repository at this point in the history
  2. state_diff: add gateway(4|6) to the routes list

    The (deprecated but still available) properties gateway4 and gateway6
    were not being taken into account when comparing routes. Because of
    that, the diff report will show the default route as missing in netplan.
    
    There is a complication when considering gateway4 and gateway6 though:
    both networkd and NM will set a metric for them. As these properties
    cannot set metrics, these routes would still be shown in the diff
    report.
    
    To avoid this noise, when gateway4 and/or gateway6 are used AND the
    system contains one, and only one, default route per protocol family, we
    adopt the same metric and route table from the existing routes. By doing
    this, the comparison will see that both routes, from the system and from
    netplan, are the same and not show them as a diff.
    daniloegea committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    b1d9a89 View commit details
    Browse the repository at this point in the history
  3. state: use the 'dynamic' field from addr_info

    When available, use the flag "dynamic" from addr_info to check if the IP
    addresses was dynamically assigned.
    
    The flag will be displayed in the status output along other flags:
    
     Addresses: 10.86.126.222/24 (dynamic, dhcp)
    daniloegea committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    b774fff View commit details
    Browse the repository at this point in the history
  4. state: add the 'ra' flag to IPv6 addresses

    There are cases where IPv6 addresses received via RA are not set as
    'dynamic'. In these cases, use the information about routes to find
    these IPs and add the tag 'ra' to them.
    
    It's done by iterating through IPv6 addresses and checking if there is
    any addresses in the same network as routes received via RA.
    daniloegea committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    39476f0 View commit details
    Browse the repository at this point in the history
  5. api: add a getter for accept-ra

    Add the Python binding and unit test.
    
    NOTE
    
    accept_ra is not perfectly mapped from the netdef structure to the
    YAML setting and back to the renderer. It's a boolean value in the YAML
    but it maps to three different values inside libnetplan: kernel, enabled
    and disabled.
    
    Not setting it in the YAML means it will not be set in
    networkd. Although, networkd will disable it unconditionally in
    the kernel and will itself handle RAs, meaning that when unset, it's
    enabled by default (with a few exceptions, see systemd.network(5)).
    
    Because of that, the low level C API will return the actual internal
    value of the property and not only TRUE or FALSE. The Python code will
    return True, False or None (when it's unset). This will help the
    consumers to differentiate the case where it's disabled or unset.
    daniloegea committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    c342a93 View commit details
    Browse the repository at this point in the history
  6. state_diff: improve analysis of RA/LL addresses

    When IPv6 link-local and RA (which depends on link-local) are enabled,
    the system will receive IP addresses, nameservers and routes dynamically
    via RA. These addresses are not obviously identified as dynamic in the
    system. networkd probably does have this information but it's not fully
    exposed apparently.
    
    Here I try to improve the comparison of these addresses by checking if
    they are 1) a link-local address and 2) part of the same network as the
    route received via RA.
    
    Without this, status --diff will show the RA IP addresses and link-local
    DNS nameserver as a diff.
    daniloegea committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    8f8b74e View commit details
    Browse the repository at this point in the history
  7. cli/status: fix plain print with --diff

    The logic to remove tags from the output wasn't working for the
    interface header in diff mode.
    daniloegea committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    0f7d3d0 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    762b73e View commit details
    Browse the repository at this point in the history

Commits on Jun 18, 2024

  1. state: make use of networkd ConfigSource

    When networkd is used, the ConfigSource property can identify the source
    of the configuration so let's use it to be more precise and reduce the
    guessing.
    
    We consume the same information when Network Manager is the renderer but
    in this case networkd will not know the sources so this property can't
    be relied on.
    
    For now, we collect the sources for IP addresses and DNS. Routes can be
    included in the future. We also should create abstractions for each
    configuration so we don't need to keep information such as the data
    source in separate tables.
    
    Network Manager seems to expose the source through its DBus API. This
    also could be considered in the future.
    daniloegea committed Jun 18, 2024
    Configuration menu
    Copy the full SHA
    ca8a0d5 View commit details
    Browse the repository at this point in the history

Commits on Jun 26, 2024

  1. Configuration menu
    Copy the full SHA
    692f902 View commit details
    Browse the repository at this point in the history