From owner-p4-projects@FreeBSD.ORG Fri Feb 15 11:36:18 2013 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id D3BB7C07; Fri, 15 Feb 2013 11:36:18 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 97812C05 for ; Fri, 15 Feb 2013 11:36:18 +0000 (UTC) (envelope-from bz@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:1900:2254:2068::682:0]) by mx1.freebsd.org (Postfix) with ESMTP id 88BE42BC for ; Fri, 15 Feb 2013 11:36:18 +0000 (UTC) Received: from skunkworks.freebsd.org ([127.0.1.74]) by skunkworks.freebsd.org (8.14.6/8.14.6) with ESMTP id r1FBaICv014035 for ; Fri, 15 Feb 2013 11:36:18 GMT (envelope-from bz@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.6/8.14.6/Submit) id r1FBaIBk014032 for perforce@freebsd.org; Fri, 15 Feb 2013 11:36:18 GMT (envelope-from bz@freebsd.org) Date: Fri, 15 Feb 2013 11:36:18 GMT Message-Id: <201302151136.r1FBaIBk014032@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to bz@freebsd.org using -f From: "Bjoern A. Zeeb" Subject: PERFORCE change 222051 for review To: Perforce Change Reviews Precedence: bulk X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.14 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Feb 2013 11:36:19 -0000 http://p4web.freebsd.org/@@222051?ac=10 Change 222051 by bz@bz_zenith on 2013/02/15 11:35:17 Add a -g option to prevent the locally administred bit from being set or in case of -s to manually set an address, change the warning. X-Untested: yes Affected files ... .. //depot/projects/ctsrd/beribsd/src/ctsrd/atsectl/atsectl.c#2 edit Differences ... ==== //depot/projects/ctsrd/beribsd/src/ctsrd/atsectl/atsectl.c#2 (text+ko) ==== @@ -74,15 +74,18 @@ static u_char block[ISF_ERASE_BLOCK]; +static int gflag; + /* XXX-BZ should include if_atsereg.h. */ #define ALTERA_ETHERNET_OPTION_BITS_OFF 0x00008000 #define ALTERA_ETHERNET_OPTION_BITS_LEN 0x00007fff + static void usage(int rc) { - fprintf(stderr, "usage: atsectl [-hlu] [-s ]\n"); + fprintf(stderr, "usage: atsectl [-ghlu] [-s ]\n"); exit(rc); } @@ -211,8 +214,11 @@ /* Just make sure the last half-byte is really zero. */ block[ALTERA_ETHERNET_OPTION_BITS_OFF + 9] &= ~0x0f; - /* Set locally administred flag. */ - block[ALTERA_ETHERNET_OPTION_BITS_OFF + 4] |= 2; + /* Set (or clear) locally administred flag. */ + if (gflag == 0) + block[ALTERA_ETHERNET_OPTION_BITS_OFF + 4] |= 2; + else + block[ALTERA_ETHERNET_OPTION_BITS_OFF + 4] &= ~2; /* Make sure it is not a MC address by accident we start with. */ block[ALTERA_ETHERNET_OPTION_BITS_OFF + 4] &= ~1; } else { @@ -231,7 +237,7 @@ warnx("WARN: Selected Ethernet Address is " "not multi-MAC compatible.\n"); } - if ((eaddr[0] & 0x2) == 0x0) { + if (gflag == 0 && ((eaddr[0] & 0x2) == 0x0)) { e++; warnx("WARN: Locally administered bit not set.\n"); } @@ -303,8 +309,11 @@ char ch, *s; s = NULL; - while ((ch = getopt(argc, argv, "hlus:")) != -1) { + while ((ch = getopt(argc, argv, "ghlus:")) != -1) { switch (ch) { + case 'g': + gflag = 1; + break; case 'h': usage(0); /* NOTREACHED */