Date: Wed, 21 Jul 2004 01:56:01 GMT From: Christopher Sean Hilton <chris@vindaloo.com> To: freebsd-gnats-submit@FreeBSD.org Subject: misc/69362: amd (automounter) does not properly detect the local network settings Message-ID: <200407210156.i6L1u1nt072054@www.freebsd.org> Resent-Message-ID: <200407210200.i6L20c0e050584@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 69362 >Category: misc >Synopsis: amd (automounter) does not properly detect the local network settings >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Jul 21 02:00:38 GMT 2004 >Closed-Date: >Last-Modified: >Originator: Christopher Sean Hilton >Release: FreeBSD 4.10-Stable >Organization: >Environment: FreeBSD hoth.pvt.vindaloo.com 4.10-STABLE FreeBSD 4.10-STABLE #0: Wed Jun 2 13:45:27 EDT 2004 chris@hoth.pvt.vindaloo.com:/usr/obj/usr/src/sys/HOTH i386 >Description: The automounter (amd) does not properly scan all network interfaces on laptop machines. If you have a conditional mount setting that should only work when your laptop is on a your home network and you are using a PCMCIA network card these mounts will fail. >How-To-Repeat: The wire-test program in FreeBSD will attempt to tell you what network you are on using the same code that amd used to determine if the mount you are trying is valid: *** Incorrect operation *** $ wire-test No networks. My IP address is 0xc0a80105. NFS Version and protocol tests to host "localhost"... testing vers=2, proto="udp" -> failed! testing vers=3, proto="udp" -> failed! testing vers=2, proto="tcp" -> failed! testing vers=3, proto="tcp" -> failed! $ ifconfig ed0 ed0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500 inet6 XXXXXXXXXXXXXXXXXXXXXXXXXX%ed0 prefixlen 64 scopeid 0x9 inet 192.168.1.5 netmask 0xfffffe00 broadcast 192.168.1.255 ether 00:40:f4:24:7b:61 $ *** Correct operation *** $ /usr/obj/usr/src/usr.sbin/amd/wire-test/wire-test Network: wire="example-net" (netnumber=192.168.1). My IP address is 0xc0a80105. NFS Version and protocol tests to host "localhost"... testing vers=2, proto="udp" -> failed! testing vers=3, proto="udp" -> failed! testing vers=2, proto="tcp" -> failed! testing vers=3, proto="tcp" -> failed! $ ifconfig ed0 ed0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500 inet6 XXXXXXXXXXXXXXXXXXXXXXXXXX%ed0 prefixlen 64 scopeid 0x9 inet 192.168.1.5 netmask 0xfffffe00 broadcast 192.168.1.255 ether 00:40:f4:24:7b:61 $ Notice that in the second case wire-test discovered that it was on example-net. >Fix: The problem exists in contrib/amd/libamu/wire.c. This code uses the SIOCGIFCONF ioctl to get a list of active network addresses. The SIOCGIFCONF call is limited though and on laptops only report built in (not pcmcia or usb) interfaces. The correct behaviour can be gotten by using the getifaddrs() library call. Code to do this is already in amd but it's turned off in config.h. The following patch turns it on. # diff -u usr.sbin/amd/include/config.h.orig usr.sbin/amd/include/config.h --- usr.sbin/amd/include/config.h.orig Wed Aug 29 18:32:17 2001 +++ usr.sbin/amd/include/config.h Tue Jul 20 21:35:26 2004 @@ -824,7 +824,7 @@ #define HAVE_FIELD_STRUCT_IFREQ_IFR_ADDR 1 /* does struct ifaddrs have field ifa_next? */ -/* #undef HAVE_FIELD_STRUCT_IFADDRS_IFA_NEXT */ +#define HAVE_FIELD_STRUCT_IFADDRS_IFA_NEXT 1 /* does struct sockaddr have field sa_len? */ #define HAVE_FIELD_STRUCT_SOCKADDR_SA_LEN 1 @@ -1163,7 +1163,7 @@ #define HAVE_GETHOSTNAME 1 /* Define if you have the getifaddrs function. */ -/* #undef HAVE_GETIFADDRS */ +#define HAVE_GETIFADDRS 1 /* Define if you have the getmntinfo function. */ #define HAVE_GETMNTINFO 1 @@ -1520,7 +1520,7 @@ /* #undef HAVE_HSFS_HSFS_H */ /* Define if you have the <ifaddrs.h> header file. */ -/* #undef HAVE_IFADDRS_H */ +#define HAVE_IFADDRS_H 1 /* Define if you have the <irs.h> header file. */ /* #undef HAVE_IRS_H */ Thanks: -- chris >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200407210156.i6L1u1nt072054>