Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F103015810
D7615.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D7615.id.diff
View Options
Index: sbin/ifconfig/af_link.c
===================================================================
--- sbin/ifconfig/af_link.c
+++ sbin/ifconfig/af_link.c
@@ -90,13 +90,23 @@
if (which != ADDR)
errx(1, "can't set link-level netmask or broadcast");
- if ((temp = malloc(strlen(addr) + 2)) == NULL)
- errx(1, "malloc failed");
- temp[0] = ':';
- strcpy(temp + 1, addr);
- sdl.sdl_len = sizeof(sdl);
- link_addr(temp, &sdl);
- free(temp);
+ if (!strcmp(addr, "random")) {
+ sdl.sdl_len = sizeof(sdl);
+ sdl.sdl_alen = ETHER_ADDR_LEN;
+ sdl.sdl_nlen = 0;
+ sdl.sdl_family = AF_LINK;
+ arc4random_buf(&sdl.sdl_data, ETHER_ADDR_LEN);
+ /* Non-multicast and claim it is a hardware address */
+ sdl.sdl_data[0] &= 0xfc;
+ } else {
+ if ((temp = malloc(strlen(addr) + 2)) == NULL)
+ errx(1, "malloc failed");
+ temp[0] = ':';
+ strcpy(temp + 1, addr);
+ sdl.sdl_len = sizeof(sdl);
+ link_addr(temp, &sdl);
+ free(temp);
+ }
if (sdl.sdl_alen > sizeof(sa->sa_data))
errx(1, "malformed link-level address");
sa->sa_family = AF_LINK;
Index: sbin/ifconfig/ifconfig.8
===================================================================
--- sbin/ifconfig/ifconfig.8
+++ sbin/ifconfig/ifconfig.8
@@ -28,7 +28,7 @@
.\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94
.\" $FreeBSD$
.\"
-.Dd June 8, 2016
+.Dd August 24, 2016
.Dt IFCONFIG 8
.Os
.Sh NAME
@@ -145,6 +145,12 @@
This can be used to, for example,
set a new MAC address on an Ethernet interface, though the
mechanism used is not Ethernet specific.
+Use the
+.Pq Dq random
+keyword to set a randomly generated MAC address.
+A randomly-generated MAC address might be the same as one already in use
+in the network.
+Such duplications are extremely unlikely.
If the interface is already
up when this option is used, it will be briefly brought down and
then brought back up again in order to ensure that the receive
@@ -254,7 +260,7 @@
.br
255.255.0.0 or 255.255.255.192
.It Sy hex
-Display subnet masks in hexidecimal, for example:
+Display subnet masks in hexadecimal, for example:
.br
0xffff0000 or 0xffffffc0
.El
@@ -2615,13 +2621,13 @@
.Cm vlandev
must both be set at the same time.
.It Cm vlanpcp Ar priority_code_point
-Priority code point
+Priority code point
.Pq Dv PCP
is an 3-bit field which refers to the IEEE 802.1p
class of service and maps to the frame priority level.
.Pp
Values in order of priority are:
-.Cm 1
+.Cm 1
.Pq Dv Background (lowest) ,
.Cm 0
.Pq Dv Best effort (default) ,
@@ -2759,7 +2765,7 @@
broadcasting the frame to the multicast group.
This is the default.
.It Fl vxlanlearn
-The forwarding table is not populated by recevied packets.
+The forwarding table is not populated by received packets.
.It Cm vxlanflush
Delete all dynamically-learned addresses from the forwarding table.
.It Cm vxlanflushall
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 20, 8:48 PM (8 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14747043
Default Alt Text
D7615.id.diff (2 KB)
Attached To
Mode
D7615: Adding randomized MAC address option on ifconfig.
Attached
Detach File
Event Timeline
Log In to Comment