Project

General

Profile

Actions

Bug #7464

open

crossbow allows to create a vnic with existing name

Added by Denis Kozadaev about 5 years ago. Updated almost 5 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Start date:
2016-10-10
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:

Description

How to reproduce:
create an etherstub:

dladm create-etherstub hostswitch0

create a vnic for it:
dladm create-vnic -l sw0 vn2

now test that dladm does not allow to create another vnic with the same name:
service# dladm create-vnic -l sw0 vn2
dladm: vnic creation over sw0 failed: object already exists

assing the new vnic to a zone and boot it
service# cat /etc/zones/zhost02.xml 
<?xml version="1.0"?>
<!DOCTYPE zone PUBLIC "-//Sun Microsystems Inc//DTD Zones//EN" "file:///usr/share/lib/xml/dtd/zonecfg.dtd.1">
<!--
    DO NOT EDIT THIS FILE.  Use zonecfg(1M) instead.
-->
<zone name="zhost02" zonepath="/zones/zhost02" autoboot="false" brand="ipkg" limitpriv="default" scheduling-class="FSS" ip-type="exclusive">
  <network physical="vn2"/>
  <filesystem special="/hosting/zhost02" directory="/hosting" type="lofs"/>
</zone>
service# zoneadm -z zhost02 boot
service# zoneadm list -iv
  ID NAME             STATUS     PATH                           BRAND    IP    
   0 global           running    /                              ipkg     shared
   1 zhoster01        running    /zones/zhoster01               ipkg     excl  
   4 zhost02          running    /zones/zhost02                 ipkg     excl  

The zone is running, now let create anothe vnic with the same name:
service# dladm create-vnic -l sw0 vn2
service# echo $?
0

Wow! It is created successfully (why? that is the qestion...)
But let see at the output:
service# dladm show-vnic
LINK         OVER         SPEED  MACADDRESS        MACADDRTYPE         VID
vn2          sw0          0      2:8:20:62:94:da   random              0
vn2          sw0          0      2:8:20:20:79:9d   random              0

Now let destroy it:
service# dladm delete-vnic vn2;echo $?
0
service# dladm show-vnic              
LINK         OVER         SPEED  MACADDRESS        MACADDRTYPE         VID
vn0          sw0          0      2:8:20:f:62:a6    random              0
vn2          sw0          0      2:8:20:62:94:da   random              0

Well, done...
Now we stop the zone and try to create vnic once again:
service# zoneadm -z zhost02 halt
service# dladm create-vnic -l sw0 vn2;echo $?
dladm: vnic creation over sw0 failed: object already exists
1

and it works correctly.
I tried to debug dladm in gdb step by step, the problem is
dladm_door_call() from libdlmgmt.c returns DLADM_STATUS_OK
instead of DLADM_STATUS_EXIST in line 73: door_call(door_fd, &darg)
http://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libdladm/common/libdlmgmt.c#73
by the way, the system is OI, it tested on two hosts.


Related issues

Related to illumos gate - Bug #10001: creating duplicate vnics is possible, and breaks dladmIn ProgressAndy Fiddaman2018-11-21

Actions
Actions

Also available in: Atom PDF