Project

General

Profile

Actions

Bug #13759

open

dladm create-simnet should allow mac-address to be provided

Added by William Welliver over 2 years ago. Updated over 2 years ago.

Status:
In Progress
Priority:
Normal
Category:
networking
Start date:
Due date:
% Done:

0%

Estimated time:
Difficulty:
Bite-size
Tags:
Gerrit CR:
External Bug:

Description

Currently, creating a new simnet device results in the device being assigned a random MAC address. It would be helpful if we could optionally specify what MAC address to use.

Actions #1

Updated by Electric Monk over 2 years ago

  • Gerrit CR set to 1480
Actions #2

Updated by William Welliver over 2 years ago

Testing notes:

- originally developed and tested on SmartOS.
- illumos-gate compiles cleanly with this change applied.
- applied change to illumos-omnios and built dladm and libdladm
- tested various command argument combinations (see below for examples)
- verified that outbound packets use specified address using snoop (not included for brevity)

# verify existing behavior works
dladm create-simnet -t simnet0
dladm create-simnet simnet1
dladm show-simnet
LINK        MEDIA               MACADDRESS        OTHERLINK
simnet0     Ethernet            22:cf:92:21:81:c3 --
simnet1     Ethernet            32:d3:61:97:2d:9e --

cat /etc/dladm/datalink.conf
... cut ...
# Use the dladm(1m) command to change the contents of this file.

simnet1 class=int,32;media=int,4;macaddr=string,32:d3:61:97:2d:9e;simnettype=int,4;maddrlen=int,6;

dladm delete-simnet simnet0
dladm delete-simnet simnet1
dladm show-simnet

# specify a mac address
dladm create-simnet -t -u 56:b4:40:7e:f4:1d simnet0
dladm create-simnet -u 22:3f:82:f7:94:9f simnet1
dladm show-simnet
LINK        MEDIA               MACADDRESS        OTHERLINK
simnet0     Ethernet            56:b4:40:7e:f4:1d --
simnet1     Ethernet            22:3f:82:f7:94:9f --

cat /etc/dladm/datalink.conf
... cut ...
# Use the dladm(1m) command to change the contents of this file.

simnet1 class=int,32;media=int,4;macaddr=string,22:3f:82:f7:94:9f;simnettype=int,4;maddrlen=int,6;

dladm delete-simnet simnet0
dladm delete-simnet simnet1

# specify various forms of bad address
# Globally unique
dladm create-simnet -u 00:00:00:fa:05:e4 simnet0
dladm: simnet creation failed: invalid MAC address value

# Global / Multicast
dladm create-simnet -u 01:00:00:f1:32:a9 simnet0
dladm: simnet creation failed: invalid MAC address value

# Local / Multicast
dladm create-simnet -u 5f:f6:fe:f3:a7:c3 simnet0
dladm: simnet creation failed: invalid MAC address value

# Too long
dladm create-simnet -u  22:3f:82:f7:94:9f:01 simnet0
dladm: simnet creation failed: invalid MAC address length
# Too short
dladm create-simnet -u 22:3f:82:f7 simnet0
dladm: simnet creation failed: invalid MAC address length

# Bad format
dladm create-simnet -u 5f-f6-fe-f3-a7-c3 simnet0
dladm: simnet creation failed: invalid MAC address value

# Bad characters
dladm create-simnet -u  22:3f:82:f7:94:xx simnet0
dladm: simnet creation failed: invalid MAC address value

dladm show-simnet
LINK        MEDIA               MACADDRESS        OTHERLINK

cat /etc/dladm/datalink.conf
... cut ...
# Use the dladm(1m) command to change the contents of this file.

Actions #3

Updated by William Welliver over 2 years ago

Some analysis of command line options:

-u mac-address is used by create-aggr for specifying the unicast address to assign to the interface
-m would be a natural choice and is used by create-vnc

however...

in create-simnet:

-m specifies the media type
-t is used across dladm (and others such as ipadm) to denote a command with temporary effect
-T is used for various purposes (such as tunnel type) across dladm
-M doesn't seem to be used anywhere in dladm

Some thoughts:

If -u isn't the preferred option, -m (media type) /could/ be moved to -T, freeing up -m in create-simnet. Not sure if the pleasantness of having -m available outweighs the potential for confusion caused by changing the options. It's not a "committed" interface but what little material exists for documenting this feature would then be made incorrect and we'd also be in conflict with Oracle Solaris.

Actions

Also available in: Atom PDF