Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Mar 2020 08:33:50 -0800
From:      Gleb Smirnoff <glebius@freebsd.org>
To:        Dimitry Andric <dim@freebsd.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r358655 - head/sbin/mount_nfs
Message-ID:  <20200305163350.GU5741@FreeBSD.org>
In-Reply-To: <244e28ea-1217-cefc-354e-02ecb201637a@FreeBSD.org>
References:  <202003042227.024MRGsW072613@repo.freebsd.org> <244e28ea-1217-cefc-354e-02ecb201637a@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Mar 05, 2020 at 03:29:23PM +0100, Dimitry Andric wrote:
D> On 2020-03-04 23:27, Gleb Smirnoff wrote:
D> > Author: glebius
D> > Date: Wed Mar  4 22:27:16 2020
D> > New Revision: 358655
D> > URL: https://svnweb.freebsd.org/changeset/base/358655
D> > 
D> > Log:
D> >    When a machine boots the NFS mounting script is executed after
D> >    interfaces are configured, but for many interfaces (e.g. all Intel)
D> >    ifconfig causes link renegotiation, so the first attempt to mount
D> >    NFS always fails. After that mount_nfs sleeps for 30 seconds, while
D> >    only a couple seconds are actually required for interface to get up.
D> >    Instead of sleeping, do select(2) on routing socket and check if
D> >    some interface became UP and in this case retry immediately.
D> 
D> At least on i386, this causes a -Werror warning:
D> 
D> sbin/mount_nfs/mount_nfs.c:549:10: error: cast from 'char *' to 'struct
D> if_msghdr *' increases required alignment from 1 to 4
D> [-Werror,-Wcast-align]
D>                         ifm = (struct if_msghdr *)buf;
D>                               ^~~~~~~~~~~~~~~~~~~~~~~
D> 1 error generated.
D> 
D> In practice I don't think the buffer can ever get misaligned, so can you
D> please add a NO_WCAST_ALIGN= to the Makefile?

route(8) handles the same problem via intermediate (void *) cast. What is
preferred way to solve the problem? Change compiler flags file wide, or
just through (void *) cast?

-- 
Gleb Smirnoff



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20200305163350.GU5741>