From owner-freebsd-net@freebsd.org Wed Jun 8 20:40:50 2016 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 2E001B6F72A for ; Wed, 8 Jun 2016 20:40:50 +0000 (UTC) (envelope-from ricera10@gmail.com) Received: from mail-yw0-x231.google.com (mail-yw0-x231.google.com [IPv6:2607:f8b0:4002:c05::231]) (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 E39D41988 for ; Wed, 8 Jun 2016 20:40:49 +0000 (UTC) (envelope-from ricera10@gmail.com) Received: by mail-yw0-x231.google.com with SMTP id c72so19054650ywb.1 for ; Wed, 08 Jun 2016 13:40:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=N2H2sMXcObATYuvjSoMmChpbz97jZjkMXDD5HkMhTCA=; b=PeUpZCuQCrbWGUJ/bGTXHoanyeo02bo8CaX1vniWeYCpO/wzi2GQy8bLs65MLju7am mIklgmJCwTfFiB/EmitTf+SA0MgI1r2l5sfd4Z1vSAL2TCK6PhWHLloBBHlYNJMBWtXM 7lTb0Ho3b0Z7l22neY+O5SK8OM2gGuo0Ht9xm865pLQSBOycHvfAVdCaWsleJ2cxmdph lWFkm2anh1p9NUXr6e4Wo1tX/mC2Usi4UJ2z7uMjOtosn840aQW2+bcnjzsTjnM9zd/e d/imoU/pjWNjQ9kVFQZhAzdt3kw7TJQ9FP/2Dy/qa5N6mwevPFfjv9iYft4f78Kkdmtf Wzxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=N2H2sMXcObATYuvjSoMmChpbz97jZjkMXDD5HkMhTCA=; b=SelVwItTccWJNBTK3xPqHRjQu+Ji2HQ6kYg18xB5Tu3lsck3AfmsQpNkeSMI6iCp2i +wNNLryc6Il0qIo4r66IxOYCUYuKw2Ab2AZNDcmUiAWcSUB+akHcO/2iEUxLxIaT/MB7 QYizNac0RLl4cJTCMZPDr+dTWhYzt4gGE5dVltTAgPPO6RNc9wSnOTxhWBEENOia2zHg k+OgEYXE7a8IYPyxswHSAQxPAS6L6WusANSd3C8WUCmaIKb2pLNjutvjbtP73ne0r0H3 VKI7nfo/CiXejHQptdUXJlZermbhfjGy296WCn8H+M3m5EQA1p2Y4NblUAJpbZuJZ2Xx MOlA== X-Gm-Message-State: ALyK8tJ3qj7SX2HsOL8Ejy1rOnHte7dUzW6O+pCgPAmSeN8MSzNzvmimuCWo74bjDfpKz8XnTHYC+JxvVmlDig== X-Received: by 10.129.116.2 with SMTP id p2mr4279069ywc.209.1465418448653; Wed, 08 Jun 2016 13:40:48 -0700 (PDT) MIME-Version: 1.0 References: <494678734.3111275.1465379076220.JavaMail.zimbra@stormshield.eu> In-Reply-To: <494678734.3111275.1465379076220.JavaMail.zimbra@stormshield.eu> From: Eric Joyner Date: Wed, 08 Jun 2016 20:40:39 +0000 Message-ID: Subject: Re: [Patch] Changing mac address does not always work To: Arnaud YSMAL , freebsd-net@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Jun 2016 20:40:50 -0000 I think a better fix here is to have the driver not call init_locked() when the driver is not running when setting the MTU. It looks like all the other Intel network drivers do the same thing as this for the MTU. On Wed, Jun 8, 2016 at 2:47 AM Arnaud YSMAL wrote: > Hi, > > Configuring the network card with the following commands (in this specific > order) does not work. > # ifconfig em0 down > # ifconfig em0 mtu 1500 > # ifconfig em0 ether 12:34:56:12:34:56 > # ifconfig em0 192.168.1.1/24 > # ifconfig em0 up > > I was able to reproduce this issue on 10.3-RELEASE and HEAD with ix and em > drivers. > > From what I understand: > - When setting the mtu, the driver calls the init of the interface which > sets the IFF_DRV_RUNNING flag > - When setting the mac address, if_setlladdr (from if.c) copy the mac > address but does nothing else (the interface is not up) > - When setting the ip address, the driver does not call the init as the > IFF_DRV_RUNNING is already set. > - When setting the up flag, same as above, the IFF_DRV_RUNNING is already > set. > > In this case the network card does not work as the mac address filter is > not up to date. > > The enclosed path fixes this issue, > It changes if_setlladdr in if.c to call the ifp->if_ioctl function with > the IFF_UP flag clear even when the interface is not up. > The driver will then call its stop function which clear the > IFF_DRV_RUNNING. > The init will be called when setting the ip address or the up flag. > > Do you have any advice regarding this patch? > > Arnaud_______________________________________________ > freebsd-net@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"