• Thomas Haller's avatar
    device: add "dhcp-plugin" match spec for device · b9eb264e
    Thomas Haller authored
    The need for this is the following:
    
    "ipv4.dhcp-client-id" can be specified via global connection defaults.
    In absence of any configuration in NetworkManager, the default depends
    on the DHCP client plugin. In case of "dhclient", the default further
    depends on /etc/dhcp.
    
    For "internal" plugin, we may very well want to change the default
    client-id to "mac" by universally installing a configuration
    snippet
    
        [connection-use-mac-client-id]
        ipv4.dhcp-client-id=mac
    
    However, if we the user happens to enable "dhclient" plugin, this also
    forces the client-id and overrules configuration from /etc/dhcp. The real
    problem is, that dhclient can be configured via means outside of NetworkManager,
    so our defaults shall not overwrite defaults from /etc/dhcp.
    
    With the new device spec, we can avoid this issue:
    
        [connection-dhcp-client-id]
        match-device=except:dhcp-plugin:dhclient
        ipv4.dhcp-client-id=mac
    
    This will be part of the solution for rh#1640494. Note that merely
    dropping a configuration snippet is not yet enough. More fixes for
    DHCP will follow. Also, bug rh#1640494 may have alternative solutions
    as well. The nice part of this new feature is that it is generally
    useful for configuring connection defaults and not specifically for
    the client-id issue.
    
    Note that this match spec is per-device, although the plugin is selected
    globally. That makes some sense, because in the future we may or may not
    configure the DHCP plugin per-device or per address family.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1640494
    b9eb264e
nm-dhcp-manager.h 4.67 KB