From owner-p4-projects@FreeBSD.ORG Tue Nov 2 04:56:10 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 3D71916A4D0; Tue, 2 Nov 2004 04:56:10 +0000 (GMT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 17BAA16A4CE for ; Tue, 2 Nov 2004 04:56:10 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id E64AC43D39 for ; Tue, 2 Nov 2004 04:56:09 +0000 (GMT) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id iA24u9cb093108 for ; Tue, 2 Nov 2004 04:56:09 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id iA24u9eV093105 for perforce@freebsd.org; Tue, 2 Nov 2004 04:56:09 GMT (envelope-from sam@freebsd.org) Date: Tue, 2 Nov 2004 04:56:09 GMT Message-Id: <200411020456.iA24u9eV093105@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Subject: PERFORCE change 64077 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2004 04:56:10 -0000 http://perforce.freebsd.org/chv.cgi?CH=64077 Change 64077 by sam@sam_ebb on 2004/11/02 04:55:18 o bssid - removes any specfied bssid o accept -, any, or off for removing previous specifications (the latter two for compatibility with linux) Affected files ... .. //depot/projects/wifi/sbin/ifconfig/ifieee80211.c#3 edit Differences ... ==== //depot/projects/wifi/sbin/ifconfig/ifieee80211.c#3 (text+ko) ==== @@ -97,6 +97,13 @@ u_int8_t *buf, int *lenp); static void print_string(const u_int8_t *buf, int len); +static int +isanyarg(const char *arg) +{ + return (strcmp(arg, "-") == 0 || + strcasecmp(arg, "any") == 0 || strcasecmp(arg, "off") == 0); +} + static void set80211ssid(const char *val, int d, int s, const struct afswtch *rafp) { @@ -164,7 +171,7 @@ static void set80211channel(const char *val, int d, int s, const struct afswtch *rafp) { - if (strcmp(val, "-") != 0) { + if (!isanyarg(val)) { int v = atoi(val); if (v > 255) /* treat as frequency */ v = ieee80211_mhz2ieee(v); @@ -449,20 +456,29 @@ static void set80211bssid(const char *val, int d, int s, const struct afswtch *rafp) { - char *temp; - struct sockaddr_dl sdl; + + if (!isanyarg(val)) { + char *temp; + struct sockaddr_dl sdl; - temp = malloc(strlen(val) + 1); - if (temp == NULL) - errx(1, "malloc failed"); - temp[0] = ':'; - strcpy(temp + 1, val); - sdl.sdl_len = sizeof(sdl); - link_addr(temp, &sdl); - free(temp); - if (sdl.sdl_alen != IEEE80211_ADDR_LEN) - errx(1, "malformed link-level address"); - set80211(s, IEEE80211_IOC_BSSID, 0, IEEE80211_ADDR_LEN, LLADDR(&sdl)); + temp = malloc(strlen(val) + 1); + if (temp == NULL) + errx(1, "malloc failed"); + temp[0] = ':'; + strcpy(temp + 1, val); + sdl.sdl_len = sizeof(sdl); + link_addr(temp, &sdl); + free(temp); + if (sdl.sdl_alen != IEEE80211_ADDR_LEN) + errx(1, "malformed link-level address"); + set80211(s, IEEE80211_IOC_BSSID, 0, + IEEE80211_ADDR_LEN, LLADDR(&sdl)); + } else { + uint8_t zerobssid[IEEE80211_ADDR_LEN]; + memset(zerobssid, 0, sizeof(zerobssid)); + set80211(s, IEEE80211_IOC_BSSID, 0, + IEEE80211_ADDR_LEN, zerobssid); + } } static void