From owner-freebsd-net@freebsd.org Tue Jun 20 18:09:23 2017 Return-Path: Delivered-To: freebsd-net@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 BF588D9E3C5 for ; Tue, 20 Jun 2017 18:09:23 +0000 (UTC) (envelope-from garga.bsd@gmail.com) Received: from mail-ua0-x232.google.com (mail-ua0-x232.google.com [IPv6:2607:f8b0:400c:c08::232]) (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 7DF0768C2B; Tue, 20 Jun 2017 18:09:23 +0000 (UTC) (envelope-from garga.bsd@gmail.com) Received: by mail-ua0-x232.google.com with SMTP id j53so76129428uaa.2; Tue, 20 Jun 2017 11:09:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:to:from:subject:cc:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=a5TVybPIbKrlwNXHm9zuaXqr0xA1GAwCarTA0hmfG1I=; b=m/wsLMgjyZbPpjcwz4h57BrVEviRbR/yODT+ask1vSXCUzJLh2e5JYBalkzOxeXG3u h/CnHWkYsyMww8LVHTMo6YvEX/aOWIhfd/tGHAEpFKJqCoJ4Lrvivz5hkuNl9dhGeale p4ELzbq00IJhqcFWtiXCP33GUPn2CJtbh6uIj1ndbHQ70rV0N9cQXN2Miua1VzRVw3gT bhj3Jzfi/76xab6vYs9BxQZ1xTj6uav5kcue/Wy+ovkIM9IeA/JaMsf4sw8zSBIBIIwM xAwHCFVJoyQdmcjw+4Fg1KPe0JUBkTE8piinRWiin4eJx6dzZif4KeYbdPNQ4Sj5t4Fw 26Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:to:from:subject:cc:message-id:date :user-agent:mime-version:content-language:content-transfer-encoding; bh=a5TVybPIbKrlwNXHm9zuaXqr0xA1GAwCarTA0hmfG1I=; b=mcrOgReVxOmw15YB+HnrsWh2Ucjv+4ZiJMXdGC3mwxeWbEmdnHTVyVse4TwqEseqNX dz73J37LWwiiKJU2KXxHStO2hkYgWI0eMPmQGyOJZ8XQfV6soT3ogB0uvnTurc/uVpxn MRmGXG5uQjM2ywvScji5gNRNoAfWjuSGQWjakblzq0D6AI58KWtcLxDn8pb0Ew5nUSrR fYb/L/Xu7NJU7KZhyqLQ8KrpzKFu/mOm78NwKusyI0/O6TK6MLWzJLAUt5xVRoCGPcwc QYDVsgQ/sjS9LQfQqRS463kvjmeXTEU2bgYGVC/sCwiV9tiZzlCxNCzXq21ATsx1C346 aczQ== X-Gm-Message-State: AKS2vOxMqDFID0DuYzKb+r/YXWV3Hr8HaMpPHJ+78OA5ZlcdLMM6+WFQ xZGLI7Ukh3GHef72cJc= X-Received: by 10.176.67.98 with SMTP id k89mr3499290uak.103.1497982162036; Tue, 20 Jun 2017 11:09:22 -0700 (PDT) Received: from mbp-eth.home ([177.53.86.172]) by smtp.gmail.com with ESMTPSA id i5sm3682796uaa.6.2017.06.20.11.09.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Jun 2017 11:09:21 -0700 (PDT) Sender: Renato Botelho To: freebsd-net@freebsd.org From: Renato Botelho Subject: Failover Mode Between Ethernet and Wireless Interfaces Cc: adrian@FreeBSD.org Message-ID: <86519ec0-64f0-9395-cafc-95ab8599f1ca@FreeBSD.org> Date: Tue, 20 Jun 2017 15:09:18 -0300 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Jun 2017 18:09:23 -0000 Last night I was configuring a new laptop and decided to give it [1] a try. I figured out this section of handbook (similar instructions are on lagg(4) manpage) is outdated, based on FreeBSD 10.x. Then I modified a bit the commands and tried to get it configured on 12-CURRENT, without success. I spoke with adrian@, who told me this setup doesn't work on FreeBSD > 10, because on newer versions Wireless interfaces mac address cannot be changed. My next attempt was to do the other way round and make lagg to use wlan0 mac address instead of em0's. but even doing this my wireless interface ended up not working. After further investigation I noted that a simple command: # ifconfig wlan0 ether $wlan0_current_mac_address is enough to break it on 12-CURRENT. I've checked if_setlladdr() source code and noted it always replace the mac address, even if the same is already configured on the interface. Is it the expected behavior? Just as a PoC I've applied the following patch to if_setlladdr(): Index: sys/net/if.c =================================================================== --- sys/net/if.c (revision 320097) +++ sys/net/if.c (working copy) @@ -3519,6 +3519,10 @@ ifa_free(ifa); return (EINVAL); } + if (memcmp(lladdr, LLADDR(sdl), len) == 0) { + ifa_free(ifa); + return (0); + } switch (ifp->if_type) { case IFT_ETHER: case IFT_FDDI: And configured it to use wlan0 mac address on rc.conf: ifconfig_em0="ether 60:67:20:c5:2d:48 up" wlans_iwn0="wlan0" ifconfig_wlan0="WPA" cloned_interfaces="lagg0" ifconfig_lagg0="up laggproto failover laggport em0 laggport wlan0 DHCP" and it's now working as expected. Other than that, I believe if wlan interfaces cannot have their mac address changed, ifconfig should return an error when user attempts to do it, and if_setlladdr() should do the same. Thoughts? [1] https://www.freebsd.org/doc/handbook/network-aggregation.html#networking-lagg-wired-and-wireless -- Renato Botelho