Skip to content
  • Thomas Haller's avatar
    cli: fail `nmcli connection up $PROFILE ifname $DEVICE` for non-existing virtual device · d0349f17
    Thomas Haller authored
      $ nmcli connection add type dummy con-name x autoconnect no ipv4.method disabled ipv6.method disabled ifname d0
      $ mcli connection up x ifname bogus
      Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/12)
    
    This is not right. A non-existing ifname argument was simply ignored
    and nmcli would tell NetworkManager to activate the profile (on any
    device).
    
    Instead, if the user specifies a device argument, also for a virtual
    type, it must exist.
    
    Note that usually for virtual devices (like 'dummy'), the device
    in fact does not exist, so passing `ifname` is likely to fail.
    If the device already exists, then the command is no going to work
    as expected, with
    
      $ mcli connection up x ifname d0
    
    succeeding, while
    
      $ mcli connection up x ifname d1
    
    fails (as intended) with
    
      Error: device 'd1' not compatible with connection 'x': The interface names of the device and the connection didn't match..
    d0349f17