From owner-freebsd-hackers@FreeBSD.ORG Thu Nov 3 00:12:42 2005 Return-Path: X-Original-To: hackers@freebsd.org Delivered-To: freebsd-hackers@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EA90C16A41F for ; Thu, 3 Nov 2005 00:12:41 +0000 (GMT) (envelope-from brdavis@odin.ac.hmc.edu) Received: from odin.ac.hmc.edu (Odin.AC.HMC.Edu [134.173.32.75]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0FAC443D46 for ; Thu, 3 Nov 2005 00:12:39 +0000 (GMT) (envelope-from brdavis@odin.ac.hmc.edu) Received: from odin.ac.hmc.edu (localhost.localdomain [127.0.0.1]) by odin.ac.hmc.edu (8.13.0/8.13.0) with ESMTP id jA30Cdvj022173 for ; Wed, 2 Nov 2005 16:12:39 -0800 Received: (from brdavis@localhost) by odin.ac.hmc.edu (8.13.0/8.13.0/Submit) id jA30CdmL022171 for hackers@freebsd.org; Wed, 2 Nov 2005 16:12:39 -0800 Date: Wed, 2 Nov 2005 16:12:39 -0800 From: Brooks Davis To: hackers@freebsd.org Message-ID: <20051103001239.GA19590@odin.ac.hmc.edu> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="KsGdsel6WgEHnImy" Content-Disposition: inline User-Agent: Mutt/1.4.1i X-Virus-Scanned: by amavisd-new X-Spam-Status: No, hits=0.0 required=8.0 tests=none autolearn=no version=2.63 X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on odin.ac.hmc.edu Cc: Subject: fix for dhclient+aliases X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Nov 2005 00:12:42 -0000 --KsGdsel6WgEHnImy Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable I've got a proposed fix for dhclient interactions with IPv4 aliases. It turns out that my speculation that it was driver issues was wrong and that dhclient with reacting to the aliases themselves. I suspect there may be issues with some drivers, but that's not the main problem. This patch adds a flag which causes dhclient to ignore address changes that it didn't cause. Does this seem like an acceptable solution? I'd probably add an rc.conf variable similar to background_dhclient. -- Brooks ----- Forwarded message from Brooks Davis ----- From: Brooks Davis Date: Wed, 2 Nov 2005 23:54:08 GMT To: Perforce Change Reviews Subject: PERFORCE change 86258 for review http://perforce.freebsd.org/chv.cgi?CH=3D86258 Change 86258 by brooks@brooks_pagefault on 2005/11/02 23:53:14 Add a -a option to allow IPv4 aliases to be set on an interface. Affected files ... =2E. //depot/user/brooks/cleanup/sbin/dhclient/dhclient.8#6 edit =2E. //depot/user/brooks/cleanup/sbin/dhclient/dhclient.c#8 edit Differences ... =3D=3D=3D=3D //depot/user/brooks/cleanup/sbin/dhclient/dhclient.8#6 (text+k= o) =3D=3D=3D=3D @@ -46,7 +46,7 @@ .Nd "Dynamic Host Configuration Protocol (DHCP) client" .Sh SYNOPSIS .Nm -.Op Fl dqu +.Op Fl abdqu .Op Fl c Ar file .Op Fl l Ar file .Ar interface @@ -63,6 +63,11 @@ .Pp The options are as follows: .Bl -tag -width ".Fl c Ar file" +.It Fl a +Allows IPv4 aliases to be added to the interface. +Normally, +.Nm +exits if IPv4 addresses are added to or deleted from the interface. .It Fl b Forces .Nm =3D=3D=3D=3D //depot/user/brooks/cleanup/sbin/dhclient/dhclient.c#8 (text+k= o) =3D=3D=3D=3D @@ -103,6 +103,7 @@ =20 #define TIME_MAX 2147483647 =20 +int allow_aliases; int log_priority; int no_daemon; int unknown_ok =3D 1; @@ -203,6 +204,8 @@ ifam =3D (struct ifa_msghdr *)rtm; if (ifam->ifam_index !=3D ifi->index) break; + if (allow_aliases) + break; if (findproto((char *)(ifam + 1), ifam->ifam_addrs) !=3D AF_INET) break; if (ifi =3D=3D NULL) @@ -227,12 +230,30 @@ goto die; case RTM_DELADDR: ifam =3D (struct ifa_msghdr *)rtm; + if (ifam->ifam_index !=3D ifi->index) break; if (findproto((char *)(ifam + 1), ifam->ifam_addrs) !=3D AF_INET) break; if (scripttime =3D=3D 0 || t < scripttime + 10) break; + + sa =3D get_ifa((char *)(ifam + 1), ifam->ifam_addrs); + if (sa =3D=3D NULL) + goto die; + + if ((a.len =3D sizeof(struct in_addr)) > sizeof(a.iabuf)) + error("king bula sez: len mismatch"); + memcpy(a.iabuf, &((struct sockaddr_in *)sa)->sin_addr, a.len); + if (addr_eq(a, defaddr)) + break; + + for (l =3D ifi->client->active; l !=3D NULL; l =3D l->next) + if (addr_eq(a, l->address)) + break; + + if (l =3D=3D NULL) /* deleted addr is not the one we set */ + break; goto die; case RTM_IFINFO: ifm =3D (struct if_msghdr *)rtm; @@ -301,8 +322,11 @@ openlog(__progname, LOG_PID | LOG_NDELAY, DHCPD_LOG_FACILITY); setlogmask(LOG_UPTO(LOG_INFO)); =20 - while ((ch =3D getopt(argc, argv, "bc:dl:nqu")) !=3D -1) + while ((ch =3D getopt(argc, argv, "abc:dl:nqu")) !=3D -1) switch (ch) { + case 'a': + allow_aliases =3D 1; + break; case 'b': immediate_daemon =3D 1; break; ----- End forwarded message ----- --=20 Any statement of the form "X is the one, true Y" is FALSE. PGP fingerprint 655D 519C 26A7 82E7 2529 9BF0 5D8E 8BE9 F238 1AD4 --KsGdsel6WgEHnImy Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQFDaVX2XY6L6fI4GtQRAmwqAKCIvL4e6emYzb04RyoapnRa7Y3eHwCgvGVu EpcR+dglWQMBvYE2QFBF3D4= =yzbw -----END PGP SIGNATURE----- --KsGdsel6WgEHnImy--