From owner-svn-src-all@freebsd.org Fri Sep 16 04:29:09 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6859FBDC616; Fri, 16 Sep 2016 04:29:09 +0000 (UTC) (envelope-from araujobsdport@gmail.com) Received: from mail-yw0-x22b.google.com (mail-yw0-x22b.google.com [IPv6:2607:f8b0:4002:c05::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 160C71E1; Fri, 16 Sep 2016 04:29:09 +0000 (UTC) (envelope-from araujobsdport@gmail.com) Received: by mail-yw0-x22b.google.com with SMTP id u82so75624865ywc.2; Thu, 15 Sep 2016 21:29:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:in-reply-to:references:from:date:message-id :subject:to:cc; bh=lGutiF2CrFCN7aeqxzDNnm4yTTbO9VEp6P5h0k1nhQE=; b=WeZKTy7A9x6nx3VOY4hRnVdmXuUWn9Ft7Q8sre3dOmgSv4rM1+DWEHimW8cmi82n7Q zfK7In8y4SzFq3bMA8iZJMusXsXH/LW/TVsPyvHoX3LIR8jtPZyV5vSsOW8+703GC3Yy u529Og3hMkBohxf6FvqIxiRsXtfPah6Np5HgPrMkGfIndNlIgRfTT+BmCPkxV9Lx4Hqd 7CT1f01HiRwMlGj2CTFSwptPNzukewxHLNi7KAA4zzhczMERuhGvkj3HPqfZSuWCVdIC Kld6EcFO+GuKRU0Hh2nlMORFNwvOpf0YvzWKiMyoSDIXwveLcTh1dRGMbutyhf1Q+qhJ ol0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=lGutiF2CrFCN7aeqxzDNnm4yTTbO9VEp6P5h0k1nhQE=; b=TFCPAe2JAzQxfOWPTl546u0VtAq3QQc6NJkRW4Cu7ZzjqtEr5EVPVuUMqwxnyoBaXI UDHBFYW1wFiM15wt7JQVWVLQEUm0p77czvrz0XjUcMWCbfrYecNB3JSoDEyPIhY2l5rN LRuporvbzvNG7r3odpWA5BocjhY65+YOg//F0pqnhagPEm/WPbwyXOl5Zjhigyr+jZMB I4YVtNPnOBx6i7jk2r3eCWkm0UXAG1EDlWXA/Z9ZHIAhsdgKIm1fl6o6zll3qTfkyfUh 56yMy3q3P3ayETlzOmnhy0lH3r1G/sHDCSCfGO15AGHf/lzRobWytKm3FzP/JoL0glEn wCrg== X-Gm-Message-State: AE9vXwOa2sTyXrUcsOai+xhox7xaXMMi4clVccLdoVulPvFeaIl7E2m3hGPp6Ljq7UM4Iatx3XYgFROx+HXLEQ== X-Received: by 10.13.198.194 with SMTP id i185mr11802644ywd.132.1474000148175; Thu, 15 Sep 2016 21:29:08 -0700 (PDT) MIME-Version: 1.0 Received: by 10.129.56.130 with HTTP; Thu, 15 Sep 2016 21:29:07 -0700 (PDT) Reply-To: araujo@freebsd.org In-Reply-To: <201609160422.u8G4MLN0031061@repo.freebsd.org> References: <201609160422.u8G4MLN0031061@repo.freebsd.org> From: Marcelo Araujo Date: Fri, 16 Sep 2016 12:29:07 +0800 Message-ID: Subject: Re: svn commit: r305860 - head/sbin/ifconfig To: Marcelo Araujo Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Sep 2016 04:29:09 -0000 Ooops! Forgot to add the review link: https://reviews.freebsd.org/D7615 Best, 2016-09-16 12:22 GMT+08:00 Marcelo Araujo : > Author: araujo > Date: Fri Sep 16 04:22:21 2016 > New Revision: 305860 > URL: https://svnweb.freebsd.org/changeset/base/305860 > > Log: > Add an option called "random" that combined with "ether" can generate a > random MAC address for an Ethernet interface. > > PR: 211984 > Submitted by: pi@ > Reviewed by: gnn, cem, jhb, lidl, rpokala, wblock > Approved by: wblock (manpages) > > Modified: > head/sbin/ifconfig/af_link.c > head/sbin/ifconfig/ifconfig.8 > > Modified: head/sbin/ifconfig/af_link.c > ============================================================ > ================== > --- head/sbin/ifconfig/af_link.c Fri Sep 16 04:12:32 2016 > (r305859) > +++ head/sbin/ifconfig/af_link.c Fri Sep 16 04:22:21 2016 > (r305860) > @@ -90,13 +90,23 @@ link_getaddr(const char *addr, int which > > 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; > > Modified: head/sbin/ifconfig/ifconfig.8 > ============================================================ > ================== > --- head/sbin/ifconfig/ifconfig.8 Fri Sep 16 04:12:32 2016 > (r305859) > +++ head/sbin/ifconfig/ifconfig.8 Fri Sep 16 04:22:21 2016 > (r305860) > @@ -28,7 +28,7 @@ > .\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94 > .\" $FreeBSD$ > .\" > -.Dd June 8, 2016 > +.Dd September 17, 2016 > .Dt IFCONFIG 8 > .Os > .Sh NAME > @@ -145,6 +145,12 @@ is specified as a series of colon-separa > 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 @@ Display subnet masks in dotted quad nota > .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 @@ and > .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 @@ interface to send the frame directly to > 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 > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" > -- -- Marcelo Araujo (__)araujo@FreeBSD.org \\\'',)http://www.FreeBSD.org \/ \ ^ Power To Server. .\. /_)