[NEW PORT] sysutils/ethname: boot-time (re)naming of ethernet devices by MAC

An rc-script for pinning an ethernet network name to a MAC address.

--

This isn't typically needed on PCIe systems, but for systems with multiple
USB ethernet (ue) devices, which seem to like to come up in
non-deterministic order, it is very helpful; doubly so when the system in
question is a router / firewall where the network config and security
concerns vary wildly from one device to the next.

It could also be of use for traditional NICs (PCIe) when adding a new card
to a system, for example, and ensuring that the existing, previously
configured device sticks to the MAC address, and not having to worry about
which ends up /dev/xxxN vs /dev/xxxM.

The script inserts itself before netif, waits an adjustable delay for the
expected devices to appear, and then renames them as requested by the user.
All of the device configuration, pf, etc., can be written with the new
names. It does not attempt to automatically handle devices added after boot.

--

Usage is described in the script, but effectively:

$ cat /etc/rc.conf
ethname_enable="YES"
ethname_foo0_mac="aa:bb:cc:dd:ee:00"
ethname_bar_mac="aa:bb:cc:dd:ee:01"

# Optionally, otherwise it'll just enumerate all ethname_*_mac vars:
ethname_names="foo0 bar"

PR:		212480
Submitted by:	eborisch gmail com
This commit is contained in:
Kyle Evans 2020-11-07 05:24:06 +00:00
parent 9bb47f5385
commit e3cb88ba87
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=554342
4 changed files with 29 additions and 0 deletions

View File

@ -312,6 +312,7 @@
SUBDIR += etc_os-release
SUBDIR += etcmerge
SUBDIR += etcupdate
SUBDIR += ethname
SUBDIR += evhz
SUBDIR += evisum
SUBDIR += evtviewer

22
sysutils/ethname/Makefile Normal file
View File

@ -0,0 +1,22 @@
# $FreeBSD$
PORTNAME= ethname
PORTVERSION= 2.0.1
DISTVERSIONPREFIX= v
CATEGORIES= sysutils
MAINTAINER= eborisch@gmail.com
COMMENT= MAC-based network name pinning
LICENSE= MIT
USE_GITHUB= yes
GH_ACCOUNT= eborisch
NO_ARCH= yes
NO_BUILD= yes
PLIST_FILES= etc/rc.d/ethname \
share/ethname/README.md
.include <bsd.port.mk>

View File

@ -0,0 +1,3 @@
TIMESTAMP = 1583781876
SHA256 (eborisch-ethname-v2.0.1_GH0.tar.gz) = 2a074b530d042843ff5234405f039a5b65d60f33276aa811fcb4f04a01f75737
SIZE (eborisch-ethname-v2.0.1_GH0.tar.gz) = 4488

View File

@ -0,0 +1,3 @@
An rc-script for pinning an ethernet network name to a MAC address.
WWW: https://github.com/eborisch/ethname