Following this tweet:
https://twitter.com/_mcbride/status/733766997343883264

I thought I would add the nsa option to ifconfig:

port:fred ~/code/c/stuff/ifconfig> doas ./ifconfig iwn0 lladdr nsa

which results in:

port:fred ~/code/c/stuff/ifconfig> ifconfig iwn0
iwn0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
        lladdr 00:20:91:9d:48:06
        index 2 priority 4
        groups: wlan
        media: IEEE802.11 autoselect
        status: no network
        ieee80211: nwid ""

The following patch updates ifconfig.c and ifconfig.8 to add the nsa option :~)

Enjoy

Fred

--- /usr/src/sbin/ifconfig/ifconfig.c   Mon May  9 23:03:20 2016
+++ ./ifconfig.c        Sun May 22 11:04:30 2016
@@ -5189,7 +5189,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;
--- /usr/src/sbin/ifconfig/ifconfig.8   Mon May  9 23:03:20 2016
+++ ./ifconfig.8        Sun May 22 11:01:14 2016
@@ -323,10 +323,11 @@ of this is to select the connector type for some Ether
 Refer to the man page for the specific driver for more information.
 .It Fl 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, or can
-be chosen randomly.
+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.
 .It Cm media Op Ar type
 Set the media type of the interface to
 .Ar type .

Reply via email to