From owner-freebsd-bugs@FreeBSD.ORG Wed Jul 21 02:00:39 2004 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 18E2616A4CE for ; Wed, 21 Jul 2004 02:00:39 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0D9A043D55 for ; Wed, 21 Jul 2004 02:00:39 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.11/8.12.11) with ESMTP id i6L20cM9050592 for ; Wed, 21 Jul 2004 02:00:38 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.11/8.12.11/Submit) id i6L20c0e050584; Wed, 21 Jul 2004 02:00:38 GMT (envelope-from gnats) Resent-Date: Wed, 21 Jul 2004 02:00:38 GMT Resent-Message-Id: <200407210200.i6L20c0e050584@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Christopher Sean Hilton Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B243516A4CE for ; Wed, 21 Jul 2004 01:56:01 +0000 (GMT) Received: from www.freebsd.org (www.freebsd.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id AA81243D58 for ; Wed, 21 Jul 2004 01:56:01 +0000 (GMT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.12.11/8.12.11) with ESMTP id i6L1u1ok072055 for ; Wed, 21 Jul 2004 01:56:01 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.12.11/8.12.11/Submit) id i6L1u1nt072054; Wed, 21 Jul 2004 01:56:01 GMT (envelope-from nobody) Message-Id: <200407210156.i6L1u1nt072054@www.freebsd.org> Date: Wed, 21 Jul 2004 01:56:01 GMT From: Christopher Sean Hilton To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-2.3 Subject: misc/69362: amd (automounter) does not properly detect the local network settings X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Jul 2004 02:00:39 -0000 >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 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 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 header file. */ -/* #undef HAVE_IFADDRS_H */ +#define HAVE_IFADDRS_H 1 /* Define if you have the header file. */ /* #undef HAVE_IRS_H */ Thanks: -- chris >Release-Note: >Audit-Trail: >Unformatted: