fcbsd

*BSD bod

  • he/him

OpenBSD on the Desktop,
since 2001

Glasgow


I posted a patch to misc@ as a result of this tweet to add the OUI for NSA as a random MAC address for an interface.


the ifconfig.c patch applied cleanly without change but I had to manually apply the ifconfig.8 patch. The update patch is shown in the attached image and is below:

Index: ifconfig.c
===================================================================
RCS file: /cvs/src/sbin/ifconfig/ifconfig.c,v
diff -u -p -r1.473 ifconfig.c
--- ifconfig.c	9 Jun 2024 16:25:27 -0000	1.473
+++ ifconfig.c	14 Jun 2024 22:09:49 -0000
@@ -6729,7 +6729,14 @@ setiflladdr(const char *addr, int param)
 {
 	struct ether_addr *eap, eabuf;
 
-	if (!strcmp(addr, "random")) {
+	if (!strcmp(addr, "nsa")) {
+		arc4random_buf(&eabuf, sizeof eabuf);
+		/* NSA hardware address */
+		eabuf.ether_addr_octet[0] = 0x00;
+		eabuf.ether_addr_octet[1] = 0x20;
+		eabuf.ether_addr_octet[2] = 0x91;
+		eap = &eabuf;
+	} else if (!strcmp(addr, "random")) {
 		arc4random_buf(&eabuf, sizeof eabuf);
 		/* Non-multicast and claim it is a hardware address */
 		eabuf.ether_addr_octet[0] &= 0xfc;
Index: ifconfig.8 
===================================================================
RCS file: /cvs/src/sbin/ifconfig/ifconfig.8,v
diff -u -p -r1.400 ifconfig.8
--- ifconfig.8	9 Jun 2024 16:25:27 -0000	1.400
+++ ifconfig.8	14 Jun 2024 22:09:50 -0000
@@ -335,7 +335,11 @@ of this is to select the connector type 
 Refer to the man page for the specific driver for more information.
 .It Cm -link[0-2]
 Disable special processing at the link level with the specified interface.
-.It Cm lladdr Ar etheraddr Ns | Ns Cm random
+.It Cm lladdr Ar etheraddr Ns | Ns Cm random | Ns Cm nsa
+ Change the link layer address (MAC address) of the interface.
+This should be specified as six colon-separated hex values, can
+be chosen randomly, or first three octets of 00:20:91 and random
+last three octets.
 Change the link layer address (MAC address) of the interface.
 This should be specified as six colon-separated hex values, or can
 be chosen randomly.

You must log in to comment.