From owner-freebsd-current@freebsd.org Sun Oct 25 19:30:49 2015 Return-Path: Delivered-To: freebsd-current@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 858848F7F for ; Sun, 25 Oct 2015 19:30:49 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pa0-x233.google.com (mail-pa0-x233.google.com [IPv6:2607:f8b0:400e:c03::233]) (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 57E1E155A; Sun, 25 Oct 2015 19:30:49 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by pacfv9 with SMTP id fv9so173058268pac.3; Sun, 25 Oct 2015 12:30:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=yq/gShUabmbP+F++zGSdcgrOu7OUDi4kf573Exlfqzk=; b=LtH8+B2Nh8dFkjgcCJ2vhGUN7UF1qIWqG+/IQKvHw2pE5xnBjB/J/60IoJYkweDduA 8QBd1NTvkbZUe4qQiqMGFLFNb3X0zhXIvuBM93717YWsCBS7nas5ZIQ9SPRxqJZUwM4J enMSqFya1v4liY698rIfc3LfWvFG3gIzDuLUKV6O+2CM9J/VwSBnJPBr+QBeqsub0wMH KFe7wrIic6/6BdQahfqKnFYvnxbpM6fFu6xvpNSObCmdY7p6cloXQKbkMilT//KsF2a1 EiXlbN0Jsb9nsvwqhNHTaXW0azeVhpgVlh/nzUzzJNvJiFkWGhLEM/zCuP8+oj2Sm/GO l+KA== X-Received: by 10.68.216.6 with SMTP id om6mr18118519pbc.29.1445801448871; Sun, 25 Oct 2015 12:30:48 -0700 (PDT) Received: from [192.168.20.7] (c-24-16-212-205.hsd1.wa.comcast.net. [24.16.212.205]) by smtp.gmail.com with ESMTPSA id xz5sm29809760pbb.12.2015.10.25.12.30.48 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 25 Oct 2015 12:30:48 -0700 (PDT) Subject: Re: What changed in rc.d infrastructure in last months? Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) Content-Type: text/plain; charset=utf-8 From: NGie Cooper X-Priority: 3 (Normal) In-Reply-To: <16610120144.20151025222025@serebryakov.spb.ru> Date: Sun, 25 Oct 2015 12:30:47 -0700 Cc: freebsd-current Content-Transfer-Encoding: quoted-printable Message-Id: References: <16610120144.20151025222025@serebryakov.spb.ru> To: lev@FreeBSD.org X-Mailer: Apple Mail (2.2104) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Oct 2015 19:30:49 -0000 > On Oct 25, 2015, at 12:20, Lev Serebryakov wrote: >=20 > Hello freebsd-current, >=20 >=20 > New version of -CURRENT try to configure wlan0 and run hostapd twice: >=20 > Created wlan(4) interfaces: wlan0. > Created clone interfaces: gif0. > em0: link state changed to UP > em0: link state changed to DOWN > ifconfig: NONE: bad value > vlan0: changing name to 'skynet' > vlan1: changing name to 'eltel' > Starting hostapd. > Configuration file: /etc/hostapd-wlan0.conf > Using interface wlan0 with hwaddr 00:15:6d:85:5f:fc and ssid = "home.serebryakov.spb.ru" > wlan0: interface state UNINITIALIZED->ENABLED > wlan0: AP-ENABLED > gif0: link state changed to UP > Starting Network: lo0 em0 em1 wlan0 gif0. > .... > Starting devd. > ifconfig: SIOCS80211: Device busy > hostapd already running? (pid=3D455). > em1: link state changed to UP > eltel: link state changed to UP > skynet: link state changed to UP > Starting Network: wlan0. >=20 > Before this there was no second try to run hostapd. What should I = change in > /etc/rc.d to eliminate this double-run and double-configuration? Now I > have: >=20 > wlans_ath0=3D"wlan0" > create_args_wlan0=3D"wlanmode hostap bssid" > ifconfig_wlan0=3D"HOSTAP inet 192.168.135.1 netmask 255.255.255.0 mode = 11ng channel 3:ht/40 -bgscan ssid home.serebryakov.spb.ru country DE = regdomain row txpower 30" >=20 > I DON'T have "hostapd_enable=E2=80=9D! etc/rc.d/hostapd is written a bit weird for an rc.d script. It doesn=E2=80= =99t check =E2=80=9Chostapd_enable=E2=80=9D in the case where it=E2=80=99s= explicitly provided an interface: 15 ifn=3D"$2" 16 if [ -z "$ifn" ]; then 17 rcvar=3D"hostapd_enable" 18 conf_file=3D"/etc/${name}.conf" 19 pidfile=3D"/var/run/${name}.pid" 20 else 21 rcvar=3D 22 conf_file=3D"/etc/${name}-${ifn}.conf" 23 pidfile=3D"/var/run/${name}-${ifn}.pid" 24 fi This scenario is trigged by network.subr: 221 if wpaif $1; then 222 /etc/rc.d/wpa_supplicant start $1 223 _cfg=3D0 # XXX: not sure this should count 224 elif hostapif $1; then 225 /etc/rc.d/hostapd start $1 226 _cfg=3D0 227 fi =E2=80=A6 251 if wpaif $1; then 252 /etc/rc.d/wpa_supplicant stop $1 253 _cfg=3D0 254 elif hostapif $1; then 255 /etc/rc.d/hostapd stop $1 256 _cfg=3D0 257 fi What determines whether or not it=E2=80=99s a hostapif? Whether or not = `hostap` is in ifconfig_. 445 # hostapif if 446 # Returns 0 if the interface is a HOSTAP interface and 1 = otherwise. 447 hostapif() 448 { 449 local _tmpargs _arg 450 _tmpargs=3D`_ifconfig_getargs $1` 451=20 452 for _arg in $_tmpargs; do 453 case $_arg in 454 [Hh][Oo][Ss][Tt][Aa][Pp]) 455 return 0 456 ;; 457 esac 458 done 459=20 460 return 1 461 } This [the hostapd start/stop logic] all gets triggered whenever the = interface goes up and down. glebius broke etc/rc.d/{devd,ldconfig} back in April by reordering the = dependencies, which can affect this. See = https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D202726 for more = details. Cheers! -NGie=