10001 creating duplicate vnics is possible, and breaks dladm

Review Request #1482 — Created Feb. 17, 2019 and updated

citrus
illumos-gate
master
10001
848fe14...
general
10001 creating duplicate vnics is possible, and breaks dladm

See ticket

  • 0
  • 0
  • 1
  • 0
  • 1
Description From Last Updated
tsoome
  1. 
      
  2. usr/src/cmd/dlmgmtd/Makefile (Diff revision 1)
     
     

    Do we need lint mode?

    1. Old habits :) Fixed.

  3. 
      
citrus
andy_js
  1. Ship It!
  2. 
      
cneira
  1. 
      
  2. 
      
ptribble
  1. I don't think this is enough.

    You need to prevent duplicate vnics being created; having duplicate names is going to cause trouble in multiple areas - the current case is merely one particular symptom.

    Also, leaving the zone in a down state doesn't really help - there's no indication as to what the problem is, how to fix it, or even if it's possible to fix it.

    1. having duplicate names is going to cause trouble in multiple areas

      Do you have any examples? I don't believe this is true.

      There's nothing intrinsic to the system that means that VNIC names need to be globally unique, they just need to be unique within a zone. SmartOS uses duplicate VNICs widely (each zone has a net0 interface for example) and I have a branch in OmniOS where I'm experimenting with that for a possible future update; it's working well.

      The specific bug that I'm fixing here is that if moving a VNIC to a zone results in a name collision, then dlmgmtd crashes and will not restart, resulting in a system where links cannot be managed.

      Also, leaving the zone in a down state doesn't really help - there's no indication as to what the problem is, how to fix it, or even if it's possible to fix it.

      Well, there's this:

      bloody# zoneadm -z test halt
      zone 'test': datalinks remain in zone after shutdown
      zone 'test': unable to unconfigure network interfaces in zone
      zone 'test': unable to destroy zone
      

      more could be printed (or syslogged) in the case that the link move returns EEXIST I suppose.

    2. Persistent datalinks have to be unique within a zone. But that's exactly
      the situation here.
      
      Imagine the following scenarios
      
      create vnic with name vnic0
      create zone using vnic0
      create new vnic with name vnic0
      delete vnic0
      reboot
      
      and the zone won't come up because the vnic has actually gone
      
      create vnic with name vnic0
      create zone using vnic0
      create new vnic with name vnic0 over different interface
      reboot
      
      and the zone will boot attached to the new interface rather than the
      old one
      
      The point is that datalink.conf (which is where persistent
      configuration is stored) assumes that the link name is unique. If you
      create a duplicate, it deletes the old entry and replaces it with the
      new one; if you delete it, then there will be no persistent entry.
      
      
      The dlmgmtd service can be cleared, but may well come up in a different
      configuration due to the above.
    3. Links can be created with -t to stop them being written to the persistent store, which is what SmartOS and my branch do, but you have convinced me. I've added a patch that prevents the creation of any link with a duplicate name.

      bloody% dladm show-vnic
      bloody% pfzsh
      bloody# dladm create-vnic -l vioif0 test0
      bloody# dladm show-vnic
      LINK         OVER       SPEED MACADDRESS        MACADDRTYPE VID  ZONE
      test0        vioif0     1000  2:8:20:7d:48:2    random      0    --
      bloody# dladm create-vnic -l vioif0 test0
      dladm: vnic creation over vioif0 failed: object already exists
      bloody# zoneadm -z test boot
      bloody# dladm show-vnic
      LINK         OVER       SPEED MACADDRESS        MACADDRTYPE VID  ZONE
      test0        vioif0     1000  2:8:20:7d:48:2    random      0    test
      bloody# dladm create-vnic -l vioif0 test0
      dladm: vnic creation over vioif0 failed: object already exists
      
  2. 
      
citrus
Review request changed

Change Summary:

Prevent the creation of links with duplicate names.

Commit:

-da319bcd71d3a64b0dc6f51436e743533c90ffc5
+848fe143fdf5746bbb434abcbfdec2f79dffe09a

Diff:

Revision 3 (+23 -6)

Show changes

ptribble
  1. Ship It!
  2. 
      
Loading...