import of dnsmasq-2.35.tar.gz
diff --git a/CHANGELOG b/CHANGELOG
index b0c24ac..62f99f0 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2009,6 +2009,32 @@
             Added Webmin module in contrib/webmin. Thanks to Neil
             Fisher for that.
 
+version 2.35
+	    Generate an "old" script event when a client does a DHCPREQUEST
+	    in INIT-REBOOT or SELECTING state and the lease already
+	    exists. Supply vendor and user class information to these
+	    script calls.
+
+	    Added support for Dragonfly BSD to src/config.h
+
+	    Removed "Upgrading to 2.0" document, which is ancient
+	    history now.
+
+	    Tweak DHCP networking code for BSD, esp OpenBSD. Added a 
+	    workaround for a bug in OpenBSD 4.0: there should finally
+            be support for multiple interfaces under OpenBSD now.
+	    Note that no version of dnsmasq before 2.35 will work for 
+	    DHCP under OpenBSD 4.0 because of a kernel bug.
+	    Thanks to Claudio Jeker, Jeb Campbell and Cristobal 
+	    Palmer for help with this.
+
+	    Optimised the cache code for the case of large
+	    /etc/hosts. This is mainly to remove the O(n-squared)
+	    algorithm which made reading large (50000 lines) files 
+	    slow, but it also takes into account the size of 
+	    /etc/hosts when building hash tables, so overall 
+	    performance should be better. Thanks to "koko" for 
+	    pointing out the problem.
 
 
  
diff --git a/UPGRADING_to_2.0 b/UPGRADING_to_2.0
deleted file mode 100644
index 218d5d3..0000000
--- a/UPGRADING_to_2.0
+++ /dev/null
@@ -1,68 +0,0 @@
-
-
-	Upgrading to dnsmasq V2
-        -----------------------
-
-Version 1.x of dnsmasq includes a facility for reading the dhcp.leases
-file written by ISC dhcpd. This allows the names of machines which
-have addresses allocated by DHCP to be included in the DNS.
-
-Version 2.x of dnsmasq replaces the ISC dhcpd integration with a DHCP 
-server integrated into dnsmasq. Versions 2.0-2.5 removed the ISC 
-integration completely, but in version 2.6 it was re-enabled for 
-backwards compatibility purposes. The change to an integrated DHCP 
-server has the following advantages:
-
-* Small. ISC dhcpd is a large and comprehensive DHCP solution. The
-  dnsmasq DHCP server adds about 15k to DNS-only dnsmasq and provides
-  all the facilities likely to be needed in the sort of networks
-  which are targeted by dnsmasq.
-
-* Easy to configure. All configuration is in one file and there are
-  sensible defaults for common settings. Many applications will need
-  just one extra line in /etc/dnsmasq.conf which tells it the range of
-  addresses to allocate to DHCP.
-
-* Support for static leases. When static leases are used with ISC DHCP
-  they don't appear in the dhcp.leases file (since that file is used
-  for storage of dynamic leases which aren't pre-configured.) Hence
-  static leases cannot be used with dnsmasq unless each machine with a
-  static lease is also inserted into /etc/hosts. This is not required
-  with the dnsmasq DHCP server.
-
-
-       DHCP configuration
-       ------------------
-
-To convert an installation which is currently using ISC dhcpd, remove
-the ISC DHCP daemon. Unless you want dnsmasq to use the same file
-to store its leases it is necessary to remove the configuration line in
-/etc/dnsmasq.conf which specifies the dhcp.leases file.
-
-To enable DHCP, simply add a line like this to /etc/dnsmasq.conf
-
-dhcp-range=192.168.0.100,192.168.0.200,12h
-
-which tells dnsmasq to us the addresses 192.168.0.100 to 192.168.0.200
-for dynamic IP addresses, and to issue twelve hour leases.
-
-Each host will have its default route and DNS server set to be the
-address of the host running dnsmasq, and its netmask and broadcast 
-address set correctly, so nothing else at all is required for a
-minimal system. Hosts which include a hostname in their DHCP request 
-will have that name and their allocated address inserted into the DNS,
-in the same way as before.
-
-Having started dnsmasq, tell any hosts on the network to renew their
-DHCP lease, so that dnsmasq's  DHCP server becomes aware of them. For
-Linux, this is best done by killing-and-restarting the DHCP client
-daemon or taking the network interface down and then back up. For 
-Windows 9x/Me, use the graphical tool "winipcfg". For Windows
-NT/2000/XP, use the command-line "ipconfig /renew"
-
-For more complex DHCP configuration, refer to the doc/setup.html, the
-dnsmasq manpage and the annotated example configuration file. Also
-note that for some ISC dhcpd to dnsmasq DHCP upgrades there may be
-firewall issues: see the FAQ for details of this.
-
-
diff --git a/doc.html b/doc.html
index bf2e1d3..1536209 100644
--- a/doc.html
+++ b/doc.html
@@ -21,11 +21,11 @@
 Supported platforms include Linux (with glibc and uclibc), *BSD and
 Mac OS X.
 Dnsmasq is included in at least the following Linux distributions:
-Gentoo, Debian, Slackware, Suse, 
+Gentoo, Debian, Slackware, Suse, Fedora,
 Smoothwall, IP-Cop, floppyfw, Firebox, LEAF, Freesco, fli4l,
 CoyoteLinux, Endian Firewall and
-Clarkconnect. It is also available as a FreeBSD port and is used in
-Linksys wireless routers and the m0n0wall project.
+Clarkconnect. It is also available as FreeBSD, OpenBSD and NetBSD ports and is used in
+Linksys wireless routers (dd-wrt, openwrt and the stock firmware) and the m0n0wall project.
 <P>
 Dnsmasq provides the following features:
 <DIR>
@@ -74,7 +74,7 @@
 with private DNS systems easy.
 </LI>
 <LI>
-Dnsmasq supports MX records and can be configured to return MX records
+Dnsmasq supports MX and SRV records and can be configured to return MX records
 for any or all local machines.
 </LI>
 </DIR>
@@ -82,27 +82,11 @@
 <H2>Download.</H2>
 
 <A HREF="http://www.thekelleys.org.uk/dnsmasq/"> Download</A> dnsmasq here. 
-The tarball includes this documentation, source, manpage and control files for building .rpms.
-There are also pre-built i386 .rpms, and a 
-<A HREF="CHANGELOG"> CHANGELOG</A>.
+The tarball includes this documentation, source, and manpage.
+There is also a <A HREF="CHANGELOG"> CHANGELOG</A>.
 Dnsmasq is part of the Debian distribution, it can be downloaded from 
 <A HREF="http://ftp.debian.org/debian/pool/main/d/dnsmasq/"> here</A> or installed using <TT>apt</TT>.
 
-
-<H2>Building rpms.</H2>
-Assuming you have the relevant tools installed, you can rebuild .rpms simply by running (as root)
-
-<PRE>
-rpmbuild -ta dnsmasq-xxx.tar.gz
-</PRE>
-
-Note for Suse users: you will need to re-compress the tar file as
-bzip2 before building using the commands
-<PRE>
-gunzip dnsmasq-xxx.tar.gz
-bzip2 dnsmasq-zzz.tar
-</PRE>
-
 <H2>Links.</H2>
 There is an article in German on dnsmasq at <A
 HREF="http://www.linuxnetmag.com/de/issue7/m7dnsmasq1.html">http://www.linuxnetmag.com/de/issue7/m7dnsmasq1.html</A>
diff --git a/hosts b/hosts
new file mode 100644
index 0000000..c46800c
--- /dev/null
+++ b/hosts
@@ -0,0 +1,2 @@
+127.0.0.1 host1.domain
+
diff --git a/man/dnsmasq.8 b/man/dnsmasq.8
index 1225c13..4841e25 100644
--- a/man/dnsmasq.8
+++ b/man/dnsmasq.8
@@ -354,7 +354,7 @@
 one interface when using DHCP, and the name of that interface must be
 given using the
 .B interface
-option. This limitation currently affects OpenBSD. It is always
+option. This limitation currently affects OpenBSD before version 4.0. It is always
 allowed to have more than one dhcp-range in a single subnet. The optional
 network-id is a alphanumeric label which marks this network so that
 dhcp options may be specified on a per-network basis. 
@@ -568,8 +568,9 @@
 host provided a client-id, this is stored in the environment variable
 DNSMASQ_CLIENT_ID. If the client provides vendor-class or user-class 
 information, these are provided in DNSMASQ_VENDOR_CLASS and 
-DNSMASQ_USER_CLASS0..DNSMASQ_USER_CLASSn variables, but only for the
-"add" actions, since these data are not held in dnsmasq's lease
+DNSMASQ_USER_CLASS0..DNSMASQ_USER_CLASSn variables, but only fory
+"add" actions or "old" actions when a host resumes an existing lease,
+since these data are not held in dnsmasq's lease
 database. If dnsmasq was compiled with HAVE_BROKEN_RTC, then
 the length of the lease (in seconds) is stored in
 DNSMASQ_LEASE_LENGTH, otherwise the time of lease expiry is stored in
diff --git a/po/de.po b/po/de.po
index abcd274..c892646 100644
--- a/po/de.po
+++ b/po/de.po
@@ -6,7 +6,7 @@
 msgstr ""
 "Project-Id-Version: dnsmasq 2.24\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2006-10-13 18:20+0100\n"
+"POT-Creation-Date: 2006-10-28 15:42+0100\n"
 "PO-Revision-Date: 2005-09-27 09:37+0100\n"
 "Last-Translator: Simon Kelley <simon@thekelleys.org.uk>\n"
 "Language-Team: German <de@li.org>\n"
@@ -15,37 +15,37 @@
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=2; plural=(n != 1);\n"
 
-#: cache.c:606
+#: cache.c:665
 #, c-format
 msgid "failed to load names from %s: %m"
 msgstr ""
 
-#: cache.c:642 dhcp.c:682
+#: cache.c:699 dhcp.c:701
 #, c-format
 msgid "bad address at %s line %d"
 msgstr ""
 
 # @Simon: Here I need an example to understand it :)
-#: cache.c:669 dhcp.c:696
+#: cache.c:745 dhcp.c:715
 #, c-format
 msgid "bad name at %s line %d"
 msgstr ""
 
 # @Simon: Here I need an example to understand it :)
-#: cache.c:675 dhcp.c:750
+#: cache.c:752 dhcp.c:769
 #, c-format
 msgid "read %s - %d addresses"
 msgstr "lese %s - %d Adressen"
 
 # @Simon: 'lese' is present, is that ok? If it should be past, it would be
 # @Simon: "gelesen: %s - %d Adressen" - note the colon, it's a must, then.
-#: cache.c:711
+#: cache.c:790
 msgid "cleared cache"
 msgstr "Cache geleert"
 
 # @Simon: "Cache geleert" is literally "Cache emptied" but I think other translations could be misleading
 # @Simon: (I don't know a good german replacement for "Cache" but AFAIK "Cache" is common in german)
-#: cache.c:764
+#: cache.c:843
 #, c-format
 msgid ""
 "not giving name %s to the DHCP lease of %s because the name exists in %s "
@@ -56,7 +56,7 @@
 
 # @Simon: "Mieter" is rather 'logder, renter, tenant, lessee' but I couldn't find anything that fits better.
 # @Simon: So I thought I put it in ''-marks :)
-#: cache.c:808
+#: cache.c:887
 #, fuzzy, c-format
 msgid ""
 "time %lu, cache size %d, %d/%d cache insertions re-used unexpired cache "
@@ -796,47 +796,47 @@
 msgid "failed to set options on DHCP socket: %s"
 msgstr ""
 
-#: dhcp.c:48
-#, c-format
-msgid "failed to set SO_REUSEADDR on DHCP socket: %s"
-msgstr ""
-
 #: dhcp.c:59
 #, c-format
-msgid "failed to bind DHCP server socket: %s"
+msgid "failed to set SO_REUSE{ADDR|PORT} on DHCP socket: %s"
 msgstr ""
 
 #: dhcp.c:72
 #, c-format
+msgid "failed to bind DHCP server socket: %s"
+msgstr ""
+
+#: dhcp.c:85
+#, c-format
 msgid "cannot create ICMP raw socket: %s."
 msgstr ""
 
-#: dhcp.c:84
+#: dhcp.c:97
 #, c-format
 msgid "duplicate IP address %s in dhcp-config directive."
 msgstr ""
 
-#: dhcp.c:317
+#: dhcp.c:336
 #, c-format
 msgid "DHCP range %s -- %s is not consistent with netmask %s"
 msgstr ""
 
-#: dhcp.c:634
+#: dhcp.c:653
 #, c-format
 msgid "failed to read %s:%m"
 msgstr ""
 
-#: dhcp.c:669
+#: dhcp.c:688
 #, c-format
 msgid "bad line at %s line %d"
 msgstr ""
 
-#: dhcp.c:776
+#: dhcp.c:795
 #, c-format
 msgid "duplicate IP address %s (%s) in dhcp-config directive"
 msgstr ""
 
-#: dhcp.c:812
+#: dhcp.c:831
 #, c-format
 msgid "Ignoring DHCP host name %s because it has an illegal domain part"
 msgstr ""
@@ -882,7 +882,7 @@
 msgid "disabled"
 msgstr ""
 
-#: rfc2131.c:324 rfc2131.c:759
+#: rfc2131.c:324 rfc2131.c:762
 msgid "address in use"
 msgstr ""
 
@@ -894,11 +894,11 @@
 msgid "no address available"
 msgstr ""
 
-#: rfc2131.c:349 rfc2131.c:767
+#: rfc2131.c:349 rfc2131.c:772
 msgid "no leases left"
 msgstr ""
 
-#: rfc2131.c:352 rfc2131.c:733
+#: rfc2131.c:352 rfc2131.c:736
 msgid "wrong network"
 msgstr ""
 
@@ -911,7 +911,7 @@
 msgid "unknown lease"
 msgstr ""
 
-#: rfc2131.c:589 rfc2131.c:862
+#: rfc2131.c:589 rfc2131.c:873
 msgid "ignored"
 msgstr ""
 
@@ -931,36 +931,36 @@
 msgid "not using configured address %s because it was previously declined"
 msgstr ""
 
-#: rfc2131.c:696
+#: rfc2131.c:699
 msgid "wrong address"
 msgstr ""
 
-#: rfc2131.c:709
+#: rfc2131.c:712
 msgid "lease not found"
 msgstr ""
 
-#: rfc2131.c:741
+#: rfc2131.c:744
 msgid "address not available"
 msgstr ""
 
-#: rfc2131.c:752
+#: rfc2131.c:755
 msgid "static lease available"
 msgstr ""
 
-#: rfc2131.c:756
+#: rfc2131.c:759
 msgid "address reserved"
 msgstr ""
 
-#: rfc2131.c:762
+#: rfc2131.c:765
 msgid "no unique-id"
 msgstr ""
 
-#: rfc2131.c:1000
+#: rfc2131.c:1011
 #, c-format
 msgid "cannot send DHCP option %d: no space left in packet"
 msgstr ""
 
-#: rfc2131.c:1301
+#: rfc2131.c:1312
 #, c-format
 msgid "More than one vendor class matches, using %s"
 msgstr ""
diff --git a/po/es.po b/po/es.po
index 86bb66d..7a0c12c 100644
--- a/po/es.po
+++ b/po/es.po
@@ -6,7 +6,7 @@
 msgstr ""
 "Project-Id-Version: dnsmasq 2.24\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2006-10-13 18:20+0100\n"
+"POT-Creation-Date: 2006-10-28 15:42+0100\n"
 "PO-Revision-Date: 2005-10-07 11:04+0100\n"
 "Last-Translator: Christopher Chatham <chrislinux@gmail.com>\n"
 "Language-Team: Spanish <es@li.org>\n"
@@ -15,31 +15,31 @@
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=2; plural=(n != 1);\n"
 
-#: cache.c:606
+#: cache.c:665
 #, c-format
 msgid "failed to load names from %s: %m"
 msgstr "no se pudo cargar nombres desde %s: %m"
 
-#: cache.c:642 dhcp.c:682
+#: cache.c:699 dhcp.c:701
 #, fuzzy, c-format
 msgid "bad address at %s line %d"
 msgstr "nombre erróneo en %s línea %d"
 
-#: cache.c:669 dhcp.c:696
+#: cache.c:745 dhcp.c:715
 #, c-format
 msgid "bad name at %s line %d"
 msgstr "nombre erróneo en %s línea %d"
 
-#: cache.c:675 dhcp.c:750
+#: cache.c:752 dhcp.c:769
 #, c-format
 msgid "read %s - %d addresses"
 msgstr "direcciónes %s - %d leídas"
 
-#: cache.c:711
+#: cache.c:790
 msgid "cleared cache"
 msgstr "el caché fue liberado"
 
-#: cache.c:764
+#: cache.c:843
 #, c-format
 msgid ""
 "not giving name %s to the DHCP lease of %s because the name exists in %s "
@@ -48,7 +48,7 @@
 "no otorgando nombre %s al arriendo DHCP de %s porque el nombre existe en %s "
 "con dirección %s"
 
-#: cache.c:808
+#: cache.c:887
 #, fuzzy, c-format
 msgid ""
 "time %lu, cache size %d, %d/%d cache insertions re-used unexpired cache "
@@ -773,47 +773,47 @@
 msgid "failed to set options on DHCP socket: %s"
 msgstr "no se pudo fijar opciones en socket DHCP: %s"
 
-#: dhcp.c:48
-#, c-format
-msgid "failed to set SO_REUSEADDR on DHCP socket: %s"
+#: dhcp.c:59
+#, fuzzy, c-format
+msgid "failed to set SO_REUSE{ADDR|PORT} on DHCP socket: %s"
 msgstr "no se pudo fijar SO_REUSEADDR en socket DHCP: %s"
 
-#: dhcp.c:59
+#: dhcp.c:72
 #, c-format
 msgid "failed to bind DHCP server socket: %s"
 msgstr "no se pudo acoplar socket de servidor DHCP: %s"
 
-#: dhcp.c:72
+#: dhcp.c:85
 #, c-format
 msgid "cannot create ICMP raw socket: %s."
 msgstr "no se puede crear socket crudo ICMP: %s."
 
-#: dhcp.c:84
+#: dhcp.c:97
 #, c-format
 msgid "duplicate IP address %s in dhcp-config directive."
 msgstr "dirección IP duplicada en directiva dhcp-config."
 
-#: dhcp.c:317
+#: dhcp.c:336
 #, c-format
 msgid "DHCP range %s -- %s is not consistent with netmask %s"
 msgstr "rango DHCP %s -- %s no coincide con máscara de subred %s"
 
-#: dhcp.c:634
+#: dhcp.c:653
 #, c-format
 msgid "failed to read %s:%m"
 msgstr "no se pudo leer %s:%m"
 
-#: dhcp.c:669
+#: dhcp.c:688
 #, fuzzy, c-format
 msgid "bad line at %s line %d"
 msgstr "nombre erróneo en %s línea %d"
 
-#: dhcp.c:776
+#: dhcp.c:795
 #, c-format
 msgid "duplicate IP address %s (%s) in dhcp-config directive"
 msgstr "dirección IP duplicada %s (%s) en directiva dhcp-config"
 
-#: dhcp.c:812
+#: dhcp.c:831
 #, c-format
 msgid "Ignoring DHCP host name %s because it has an illegal domain part"
 msgstr ""
@@ -860,7 +860,7 @@
 msgid "disabled"
 msgstr "deshabilitado"
 
-#: rfc2131.c:324 rfc2131.c:759
+#: rfc2131.c:324 rfc2131.c:762
 msgid "address in use"
 msgstr "dirección en uso"
 
@@ -872,11 +872,11 @@
 msgid "no address available"
 msgstr "ninguna dirección disponible"
 
-#: rfc2131.c:349 rfc2131.c:767
+#: rfc2131.c:349 rfc2131.c:772
 msgid "no leases left"
 msgstr "no queda ningún arriendo"
 
-#: rfc2131.c:352 rfc2131.c:733
+#: rfc2131.c:352 rfc2131.c:736
 msgid "wrong network"
 msgstr "red equivocada"
 
@@ -889,7 +889,7 @@
 msgid "unknown lease"
 msgstr "arriendo desconocido"
 
-#: rfc2131.c:589 rfc2131.c:862
+#: rfc2131.c:589 rfc2131.c:873
 msgid "ignored"
 msgstr "ignorado"
 
@@ -910,36 +910,36 @@
 msgid "not using configured address %s because it was previously declined"
 msgstr "no usando dirección configurada %s porque esta arriendada a %s"
 
-#: rfc2131.c:696
+#: rfc2131.c:699
 msgid "wrong address"
 msgstr "dirección equivocada"
 
-#: rfc2131.c:709
+#: rfc2131.c:712
 msgid "lease not found"
 msgstr "arriendo no encontrado"
 
-#: rfc2131.c:741
+#: rfc2131.c:744
 msgid "address not available"
 msgstr "dirección no disponible"
 
-#: rfc2131.c:752
+#: rfc2131.c:755
 msgid "static lease available"
 msgstr "arriendo estático disponible"
 
-#: rfc2131.c:756
+#: rfc2131.c:759
 msgid "address reserved"
 msgstr "dirección reservada"
 
-#: rfc2131.c:762
+#: rfc2131.c:765
 msgid "no unique-id"
 msgstr "ningún unique-id (ID único)"
 
-#: rfc2131.c:1000
+#: rfc2131.c:1011
 #, c-format
 msgid "cannot send DHCP option %d: no space left in packet"
 msgstr "no se puede enviar opción DHCP %d: no queda espacio en el paquete"
 
-#: rfc2131.c:1301
+#: rfc2131.c:1312
 #, c-format
 msgid "More than one vendor class matches, using %s"
 msgstr "Más de una clase de vendedor coincide, usando %s"
diff --git a/po/fi.po b/po/fi.po
index 8cf82de..cd7145c 100644
--- a/po/fi.po
+++ b/po/fi.po
@@ -6,7 +6,7 @@
 msgstr ""
 "Project-Id-Version: dnsmasq 2.24\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2006-10-13 18:20+0100\n"
+"POT-Creation-Date: 2006-10-28 15:42+0100\n"
 "PO-Revision-Date: 2005-11-28 22:05+0000\n"
 "Last-Translator: Simon Kelley <simon@thekelleys.org.uk>\n"
 "Language-Team: Finnish <translation-team-fi@lists.sourceforge.net>\n"
@@ -15,38 +15,38 @@
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=2; plural=(n != 1);\n"
 
-#: cache.c:606
+#: cache.c:665
 #, c-format
 msgid "failed to load names from %s: %m"
 msgstr ""
 
-#: cache.c:642 dhcp.c:682
+#: cache.c:699 dhcp.c:701
 #, c-format
 msgid "bad address at %s line %d"
 msgstr ""
 
-#: cache.c:669 dhcp.c:696
+#: cache.c:745 dhcp.c:715
 #, c-format
 msgid "bad name at %s line %d"
 msgstr ""
 
-#: cache.c:675 dhcp.c:750
+#: cache.c:752 dhcp.c:769
 #, c-format
 msgid "read %s - %d addresses"
 msgstr ""
 
-#: cache.c:711
+#: cache.c:790
 msgid "cleared cache"
 msgstr ""
 
-#: cache.c:764
+#: cache.c:843
 #, c-format
 msgid ""
 "not giving name %s to the DHCP lease of %s because the name exists in %s "
 "with address %s"
 msgstr ""
 
-#: cache.c:808
+#: cache.c:887
 #, c-format
 msgid ""
 "time %lu, cache size %d, %d/%d cache insertions re-used unexpired cache "
@@ -747,47 +747,47 @@
 msgid "failed to set options on DHCP socket: %s"
 msgstr ""
 
-#: dhcp.c:48
-#, c-format
-msgid "failed to set SO_REUSEADDR on DHCP socket: %s"
-msgstr ""
-
 #: dhcp.c:59
 #, c-format
-msgid "failed to bind DHCP server socket: %s"
+msgid "failed to set SO_REUSE{ADDR|PORT} on DHCP socket: %s"
 msgstr ""
 
 #: dhcp.c:72
 #, c-format
+msgid "failed to bind DHCP server socket: %s"
+msgstr ""
+
+#: dhcp.c:85
+#, c-format
 msgid "cannot create ICMP raw socket: %s."
 msgstr ""
 
-#: dhcp.c:84
+#: dhcp.c:97
 #, c-format
 msgid "duplicate IP address %s in dhcp-config directive."
 msgstr ""
 
-#: dhcp.c:317
+#: dhcp.c:336
 #, c-format
 msgid "DHCP range %s -- %s is not consistent with netmask %s"
 msgstr ""
 
-#: dhcp.c:634
+#: dhcp.c:653
 #, c-format
 msgid "failed to read %s:%m"
 msgstr ""
 
-#: dhcp.c:669
+#: dhcp.c:688
 #, c-format
 msgid "bad line at %s line %d"
 msgstr ""
 
-#: dhcp.c:776
+#: dhcp.c:795
 #, c-format
 msgid "duplicate IP address %s (%s) in dhcp-config directive"
 msgstr ""
 
-#: dhcp.c:812
+#: dhcp.c:831
 #, c-format
 msgid "Ignoring DHCP host name %s because it has an illegal domain part"
 msgstr ""
@@ -833,7 +833,7 @@
 msgid "disabled"
 msgstr ""
 
-#: rfc2131.c:324 rfc2131.c:759
+#: rfc2131.c:324 rfc2131.c:762
 msgid "address in use"
 msgstr ""
 
@@ -845,11 +845,11 @@
 msgid "no address available"
 msgstr ""
 
-#: rfc2131.c:349 rfc2131.c:767
+#: rfc2131.c:349 rfc2131.c:772
 msgid "no leases left"
 msgstr ""
 
-#: rfc2131.c:352 rfc2131.c:733
+#: rfc2131.c:352 rfc2131.c:736
 msgid "wrong network"
 msgstr ""
 
@@ -862,7 +862,7 @@
 msgid "unknown lease"
 msgstr ""
 
-#: rfc2131.c:589 rfc2131.c:862
+#: rfc2131.c:589 rfc2131.c:873
 msgid "ignored"
 msgstr ""
 
@@ -882,36 +882,36 @@
 msgid "not using configured address %s because it was previously declined"
 msgstr ""
 
-#: rfc2131.c:696
+#: rfc2131.c:699
 msgid "wrong address"
 msgstr ""
 
-#: rfc2131.c:709
+#: rfc2131.c:712
 msgid "lease not found"
 msgstr ""
 
-#: rfc2131.c:741
+#: rfc2131.c:744
 msgid "address not available"
 msgstr ""
 
-#: rfc2131.c:752
+#: rfc2131.c:755
 msgid "static lease available"
 msgstr ""
 
-#: rfc2131.c:756
+#: rfc2131.c:759
 msgid "address reserved"
 msgstr ""
 
-#: rfc2131.c:762
+#: rfc2131.c:765
 msgid "no unique-id"
 msgstr ""
 
-#: rfc2131.c:1000
+#: rfc2131.c:1011
 #, c-format
 msgid "cannot send DHCP option %d: no space left in packet"
 msgstr ""
 
-#: rfc2131.c:1301
+#: rfc2131.c:1312
 #, c-format
 msgid "More than one vendor class matches, using %s"
 msgstr ""
diff --git a/po/fr.po b/po/fr.po
index 884d067..5ca9381 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -7,7 +7,7 @@
 msgstr ""
 "Project-Id-Version: dnsmasq 2.34\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2006-10-13 18:20+0100\n"
+"POT-Creation-Date: 2006-10-28 15:42+0100\n"
 "PO-Revision-Date: 2005-10-02 19:05+0100\n"
 "Last-Translator:  Lionel Tricon <lionel.tricon@free.fr>\n"
 "Language-Team: French <traduc@traduc.org>\n"
@@ -16,31 +16,31 @@
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=2; plural=(n > 1);\n"
 
-#: cache.c:606
+#: cache.c:665
 #, c-format
 msgid "failed to load names from %s: %m"
 msgstr "Impossible de charger les noms à partir de %s : %m"
 
-#: cache.c:642 dhcp.c:682
+#: cache.c:699 dhcp.c:701
 #, c-format
 msgid "bad address at %s line %d"
 msgstr "mauvaise adresse dans %s ligne %d"
 
-#: cache.c:669 dhcp.c:696
+#: cache.c:745 dhcp.c:715
 #, c-format
 msgid "bad name at %s line %d"
 msgstr "mauvais nom dans %s ligne %d"
 
-#: cache.c:675 dhcp.c:750
+#: cache.c:752 dhcp.c:769
 #, c-format
 msgid "read %s - %d addresses"
 msgstr "lecture %s - %d adresses"
 
-#: cache.c:711
+#: cache.c:790
 msgid "cleared cache"
 msgstr "cache vidé"
 
-#: cache.c:764
+#: cache.c:843
 #, c-format
 msgid ""
 "not giving name %s to the DHCP lease of %s because the name exists in %s "
@@ -49,7 +49,7 @@
 "ne donne pas de nom %s au bail DHCP de %s parce-que le nom existe dans %s "
 "avec l'adresse %s"
 
-#: cache.c:808
+#: cache.c:887
 #, c-format
 msgid ""
 "time %lu, cache size %d, %d/%d cache insertions re-used unexpired cache "
@@ -793,49 +793,49 @@
 msgid "failed to set options on DHCP socket: %s"
 msgstr "impossible d'appliquer les options sur la socket DHCP : %s"
 
-#: dhcp.c:48
-#, c-format
-msgid "failed to set SO_REUSEADDR on DHCP socket: %s"
+#: dhcp.c:59
+#, fuzzy, c-format
+msgid "failed to set SO_REUSE{ADDR|PORT} on DHCP socket: %s"
 msgstr "impossible de déclarer SO_REUSEADDR sur la socket DHCP : %s"
 
-#: dhcp.c:59
+#: dhcp.c:72
 #, c-format
 msgid "failed to bind DHCP server socket: %s"
 msgstr "impossible de lier la socket serveur DHCP : %s"
 
-#: dhcp.c:72
+#: dhcp.c:85
 #, c-format
 msgid "cannot create ICMP raw socket: %s."
 msgstr "ne peut créer de socket en mode raw pour ICMP : %s."
 
-#: dhcp.c:84
+#: dhcp.c:97
 #, c-format
 msgid "duplicate IP address %s in dhcp-config directive."
 msgstr "adresse IP %s dupliquée dans la directive dhcp-config."
 
-#: dhcp.c:317
+#: dhcp.c:336
 #, c-format
 msgid "DHCP range %s -- %s is not consistent with netmask %s"
 msgstr ""
 "La plage d'adresses DHCP %s -- %s n'est pas cohérente avec le masque de "
 "réseau %s"
 
-#: dhcp.c:634
+#: dhcp.c:653
 #, c-format
 msgid "failed to read %s:%m"
 msgstr "impossible de lire %s : %m"
 
-#: dhcp.c:669
+#: dhcp.c:688
 #, fuzzy, c-format
 msgid "bad line at %s line %d"
 msgstr "mauvais nom dans %s ligne %d"
 
-#: dhcp.c:776
+#: dhcp.c:795
 #, c-format
 msgid "duplicate IP address %s (%s) in dhcp-config directive"
 msgstr "adresse IP %s (%s) dupliquée dans la directive dhcp-config."
 
-#: dhcp.c:812
+#: dhcp.c:831
 #, c-format
 msgid "Ignoring DHCP host name %s because it has an illegal domain part"
 msgstr ""
@@ -883,7 +883,7 @@
 msgid "disabled"
 msgstr "désactivé"
 
-#: rfc2131.c:324 rfc2131.c:759
+#: rfc2131.c:324 rfc2131.c:762
 msgid "address in use"
 msgstr "adresse déjà utilisée"
 
@@ -895,11 +895,11 @@
 msgid "no address available"
 msgstr "pas d'adresse disponible"
 
-#: rfc2131.c:349 rfc2131.c:767
+#: rfc2131.c:349 rfc2131.c:772
 msgid "no leases left"
 msgstr "plus aucun bail disponible"
 
-#: rfc2131.c:352 rfc2131.c:733
+#: rfc2131.c:352 rfc2131.c:736
 msgid "wrong network"
 msgstr "mauvais réseau"
 
@@ -912,7 +912,7 @@
 msgid "unknown lease"
 msgstr "bail inconnu"
 
-#: rfc2131.c:589 rfc2131.c:862
+#: rfc2131.c:589 rfc2131.c:873
 msgid "ignored"
 msgstr "ignoré"
 
@@ -937,37 +937,37 @@
 "L'adresse statique %s ne sera pas utilisée car elle a préalablement été "
 "refusée"
 
-#: rfc2131.c:696
+#: rfc2131.c:699
 msgid "wrong address"
 msgstr "mauvaise adresse"
 
-#: rfc2131.c:709
+#: rfc2131.c:712
 msgid "lease not found"
 msgstr "bail non trouvé"
 
-#: rfc2131.c:741
+#: rfc2131.c:744
 msgid "address not available"
 msgstr "adresse non disponible"
 
-#: rfc2131.c:752
+#: rfc2131.c:755
 msgid "static lease available"
 msgstr "bail statique disponible"
 
-#: rfc2131.c:756
+#: rfc2131.c:759
 msgid "address reserved"
 msgstr "adresse reservée"
 
-#: rfc2131.c:762
+#: rfc2131.c:765
 msgid "no unique-id"
 msgstr "pas d'identifiant unique"
 
-#: rfc2131.c:1000
+#: rfc2131.c:1011
 #, c-format
 msgid "cannot send DHCP option %d: no space left in packet"
 msgstr ""
 "Impossible d'envoyer l'option DHCP %d : pas assez d'espace dans le paquet"
 
-#: rfc2131.c:1301
+#: rfc2131.c:1312
 #, c-format
 msgid "More than one vendor class matches, using %s"
 msgstr "Plusieurs classes de fournisseurs correspondent, %s sera utilisé"
diff --git a/po/id.po b/po/id.po
index e605a3c..41ffa18 100644
--- a/po/id.po
+++ b/po/id.po
@@ -6,7 +6,7 @@
 msgstr ""
 "Project-Id-Version: dnsmasq 2.24\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2006-10-13 18:20+0100\n"
+"POT-Creation-Date: 2006-10-28 15:42+0100\n"
 "PO-Revision-Date: 2005-10-07 11:45+0100\n"
 "Last-Translator: Salman AS <sas@salman.or.id>\n"
 "Language-Team: Indonesian <translation-team-id@lists.sourceforge.net>\n"
@@ -15,36 +15,36 @@
 "Content-Transfer-Encoding: 8bit\n"
 
 # OK
-#: cache.c:606
+#: cache.c:665
 #, c-format
 msgid "failed to load names from %s: %m"
 msgstr "gagal memuat nama-nama dari %s: %m"
 
 # OK
-#: cache.c:642 dhcp.c:682
+#: cache.c:699 dhcp.c:701
 #, fuzzy, c-format
 msgid "bad address at %s line %d"
 msgstr "kesalahan nama pada %s baris %d"
 
 # OK
-#: cache.c:669 dhcp.c:696
+#: cache.c:745 dhcp.c:715
 #, c-format
 msgid "bad name at %s line %d"
 msgstr "kesalahan nama pada %s baris %d"
 
 # OK
-#: cache.c:675 dhcp.c:750
+#: cache.c:752 dhcp.c:769
 #, c-format
 msgid "read %s - %d addresses"
 msgstr "membaca %s - %d alamat"
 
 # OK
-#: cache.c:711
+#: cache.c:790
 msgid "cleared cache"
 msgstr "cache telah dihapus"
 
 # OK
-#: cache.c:764
+#: cache.c:843
 #, c-format
 msgid ""
 "not giving name %s to the DHCP lease of %s because the name exists in %s "
@@ -54,7 +54,7 @@
 "sdengan alamat %s"
 
 # OK
-#: cache.c:808
+#: cache.c:887
 #, fuzzy, c-format
 msgid ""
 "time %lu, cache size %d, %d/%d cache insertions re-used unexpired cache "
@@ -915,55 +915,55 @@
 msgstr "gagal menyetel opsi pada socket DHCP: %s"
 
 # OK
-#: dhcp.c:48
-#, c-format
-msgid "failed to set SO_REUSEADDR on DHCP socket: %s"
+#: dhcp.c:59
+#, fuzzy, c-format
+msgid "failed to set SO_REUSE{ADDR|PORT} on DHCP socket: %s"
 msgstr "gagal menyetel SO_REUSEADDR pada socket DHCP: %s"
 
 # OK
-#: dhcp.c:59
+#: dhcp.c:72
 #, c-format
 msgid "failed to bind DHCP server socket: %s"
 msgstr "gagal mem-bind socket server DHCP: %s"
 
 # OK
-#: dhcp.c:72
+#: dhcp.c:85
 #, c-format
 msgid "cannot create ICMP raw socket: %s."
 msgstr "tidak dapat membuat socket ICMP raw: %s"
 
 # OK
-#: dhcp.c:84
+#: dhcp.c:97
 #, c-format
 msgid "duplicate IP address %s in dhcp-config directive."
 msgstr "alamat IP kembar %s dalam direktif dhcp-config"
 
 # OK
-#: dhcp.c:317
+#: dhcp.c:336
 #, c-format
 msgid "DHCP range %s -- %s is not consistent with netmask %s"
 msgstr "jangkauan DHCP %s -- %s tidak konsisten dengan netmask %s"
 
 # OK
-#: dhcp.c:634
+#: dhcp.c:653
 #, c-format
 msgid "failed to read %s:%m"
 msgstr "gagal membaca %s:%m"
 
 # OK
-#: dhcp.c:669
+#: dhcp.c:688
 #, fuzzy, c-format
 msgid "bad line at %s line %d"
 msgstr "kesalahan nama pada %s baris %d"
 
 # OK
-#: dhcp.c:776
+#: dhcp.c:795
 #, c-format
 msgid "duplicate IP address %s (%s) in dhcp-config directive"
 msgstr "alamat IP kembar %s (%s) dalam direktif dhcp-config"
 
 # OK
-#: dhcp.c:812
+#: dhcp.c:831
 #, c-format
 msgid "Ignoring DHCP host name %s because it has an illegal domain part"
 msgstr ""
@@ -1019,7 +1019,7 @@
 msgstr "di disable"
 
 # OK
-#: rfc2131.c:324 rfc2131.c:759
+#: rfc2131.c:324 rfc2131.c:762
 msgid "address in use"
 msgstr "alamat telah digunakan"
 
@@ -1034,12 +1034,12 @@
 msgstr "tak ada alamat yang tersedia"
 
 # OK
-#: rfc2131.c:349 rfc2131.c:767
+#: rfc2131.c:349 rfc2131.c:772
 msgid "no leases left"
 msgstr "tak ada lease yang tersisa"
 
 # OK
-#: rfc2131.c:352 rfc2131.c:733
+#: rfc2131.c:352 rfc2131.c:736
 msgid "wrong network"
 msgstr "jaringan yang salah"
 
@@ -1055,7 +1055,7 @@
 msgstr "lease tidak diketahui"
 
 # OK
-#: rfc2131.c:589 rfc2131.c:862
+#: rfc2131.c:589 rfc2131.c:873
 msgid "ignored"
 msgstr "diabaikan"
 
@@ -1076,41 +1076,41 @@
 msgstr ""
 
 # OK
-#: rfc2131.c:696
+#: rfc2131.c:699
 msgid "wrong address"
 msgstr "alamat salah"
 
 # OK
-#: rfc2131.c:709
+#: rfc2131.c:712
 msgid "lease not found"
 msgstr "lease tak ditemukan"
 
 # OK
-#: rfc2131.c:741
+#: rfc2131.c:744
 msgid "address not available"
 msgstr "alamat tak tersedia"
 
 # OK
-#: rfc2131.c:752
+#: rfc2131.c:755
 msgid "static lease available"
 msgstr "lease statik tak tersedia"
 
 # OK
-#: rfc2131.c:756
+#: rfc2131.c:759
 msgid "address reserved"
 msgstr "alamat telah dipesan"
 
-#: rfc2131.c:762
+#: rfc2131.c:765
 msgid "no unique-id"
 msgstr ""
 
-#: rfc2131.c:1000
+#: rfc2131.c:1011
 #, c-format
 msgid "cannot send DHCP option %d: no space left in packet"
 msgstr ""
 
 # OK
-#: rfc2131.c:1301
+#: rfc2131.c:1312
 #, c-format
 msgid "More than one vendor class matches, using %s"
 msgstr "Lebih dari satu kelas vendor yang sesuai, menggunakan %s"
diff --git a/po/it.po b/po/it.po
index e7aed87..859ce74 100644
--- a/po/it.po
+++ b/po/it.po
@@ -6,7 +6,7 @@
 msgstr ""
 "Project-Id-Version: dnsmasq 2.32\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2006-10-13 18:20+0100\n"
+"POT-Creation-Date: 2006-10-28 15:42+0100\n"
 "PO-Revision-Date: 2006-05-22 11:09+0100\n"
 "Last-Translator: Simon Kelley <simon@thekelleys.org.uk>\n"
 "Language-Team: Italian <tp@lists.linux.it>\n"
@@ -15,38 +15,38 @@
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=2; plural=(n != 1);\n"
 
-#: cache.c:606
+#: cache.c:665
 #, c-format
 msgid "failed to load names from %s: %m"
 msgstr ""
 
-#: cache.c:642 dhcp.c:682
+#: cache.c:699 dhcp.c:701
 #, c-format
 msgid "bad address at %s line %d"
 msgstr ""
 
-#: cache.c:669 dhcp.c:696
+#: cache.c:745 dhcp.c:715
 #, c-format
 msgid "bad name at %s line %d"
 msgstr ""
 
-#: cache.c:675 dhcp.c:750
+#: cache.c:752 dhcp.c:769
 #, c-format
 msgid "read %s - %d addresses"
 msgstr ""
 
-#: cache.c:711
+#: cache.c:790
 msgid "cleared cache"
 msgstr ""
 
-#: cache.c:764
+#: cache.c:843
 #, c-format
 msgid ""
 "not giving name %s to the DHCP lease of %s because the name exists in %s "
 "with address %s"
 msgstr ""
 
-#: cache.c:808
+#: cache.c:887
 #, c-format
 msgid ""
 "time %lu, cache size %d, %d/%d cache insertions re-used unexpired cache "
@@ -747,47 +747,47 @@
 msgid "failed to set options on DHCP socket: %s"
 msgstr ""
 
-#: dhcp.c:48
-#, c-format
-msgid "failed to set SO_REUSEADDR on DHCP socket: %s"
-msgstr ""
-
 #: dhcp.c:59
 #, c-format
-msgid "failed to bind DHCP server socket: %s"
+msgid "failed to set SO_REUSE{ADDR|PORT} on DHCP socket: %s"
 msgstr ""
 
 #: dhcp.c:72
 #, c-format
+msgid "failed to bind DHCP server socket: %s"
+msgstr ""
+
+#: dhcp.c:85
+#, c-format
 msgid "cannot create ICMP raw socket: %s."
 msgstr ""
 
-#: dhcp.c:84
+#: dhcp.c:97
 #, c-format
 msgid "duplicate IP address %s in dhcp-config directive."
 msgstr ""
 
-#: dhcp.c:317
+#: dhcp.c:336
 #, c-format
 msgid "DHCP range %s -- %s is not consistent with netmask %s"
 msgstr ""
 
-#: dhcp.c:634
+#: dhcp.c:653
 #, c-format
 msgid "failed to read %s:%m"
 msgstr ""
 
-#: dhcp.c:669
+#: dhcp.c:688
 #, c-format
 msgid "bad line at %s line %d"
 msgstr ""
 
-#: dhcp.c:776
+#: dhcp.c:795
 #, c-format
 msgid "duplicate IP address %s (%s) in dhcp-config directive"
 msgstr ""
 
-#: dhcp.c:812
+#: dhcp.c:831
 #, c-format
 msgid "Ignoring DHCP host name %s because it has an illegal domain part"
 msgstr ""
@@ -833,7 +833,7 @@
 msgid "disabled"
 msgstr ""
 
-#: rfc2131.c:324 rfc2131.c:759
+#: rfc2131.c:324 rfc2131.c:762
 msgid "address in use"
 msgstr ""
 
@@ -845,11 +845,11 @@
 msgid "no address available"
 msgstr ""
 
-#: rfc2131.c:349 rfc2131.c:767
+#: rfc2131.c:349 rfc2131.c:772
 msgid "no leases left"
 msgstr ""
 
-#: rfc2131.c:352 rfc2131.c:733
+#: rfc2131.c:352 rfc2131.c:736
 msgid "wrong network"
 msgstr ""
 
@@ -862,7 +862,7 @@
 msgid "unknown lease"
 msgstr ""
 
-#: rfc2131.c:589 rfc2131.c:862
+#: rfc2131.c:589 rfc2131.c:873
 msgid "ignored"
 msgstr ""
 
@@ -882,36 +882,36 @@
 msgid "not using configured address %s because it was previously declined"
 msgstr ""
 
-#: rfc2131.c:696
+#: rfc2131.c:699
 msgid "wrong address"
 msgstr ""
 
-#: rfc2131.c:709
+#: rfc2131.c:712
 msgid "lease not found"
 msgstr ""
 
-#: rfc2131.c:741
+#: rfc2131.c:744
 msgid "address not available"
 msgstr ""
 
-#: rfc2131.c:752
+#: rfc2131.c:755
 msgid "static lease available"
 msgstr ""
 
-#: rfc2131.c:756
+#: rfc2131.c:759
 msgid "address reserved"
 msgstr ""
 
-#: rfc2131.c:762
+#: rfc2131.c:765
 msgid "no unique-id"
 msgstr ""
 
-#: rfc2131.c:1000
+#: rfc2131.c:1011
 #, c-format
 msgid "cannot send DHCP option %d: no space left in packet"
 msgstr ""
 
-#: rfc2131.c:1301
+#: rfc2131.c:1312
 #, c-format
 msgid "More than one vendor class matches, using %s"
 msgstr ""
diff --git a/po/no.po b/po/no.po
index c2b4545..462c35d 100644
--- a/po/no.po
+++ b/po/no.po
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: dnsmasq 2.25\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2006-10-13 18:20+0100\n"
+"POT-Creation-Date: 2006-10-28 15:42+0100\n"
 "PO-Revision-Date: 2006-01-11 17:39+0000\n"
 "Last-Translator: Jan Erik Askildt <jeaskildt@gmail.com>\n"
 "Language-Team: Norwegian <i18n-nb@lister.ping.uio.no>\n"
@@ -17,31 +17,31 @@
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=2; plural=(n != 1);\n"
 
-#: cache.c:606
+#: cache.c:665
 #, c-format
 msgid "failed to load names from %s: %m"
 msgstr "feilet å laste navn fra %s: %m"
 
-#: cache.c:642 dhcp.c:682
+#: cache.c:699 dhcp.c:701
 #, c-format
 msgid "bad address at %s line %d"
 msgstr "dårlig adresse ved %s linje %d"
 
-#: cache.c:669 dhcp.c:696
+#: cache.c:745 dhcp.c:715
 #, c-format
 msgid "bad name at %s line %d"
 msgstr "dårlig navn ved %s linje %d"
 
-#: cache.c:675 dhcp.c:750
+#: cache.c:752 dhcp.c:769
 #, c-format
 msgid "read %s - %d addresses"
 msgstr "les %s - %d adresser"
 
-#: cache.c:711
+#: cache.c:790
 msgid "cleared cache"
 msgstr "mellomlager tømt"
 
-#: cache.c:764
+#: cache.c:843
 #, c-format
 msgid ""
 "not giving name %s to the DHCP lease of %s because the name exists in %s "
@@ -50,7 +50,7 @@
 "gir ikke navnet %s til DHCP leien for %s fordi navnet eksisterer i %s med "
 "adressen %s"
 
-#: cache.c:808
+#: cache.c:887
 #, fuzzy, c-format
 msgid ""
 "time %lu, cache size %d, %d/%d cache insertions re-used unexpired cache "
@@ -760,47 +760,47 @@
 msgid "failed to set options on DHCP socket: %s"
 msgstr "feilet å sette opsjoner på DHCP socket: %s"
 
-#: dhcp.c:48
-#, c-format
-msgid "failed to set SO_REUSEADDR on DHCP socket: %s"
+#: dhcp.c:59
+#, fuzzy, c-format
+msgid "failed to set SO_REUSE{ADDR|PORT} on DHCP socket: %s"
 msgstr "feilet å sette SO_REUSEADDR på DHCP socket: %s"
 
-#: dhcp.c:59
+#: dhcp.c:72
 #, c-format
 msgid "failed to bind DHCP server socket: %s"
 msgstr "feilet å binde DHCP tjener socket: %s"
 
-#: dhcp.c:72
+#: dhcp.c:85
 #, c-format
 msgid "cannot create ICMP raw socket: %s."
 msgstr "kan ikke lage ICMP raw socket: %s"
 
-#: dhcp.c:84
+#: dhcp.c:97
 #, c-format
 msgid "duplicate IP address %s in dhcp-config directive."
 msgstr "dubliserte IP adresser i %s dhcp-config direktiv."
 
-#: dhcp.c:317
+#: dhcp.c:336
 #, c-format
 msgid "DHCP range %s -- %s is not consistent with netmask %s"
 msgstr "DHCP område %s -- %s er ikke konsistent med nettmaske %s"
 
-#: dhcp.c:634
+#: dhcp.c:653
 #, c-format
 msgid "failed to read %s:%m"
 msgstr "feilet å lese %s:%m"
 
-#: dhcp.c:669
+#: dhcp.c:688
 #, c-format
 msgid "bad line at %s line %d"
 msgstr "dårlig linje ved %s linje %d"
 
-#: dhcp.c:776
+#: dhcp.c:795
 #, c-format
 msgid "duplicate IP address %s (%s) in dhcp-config directive"
 msgstr "dubliserte IP adresser i %s (%s) i dhcp-config direktiv"
 
-#: dhcp.c:812
+#: dhcp.c:831
 #, c-format
 msgid "Ignoring DHCP host name %s because it has an illegal domain part"
 msgstr "Ignorerer DHCP verts navn %s på grunn av ulovlig domene del"
@@ -846,7 +846,7 @@
 msgid "disabled"
 msgstr "deaktivert"
 
-#: rfc2131.c:324 rfc2131.c:759
+#: rfc2131.c:324 rfc2131.c:762
 msgid "address in use"
 msgstr "adresse i bruk"
 
@@ -858,11 +858,11 @@
 msgid "no address available"
 msgstr "ingen adresse tilgjengelig"
 
-#: rfc2131.c:349 rfc2131.c:767
+#: rfc2131.c:349 rfc2131.c:772
 msgid "no leases left"
 msgstr "ingen leier igjen"
 
-#: rfc2131.c:352 rfc2131.c:733
+#: rfc2131.c:352 rfc2131.c:736
 msgid "wrong network"
 msgstr "galt nettverk"
 
@@ -875,7 +875,7 @@
 msgid "unknown lease"
 msgstr "ukjent leie"
 
-#: rfc2131.c:589 rfc2131.c:862
+#: rfc2131.c:589 rfc2131.c:873
 msgid "ignored"
 msgstr "oversett"
 
@@ -895,36 +895,36 @@
 msgid "not using configured address %s because it was previously declined"
 msgstr ""
 
-#: rfc2131.c:696
+#: rfc2131.c:699
 msgid "wrong address"
 msgstr "gal adresse"
 
-#: rfc2131.c:709
+#: rfc2131.c:712
 msgid "lease not found"
 msgstr "leie ikke funnet"
 
-#: rfc2131.c:741
+#: rfc2131.c:744
 msgid "address not available"
 msgstr "adresse ikke tilgjengelig"
 
-#: rfc2131.c:752
+#: rfc2131.c:755
 msgid "static lease available"
 msgstr "statisk leie tilgjengelig"
 
-#: rfc2131.c:756
+#: rfc2131.c:759
 msgid "address reserved"
 msgstr "adresse reservert"
 
-#: rfc2131.c:762
+#: rfc2131.c:765
 msgid "no unique-id"
 msgstr ""
 
-#: rfc2131.c:1000
+#: rfc2131.c:1011
 #, c-format
 msgid "cannot send DHCP option %d: no space left in packet"
 msgstr "kan ikke sende DHCP opsjon %d: ikke mer plass i pakken"
 
-#: rfc2131.c:1301
+#: rfc2131.c:1312
 #, c-format
 msgid "More than one vendor class matches, using %s"
 msgstr "Mer enn en produsent klasse som passer, bruker %s"
diff --git a/po/pl.po b/po/pl.po
index 17f78af..ee47293 100644
--- a/po/pl.po
+++ b/po/pl.po
@@ -6,7 +6,7 @@
 msgstr ""
 "Project-Id-Version: dnsmasq 2.24\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2006-10-13 18:20+0100\n"
+"POT-Creation-Date: 2006-10-28 15:42+0100\n"
 "PO-Revision-Date: 2005-10-04 19:17+0100\n"
 "Last-Translator: Tomasz Sochañski <nerdhero@gmail.com>\n"
 "Language-Team: Polish <translation-team-pl@lists.sourceforge.net>\n"
@@ -16,31 +16,31 @@
 "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
 "|| n%100>=20) ? 1 : 2);\n"
 
-#: cache.c:606
+#: cache.c:665
 #, c-format
 msgid "failed to load names from %s: %m"
 msgstr "b³±d ³adowania nazw z %s: %m"
 
-#: cache.c:642 dhcp.c:682
+#: cache.c:699 dhcp.c:701
 #, fuzzy, c-format
 msgid "bad address at %s line %d"
 msgstr "b³êdna nazwa w %s, linia %d"
 
-#: cache.c:669 dhcp.c:696
+#: cache.c:745 dhcp.c:715
 #, c-format
 msgid "bad name at %s line %d"
 msgstr "b³êdna nazwa w %s, linia %d"
 
-#: cache.c:675 dhcp.c:750
+#: cache.c:752 dhcp.c:769
 #, c-format
 msgid "read %s - %d addresses"
 msgstr "przeczytano %s - %d adresów"
 
-#: cache.c:711
+#: cache.c:790
 msgid "cleared cache"
 msgstr "wyczyszczono cache"
 
-#: cache.c:764
+#: cache.c:843
 #, c-format
 msgid ""
 "not giving name %s to the DHCP lease of %s because the name exists in %s "
@@ -49,7 +49,7 @@
 "nazwa %s nie zosta³a nadana dzier¿awie DHCP %s, poniewa¿ nazwa istnieje w %s "
 "i ma adres %s"
 
-#: cache.c:808
+#: cache.c:887
 #, fuzzy, c-format
 msgid ""
 "time %lu, cache size %d, %d/%d cache insertions re-used unexpired cache "
@@ -772,47 +772,47 @@
 msgid "failed to set options on DHCP socket: %s"
 msgstr "b³±d ustawienia opcji gniazda DHCP: %s"
 
-#: dhcp.c:48
-#, c-format
-msgid "failed to set SO_REUSEADDR on DHCP socket: %s"
+#: dhcp.c:59
+#, fuzzy, c-format
+msgid "failed to set SO_REUSE{ADDR|PORT} on DHCP socket: %s"
 msgstr "b³±d ustawienia SO_REUSEADDR gniazda DHCP: %s"
 
-#: dhcp.c:59
+#: dhcp.c:72
 #, c-format
 msgid "failed to bind DHCP server socket: %s"
 msgstr "b³±d pod³±czenia gniazda serwera DHCP: %s"
 
-#: dhcp.c:72
+#: dhcp.c:85
 #, c-format
 msgid "cannot create ICMP raw socket: %s."
 msgstr "b³±d utworzenia surowego gniazda ICMP: %s."
 
-#: dhcp.c:84
+#: dhcp.c:97
 #, c-format
 msgid "duplicate IP address %s in dhcp-config directive."
 msgstr "powtórzenie adresu IP %s w opcji dhcp-config"
 
-#: dhcp.c:317
+#: dhcp.c:336
 #, c-format
 msgid "DHCP range %s -- %s is not consistent with netmask %s"
 msgstr "zakres DHCP %s -- %s jest niespójny z mask± sieciow± %s"
 
-#: dhcp.c:634
+#: dhcp.c:653
 #, c-format
 msgid "failed to read %s:%m"
 msgstr "b³±d odczytu %s:%m"
 
-#: dhcp.c:669
+#: dhcp.c:688
 #, fuzzy, c-format
 msgid "bad line at %s line %d"
 msgstr "b³êdna nazwa w %s, linia %d"
 
-#: dhcp.c:776
+#: dhcp.c:795
 #, c-format
 msgid "duplicate IP address %s (%s) in dhcp-config directive"
 msgstr "powtórzenie adresu IP %s (%s) w opcji dhcp-config"
 
-#: dhcp.c:812
+#: dhcp.c:831
 #, c-format
 msgid "Ignoring DHCP host name %s because it has an illegal domain part"
 msgstr ""
@@ -859,7 +859,7 @@
 msgid "disabled"
 msgstr "wy³±czony(a)"
 
-#: rfc2131.c:324 rfc2131.c:759
+#: rfc2131.c:324 rfc2131.c:762
 msgid "address in use"
 msgstr "adres w u¿yciu"
 
@@ -871,11 +871,11 @@
 msgid "no address available"
 msgstr "brak dostêpnego adresu"
 
-#: rfc2131.c:349 rfc2131.c:767
+#: rfc2131.c:349 rfc2131.c:772
 msgid "no leases left"
 msgstr "brak wolnych dzier¿aw"
 
-#: rfc2131.c:352 rfc2131.c:733
+#: rfc2131.c:352 rfc2131.c:736
 msgid "wrong network"
 msgstr "nieprawid³owa sieæ"
 
@@ -888,7 +888,7 @@
 msgid "unknown lease"
 msgstr "nieznana dzier¿awa"
 
-#: rfc2131.c:589 rfc2131.c:862
+#: rfc2131.c:589 rfc2131.c:873
 msgid "ignored"
 msgstr "ignorujê"
 
@@ -908,36 +908,36 @@
 msgid "not using configured address %s because it was previously declined"
 msgstr ""
 
-#: rfc2131.c:696
+#: rfc2131.c:699
 msgid "wrong address"
 msgstr "b³êdny adres"
 
-#: rfc2131.c:709
+#: rfc2131.c:712
 msgid "lease not found"
 msgstr "dzier¿awa nie znaleziona"
 
-#: rfc2131.c:741
+#: rfc2131.c:744
 msgid "address not available"
 msgstr "adres niedostêpny"
 
-#: rfc2131.c:752
+#: rfc2131.c:755
 msgid "static lease available"
 msgstr "dostêpna statyczna dzier¿awa"
 
-#: rfc2131.c:756
+#: rfc2131.c:759
 msgid "address reserved"
 msgstr "adres zarezerwowany"
 
-#: rfc2131.c:762
+#: rfc2131.c:765
 msgid "no unique-id"
 msgstr ""
 
-#: rfc2131.c:1000
+#: rfc2131.c:1011
 #, c-format
 msgid "cannot send DHCP option %d: no space left in packet"
 msgstr ""
 
-#: rfc2131.c:1301
+#: rfc2131.c:1312
 #, c-format
 msgid "More than one vendor class matches, using %s"
 msgstr "Wiêcej ni¿ jeden dystrybutor pasuj±cy, u¿ywam %s"
diff --git a/po/pt_BR.po b/po/pt_BR.po
index 218fb11..d47888d 100644
--- a/po/pt_BR.po
+++ b/po/pt_BR.po
@@ -6,7 +6,7 @@
 msgstr ""
 "Project-Id-Version: dnsmasq 2.26\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2006-10-13 18:20+0100\n"
+"POT-Creation-Date: 2006-10-28 15:42+0100\n"
 "PO-Revision-Date: 2006-01-16 20:42+0000\n"
 "Last-Translator: Simon Kelley <simon@thekelleys.org.uk>\n"
 "Language-Team: Portuguese <ldp-br@bazar.conectiva.com.br>\n"
@@ -15,38 +15,38 @@
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=2; plural=(n > 1);\n"
 
-#: cache.c:606
+#: cache.c:665
 #, c-format
 msgid "failed to load names from %s: %m"
 msgstr ""
 
-#: cache.c:642 dhcp.c:682
+#: cache.c:699 dhcp.c:701
 #, c-format
 msgid "bad address at %s line %d"
 msgstr ""
 
-#: cache.c:669 dhcp.c:696
+#: cache.c:745 dhcp.c:715
 #, c-format
 msgid "bad name at %s line %d"
 msgstr ""
 
-#: cache.c:675 dhcp.c:750
+#: cache.c:752 dhcp.c:769
 #, c-format
 msgid "read %s - %d addresses"
 msgstr ""
 
-#: cache.c:711
+#: cache.c:790
 msgid "cleared cache"
 msgstr ""
 
-#: cache.c:764
+#: cache.c:843
 #, c-format
 msgid ""
 "not giving name %s to the DHCP lease of %s because the name exists in %s "
 "with address %s"
 msgstr ""
 
-#: cache.c:808
+#: cache.c:887
 #, c-format
 msgid ""
 "time %lu, cache size %d, %d/%d cache insertions re-used unexpired cache "
@@ -747,47 +747,47 @@
 msgid "failed to set options on DHCP socket: %s"
 msgstr ""
 
-#: dhcp.c:48
-#, c-format
-msgid "failed to set SO_REUSEADDR on DHCP socket: %s"
-msgstr ""
-
 #: dhcp.c:59
 #, c-format
-msgid "failed to bind DHCP server socket: %s"
+msgid "failed to set SO_REUSE{ADDR|PORT} on DHCP socket: %s"
 msgstr ""
 
 #: dhcp.c:72
 #, c-format
+msgid "failed to bind DHCP server socket: %s"
+msgstr ""
+
+#: dhcp.c:85
+#, c-format
 msgid "cannot create ICMP raw socket: %s."
 msgstr ""
 
-#: dhcp.c:84
+#: dhcp.c:97
 #, c-format
 msgid "duplicate IP address %s in dhcp-config directive."
 msgstr ""
 
-#: dhcp.c:317
+#: dhcp.c:336
 #, c-format
 msgid "DHCP range %s -- %s is not consistent with netmask %s"
 msgstr ""
 
-#: dhcp.c:634
+#: dhcp.c:653
 #, c-format
 msgid "failed to read %s:%m"
 msgstr ""
 
-#: dhcp.c:669
+#: dhcp.c:688
 #, c-format
 msgid "bad line at %s line %d"
 msgstr ""
 
-#: dhcp.c:776
+#: dhcp.c:795
 #, c-format
 msgid "duplicate IP address %s (%s) in dhcp-config directive"
 msgstr ""
 
-#: dhcp.c:812
+#: dhcp.c:831
 #, c-format
 msgid "Ignoring DHCP host name %s because it has an illegal domain part"
 msgstr ""
@@ -833,7 +833,7 @@
 msgid "disabled"
 msgstr ""
 
-#: rfc2131.c:324 rfc2131.c:759
+#: rfc2131.c:324 rfc2131.c:762
 msgid "address in use"
 msgstr ""
 
@@ -845,11 +845,11 @@
 msgid "no address available"
 msgstr ""
 
-#: rfc2131.c:349 rfc2131.c:767
+#: rfc2131.c:349 rfc2131.c:772
 msgid "no leases left"
 msgstr ""
 
-#: rfc2131.c:352 rfc2131.c:733
+#: rfc2131.c:352 rfc2131.c:736
 msgid "wrong network"
 msgstr ""
 
@@ -862,7 +862,7 @@
 msgid "unknown lease"
 msgstr ""
 
-#: rfc2131.c:589 rfc2131.c:862
+#: rfc2131.c:589 rfc2131.c:873
 msgid "ignored"
 msgstr ""
 
@@ -882,36 +882,36 @@
 msgid "not using configured address %s because it was previously declined"
 msgstr ""
 
-#: rfc2131.c:696
+#: rfc2131.c:699
 msgid "wrong address"
 msgstr ""
 
-#: rfc2131.c:709
+#: rfc2131.c:712
 msgid "lease not found"
 msgstr ""
 
-#: rfc2131.c:741
+#: rfc2131.c:744
 msgid "address not available"
 msgstr ""
 
-#: rfc2131.c:752
+#: rfc2131.c:755
 msgid "static lease available"
 msgstr ""
 
-#: rfc2131.c:756
+#: rfc2131.c:759
 msgid "address reserved"
 msgstr ""
 
-#: rfc2131.c:762
+#: rfc2131.c:765
 msgid "no unique-id"
 msgstr ""
 
-#: rfc2131.c:1000
+#: rfc2131.c:1011
 #, c-format
 msgid "cannot send DHCP option %d: no space left in packet"
 msgstr ""
 
-#: rfc2131.c:1301
+#: rfc2131.c:1312
 #, c-format
 msgid "More than one vendor class matches, using %s"
 msgstr ""
diff --git a/po/ro.po b/po/ro.po
index 86840fd..43045c5 100644
--- a/po/ro.po
+++ b/po/ro.po
@@ -6,7 +6,7 @@
 msgstr ""
 "Project-Id-Version: dnsmasq 2.24\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2006-10-13 18:20+0100\n"
+"POT-Creation-Date: 2006-10-28 15:42+0100\n"
 "PO-Revision-Date: 2005-11-22 16:46+0000\n"
 "Last-Translator: Simon Kelley <simon@thekelleys.org.uk>\n"
 "Language-Team: Romanian <translation-team-ro@lists.sourceforge.net>\n"
@@ -15,31 +15,31 @@
 "Content-Transfer-Encoding: 8bit\n"
 
 # for compatibility purposes the letters â, ă, ş, ţ and î can be written as their look-alike correspondent.
-#: cache.c:606
+#: cache.c:665
 #, c-format
 msgid "failed to load names from %s: %m"
 msgstr "încărcarea numelor din %s: %m a eşuat"
 
-#: cache.c:642 dhcp.c:682
+#: cache.c:699 dhcp.c:701
 #, c-format
 msgid "bad address at %s line %d"
 msgstr "adresă greşită în %s, linia %d"
 
-#: cache.c:669 dhcp.c:696
+#: cache.c:745 dhcp.c:715
 #, c-format
 msgid "bad name at %s line %d"
 msgstr "nume greşit în %s linia %d"
 
-#: cache.c:675 dhcp.c:750
+#: cache.c:752 dhcp.c:769
 #, c-format
 msgid "read %s - %d addresses"
 msgstr "citesc %s - %d adrese"
 
-#: cache.c:711
+#: cache.c:790
 msgid "cleared cache"
 msgstr "memoria temporară a fost ştearsă"
 
-#: cache.c:764
+#: cache.c:843
 #, c-format
 msgid ""
 "not giving name %s to the DHCP lease of %s because the name exists in %s "
@@ -48,7 +48,7 @@
 "nu pot da numele %s împrumutului de adresă DHCP a lui %s deoarece "
 "numeleexistă în %s cu adresa %s"
 
-#: cache.c:808
+#: cache.c:887
 #, fuzzy, c-format
 msgid ""
 "time %lu, cache size %d, %d/%d cache insertions re-used unexpired cache "
@@ -764,47 +764,47 @@
 msgid "failed to set options on DHCP socket: %s"
 msgstr "configurarea opţiunilor socketului DHCP a eşuat: %s"
 
-#: dhcp.c:48
-#, c-format
-msgid "failed to set SO_REUSEADDR on DHCP socket: %s"
+#: dhcp.c:59
+#, fuzzy, c-format
+msgid "failed to set SO_REUSE{ADDR|PORT} on DHCP socket: %s"
 msgstr "configurarea SO_REUSEADDR pe socket-ul DHCP a eşuat: %s"
 
-#: dhcp.c:59
+#: dhcp.c:72
 #, c-format
 msgid "failed to bind DHCP server socket: %s"
 msgstr "activarea socket-ului server-ului DHCP a eşuat: %s"
 
-#: dhcp.c:72
+#: dhcp.c:85
 #, c-format
 msgid "cannot create ICMP raw socket: %s."
 msgstr "nu pot creea socket ICMP raw: %s."
 
-#: dhcp.c:84
+#: dhcp.c:97
 #, c-format
 msgid "duplicate IP address %s in dhcp-config directive."
 msgstr "adresă IP duplicat %s în declaraţia dhcp-config."
 
-#: dhcp.c:317
+#: dhcp.c:336
 #, c-format
 msgid "DHCP range %s -- %s is not consistent with netmask %s"
 msgstr "domeniu DHCP %s -- %s nu este consistent cu masca de reţea %s"
 
-#: dhcp.c:634
+#: dhcp.c:653
 #, c-format
 msgid "failed to read %s:%m"
 msgstr "citirea %s:%n a eşuat"
 
-#: dhcp.c:669
+#: dhcp.c:688
 #, c-format
 msgid "bad line at %s line %d"
 msgstr "linie invalidă în %s rândul %d"
 
-#: dhcp.c:776
+#: dhcp.c:795
 #, c-format
 msgid "duplicate IP address %s (%s) in dhcp-config directive"
 msgstr "adresă IP duplicat %s (%s) în declaraţia dhcp-config."
 
-#: dhcp.c:812
+#: dhcp.c:831
 #, c-format
 msgid "Ignoring DHCP host name %s because it has an illegal domain part"
 msgstr "Ignor numele DHCP al maşinii %s deoarece are domeniu DNS ilegal"
@@ -850,7 +850,7 @@
 msgid "disabled"
 msgstr "dezactivat"
 
-#: rfc2131.c:324 rfc2131.c:759
+#: rfc2131.c:324 rfc2131.c:762
 msgid "address in use"
 msgstr "adresa este folosită"
 
@@ -862,11 +862,11 @@
 msgid "no address available"
 msgstr "nici o adresă disponibilă"
 
-#: rfc2131.c:349 rfc2131.c:767
+#: rfc2131.c:349 rfc2131.c:772
 msgid "no leases left"
 msgstr "nu mai am de unde să împrumut"
 
-#: rfc2131.c:352 rfc2131.c:733
+#: rfc2131.c:352 rfc2131.c:736
 msgid "wrong network"
 msgstr "reţea greşită"
 
@@ -879,7 +879,7 @@
 msgid "unknown lease"
 msgstr "împrumut necunoscut"
 
-#: rfc2131.c:589 rfc2131.c:862
+#: rfc2131.c:589 rfc2131.c:873
 msgid "ignored"
 msgstr "ignorat"
 
@@ -899,36 +899,36 @@
 msgid "not using configured address %s because it was previously declined"
 msgstr ""
 
-#: rfc2131.c:696
+#: rfc2131.c:699
 msgid "wrong address"
 msgstr "adresă greşită"
 
-#: rfc2131.c:709
+#: rfc2131.c:712
 msgid "lease not found"
 msgstr "împrumutul nu a fost găsit"
 
-#: rfc2131.c:741
+#: rfc2131.c:744
 msgid "address not available"
 msgstr "adresă indisponibilă"
 
-#: rfc2131.c:752
+#: rfc2131.c:755
 msgid "static lease available"
 msgstr "împrumut static este disponibil"
 
-#: rfc2131.c:756
+#: rfc2131.c:759
 msgid "address reserved"
 msgstr "adresă rezervată"
 
-#: rfc2131.c:762
+#: rfc2131.c:765
 msgid "no unique-id"
 msgstr ""
 
-#: rfc2131.c:1000
+#: rfc2131.c:1011
 #, c-format
 msgid "cannot send DHCP option %d: no space left in packet"
 msgstr "nu pot trimite opţiunea DHCP %d: nu mai este loc în pachet"
 
-#: rfc2131.c:1301
+#: rfc2131.c:1312
 #, c-format
 msgid "More than one vendor class matches, using %s"
 msgstr "Se potrivesc mai multe clase de mărci de interfeţe, folosim %s"
diff --git a/src/cache.c b/src/cache.c
index a11bee9..752b2b1 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -58,6 +58,8 @@
 static void cache_unlink(struct crec *crecp);
 static void cache_link(struct crec *crecp);
 static char *record_source(struct hostsfile *add_hosts, int index);
+static void rehash(int size);
+static void cache_hash(struct crec *crecp);
 
 void cache_init(int size, int logq)
 {
@@ -72,6 +74,7 @@
   cache_head = cache_tail = NULL;
   dhcp_inuse = dhcp_spare = NULL;
   new_chain = NULL;
+  hash_table = NULL;
   cache_size = size;
   big_free = NULL;
   bignames_left = size/10;
@@ -91,16 +94,51 @@
 	}
     }
   
-  /* hash_size is a power of two. */
-  for (hash_size = 64; hash_size < cache_size/10; hash_size = hash_size << 1);
-  hash_table = safe_malloc(hash_size*sizeof(struct crec *));
-  for(i=0; i < hash_size; i++)
-    hash_table[i] = NULL;
+  /* create initial hash table*/
+  rehash(cache_size);
 }
 
+/* In most cases, we create the hash table once here by calling this with (hash_table == NULL)
+   but if the hosts file(s) are big (some people have 50000 ad-block entries), the table
+   will be much too small, so the hosts reading code calls rehash every 1000 addresses, to
+   expand the table. */
+static void rehash(int size)
+{
+  struct crec **new, **old, *p, *tmp;
+  int i, new_size, old_size;
+
+  /* hash_size is a power of two. */
+  for (new_size = 64; new_size < size/10; new_size = new_size << 1);
+  
+  /* must succeed in getting first instance, failure later is non-fatal */
+  if (!hash_table)
+    new = safe_malloc(new_size * sizeof(struct crec *));
+  else if (new_size <= hash_size || !(new = malloc(new_size * sizeof(struct crec *))))
+    return;
+
+  for(i = 0; i < new_size; i++)
+    new[i] = NULL;
+
+  old = hash_table;
+  old_size = hash_size;
+  hash_table = new;
+  hash_size = new_size;
+  
+  if (old)
+    {
+      for (i = 0; i < old_size; i++)
+	for (p = old[i]; p ; p = tmp)
+	  {
+	    tmp = p->hash_next;
+	    cache_hash(p);
+	  }
+      free(old);
+    }
+}
+  
 static struct crec **hash_bucket(char *name)
 {
-  unsigned int c, val = 017465; /* Barker code - minimum self-correlationin cyclic shift */
+  unsigned int c, val = 017465; /* Barker code - minimum self-correlation in cyclic shift */
   const unsigned char *mix_tab = (const unsigned char*)typestr; 
 
   while((c = (unsigned char) *name++))
@@ -108,7 +146,7 @@
       /* don't use tolower and friends here - they may be messed up by LOCALE */
       if (c >= 'A' && c <= 'Z')
 	c += 'a' - 'A';
-      val = ((val << 7) | (val >> (32 - 7))) + (mix_tab[(val + c) & 0x1F] ^ c);
+      val = ((val << 7) | (val >> (32 - 7))) + (mix_tab[(val + c) & 0x3F] ^ c);
     } 
   
   /* hash_size is a power of two */
@@ -204,7 +242,7 @@
 
   if (difftime(now, crecp->ttd) < 0)
     return 0;
-
+  
   return 1;
 }
 
@@ -575,19 +613,38 @@
 }
 
 static void add_hosts_entry(struct crec *cache, struct all_addr *addr, int addrlen, 
-			    unsigned short flags, int index)
+			    unsigned short flags, int index, int addr_dup)
 {
   struct crec *lookup = cache_find_by_name(NULL, cache->name.sname, 0, flags & (F_IPV4 | F_IPV6));
-
+  int i;
+  
   /* Remove duplicates in hosts files. */
   if (lookup && (lookup->flags & F_HOSTS) &&
       memcmp(&lookup->addr.addr, addr, addrlen) == 0)
     free(cache);
   else
     {
-      /* Ensure there is only one address -> name mapping (first one trumps) */
-      if (cache_find_by_addr(NULL, addr, 0, flags & (F_IPV4 | F_IPV6)))
+      /* Ensure there is only one address -> name mapping (first one trumps) 
+	 We do this by steam here, first we see if the address is the same as
+	 the last one we saw, which eliminates most in the case of an ad-block 
+	 file with thousands of entries for the same address.
+	 Then we search and bail at the first matching address that came from
+	 a HOSTS file. Since the first host entry gets reverse, we know 
+	 then that it must exist without searching exhaustively for it. */
+     
+      if (addr_dup)
 	flags &= ~F_REVERSE;
+      else
+	for (i=0; i<hash_size; i++)
+	  for (lookup = hash_table[i]; lookup; lookup = lookup->hash_next)
+	    if ((lookup->flags & F_HOSTS) && 
+		(lookup->flags & flags & (F_IPV4 | F_IPV6)) &&
+		memcmp(&lookup->addr.addr, addr, addrlen) == 0)
+	      {
+		flags &= ~F_REVERSE;
+		break;
+	      }
+    
       cache->flags = flags;
       cache->uid = index;
       memcpy(&cache->addr.addr, addr, addrlen);
@@ -595,25 +652,25 @@
     }
 }
 
-static void read_hostsfile(char *filename, int opts, char *buff, char *domain_suffix, int index)
+static int read_hostsfile(char *filename, int opts, char *buff, char *domain_suffix, int index, int cache_size)
 {  
   FILE *f = fopen(filename, "r");
   char *line;
-  int count = 0, lineno = 0;
-  
+  int addr_count = 0, name_count = cache_size, lineno = 0;
+  unsigned short flags, saved_flags = 0;
+  struct all_addr addr, saved_addr;
+
   if (!f)
     {
       syslog(LOG_ERR, _("failed to load names from %s: %m"), filename);
-      return;
+      return 0;
     }
     
   while ((line = fgets(buff, MAXDNAME, f)))
     {
-      struct all_addr addr;
       char *token = strtok(line, " \t\n\r");
-      int addrlen;
-      unsigned short flags;
-          
+      int addrlen, addr_dup = 0;
+              
       lineno++;
 
       if (!token || (*token == '#')) 
@@ -643,12 +700,28 @@
 	  continue;
 	}
 
+     if (saved_flags == flags && memcmp(&addr, &saved_addr, addrlen) == 0)
+       addr_dup = 1;
+     else
+       {
+	 saved_flags = flags;
+	 saved_addr = addr;
+       }
+     
+     addr_count++;
+     
+     /* rehash every 1000 names. */
+     if ((name_count - cache_size) > 1000)
+       {
+	 rehash(name_count);
+	 cache_size = name_count;
+       }
+     
      while ((token = strtok(NULL, " \t\n\r")) && (*token != '#'))
        {
 	 struct crec *cache;
 	 if (canonicalise(token))
 	   {
-	     count++;
 	     /* If set, add a version of the name with a default domain appended */
 	     if ((opts & OPT_EXPAND) && domain_suffix && !strchr(token, '.') && 
 		 (cache = malloc(sizeof(struct crec) + 
@@ -657,12 +730,15 @@
 		 strcpy(cache->name.sname, token);
 		 strcat(cache->name.sname, ".");
 		 strcat(cache->name.sname, domain_suffix);
-		 add_hosts_entry(cache, &addr, addrlen, flags, index);
+		 add_hosts_entry(cache, &addr, addrlen, flags, index, addr_dup);
+		 addr_dup = 1;
+		 name_count++;
 	       }
 	     if ((cache = malloc(sizeof(struct crec) + strlen(token)+1-SMALLDNAME)))
 	       {
 		 strcpy(cache->name.sname, token);
-		 add_hosts_entry(cache, &addr, addrlen, flags, index);
+		 add_hosts_entry(cache, &addr, addrlen, flags, index, addr_dup);
+		 name_count++;
 	       }
 	   }
 	 else
@@ -671,14 +747,17 @@
     }
   
   fclose(f);
+  rehash(name_count);
 
-  syslog(LOG_INFO, _("read %s - %d addresses"), filename, count);
+  syslog(LOG_INFO, _("read %s - %d addresses"), filename, addr_count);
+
+  return name_count;
 }
 	    
 void cache_reload(int opts, char *buff, char *domain_suffix, struct hostsfile *addn_hosts)
 {
   struct crec *cache, **up, *tmp;
-  int i;
+  int i, total_size = cache_size;
 
   cache_inserted = cache_live_freed = 0;
   
@@ -713,10 +792,10 @@
     }
 
   if (!(opts & OPT_NO_HOSTS))
-    read_hostsfile(HOSTSFILE, opts, buff, domain_suffix, 0);
+    total_size = read_hostsfile(HOSTSFILE, opts, buff, domain_suffix, 0, total_size);
   while (addn_hosts)
     {
-      read_hostsfile(addn_hosts->fname, opts, buff, domain_suffix, addn_hosts->index);
+      total_size = read_hostsfile(addn_hosts->fname, opts, buff, domain_suffix, addn_hosts->index, total_size);
       addn_hosts = addn_hosts->next;
     }  
 } 
diff --git a/src/config.h b/src/config.h
index 50c8e40..aa503f3 100644
--- a/src/config.h
+++ b/src/config.h
@@ -10,7 +10,7 @@
    GNU General Public License for more details.
 */
 
-#define VERSION "2.34"
+#define VERSION "2.35"
 
 #define FTABSIZ 150 /* max number of outstanding requests (default) */
 #define MAX_PROCS 20 /* max no children for TCP requests */
@@ -33,7 +33,7 @@
 #  define RESOLVFILE "/etc/resolv.conf"
 #endif
 #define RUNFILE "/var/run/dnsmasq.pid"
-#if defined(__FreeBSD__) || defined (__OpenBSD__)
+#if defined(__FreeBSD__) || defined (__OpenBSD__) || defined(__DragonFly__)
 #   define LEASEFILE "/var/db/dnsmasq.leases"
 #else
 #   define LEASEFILE "/var/lib/misc/dnsmasq.leases"
@@ -216,7 +216,7 @@
 #   define HAVE_BROKEN_SOCKADDR_IN6
 #endif
 
-#elif defined(__FreeBSD__) || defined(__OpenBSD__)
+#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
 #undef HAVE_LINUX_NETWORK
 /* Later verions of FreeBSD have getopt_long() */
 #if defined(optional_argument) && defined(required_argument)
diff --git a/src/dhcp.c b/src/dhcp.c
index 72067bd..efb48de 100644
--- a/src/dhcp.c
+++ b/src/dhcp.c
@@ -31,7 +31,7 @@
   if (fd == -1)
     die (_("cannot create DHCP socket : %s"), NULL);
   
-  if (!fix_fd(fd) ||
+  if (!fix_fd(fd) || 
 #if defined(HAVE_LINUX_NETWORK)
       setsockopt(fd, SOL_IP, IP_PKTINFO, &oneopt, sizeof(oneopt)) == -1 ||
 #elif defined(IP_RECVIF)
@@ -41,11 +41,24 @@
     die(_("failed to set options on DHCP socket: %s"), NULL);
   
   /* When bind-interfaces is set, there might be more than one dnmsasq
-     instance binding port 67. That's Ok if they serve different networks.
-     Need to set REUSEADDR to make this posible. */
-  if ((daemon->options & OPT_NOWILD) &&
-      setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &oneopt, sizeof(oneopt)) == -1)
-    die(_("failed to set SO_REUSEADDR on DHCP socket: %s"), NULL);
+     instance binding port 67. That's OK if they serve different networks.
+     Need to set REUSEADDR to make this posible, or REUSEPORT on *BSD.
+     OpenBSD <= 4.0 screws up IP_RECVIF when SO_REUSEPORT is set, but
+     OpenBSD <= 3.9 doesn't have IP_RECVIF anyway, so we just have to elide
+     this for OpenBSD 4.0, if you want more than one instance on oBSD4.0, tough. */
+
+#ifndef OpenBSD4_0
+  if (daemon->options & OPT_NOWILD)
+    {
+#ifdef SO_REUSEPORT
+      int rc = setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &oneopt, sizeof(oneopt));
+#else
+      int rc = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &oneopt, sizeof(oneopt));
+#endif
+      if (rc == -1)
+	die(_("failed to set SO_REUSE{ADDR|PORT} on DHCP socket: %s"), NULL);
+    }
+#endif
   
   memset(&saddr, 0, sizeof(saddr));
   saddr.sin_family = AF_INET;
@@ -116,8 +129,8 @@
 #endif
   } control_u;
   
-  msg.msg_control = control_u.control;
-  msg.msg_controllen = sizeof(control_u);
+  msg.msg_control = NULL;
+  msg.msg_controllen = 0;
   msg.msg_name = NULL;
   msg.msg_namelen = 0;
   msg.msg_iov = &daemon->dhcp_packet;
@@ -134,42 +147,48 @@
   /* expand_buf may have moved buffer */
   mess = daemon->dhcp_packet.iov_base;
   msg.msg_controllen = sizeof(control_u);
+  msg.msg_control = control_u.control;
   msg.msg_flags = 0;
   msg.msg_name = &dest;
   msg.msg_namelen = sizeof(dest);
 
   while ((sz = recvmsg(daemon->dhcpfd, &msg, 0)) == -1 && errno == EINTR);
  
-  if ((msg.msg_flags & MSG_TRUNC) ||
-      sz < (ssize_t)(sizeof(*mess) - sizeof(mess->options)))
+  if (sz < (ssize_t)(sizeof(*mess) - sizeof(mess->options)))
     return;
   
 #if defined (HAVE_LINUX_NETWORK)
-  if (msg.msg_controllen < sizeof(struct cmsghdr))
-    return;
-  for (cmptr = CMSG_FIRSTHDR(&msg); cmptr; cmptr = CMSG_NXTHDR(&msg, cmptr))
-    if (cmptr->cmsg_level == SOL_IP && cmptr->cmsg_type == IP_PKTINFO)
-      {
-	iface_index = ((struct in_pktinfo *)CMSG_DATA(cmptr))->ipi_ifindex;
-	if (((struct in_pktinfo *)CMSG_DATA(cmptr))->ipi_addr.s_addr != INADDR_BROADCAST)
-	  unicast_dest = 1;
-      }
-
+  if (msg.msg_controllen >= sizeof(struct cmsghdr))
+    for (cmptr = CMSG_FIRSTHDR(&msg); cmptr; cmptr = CMSG_NXTHDR(&msg, cmptr))
+      if (cmptr->cmsg_level == SOL_IP && cmptr->cmsg_type == IP_PKTINFO)
+	{
+	  iface_index = ((struct in_pktinfo *)CMSG_DATA(cmptr))->ipi_ifindex;
+	  if (((struct in_pktinfo *)CMSG_DATA(cmptr))->ipi_addr.s_addr != INADDR_BROADCAST)
+	    unicast_dest = 1;
+	}
+  
   if (!(ifr.ifr_ifindex = iface_index) || 
       ioctl(daemon->dhcpfd, SIOCGIFNAME, &ifr) == -1)
     return;
   
 #elif defined(IP_RECVIF)
-  if (msg.msg_controllen < sizeof(struct cmsghdr))
-    return;
-  for (cmptr = CMSG_FIRSTHDR(&msg); cmptr; cmptr = CMSG_NXTHDR(&msg, cmptr))
-    if (cmptr->cmsg_level == IPPROTO_IP && cmptr->cmsg_type == IP_RECVIF)
-      iface_index = ((struct sockaddr_dl *)CMSG_DATA(cmptr))->sdl_index;
-
+  if (msg.msg_controllen >= sizeof(struct cmsghdr))
+    for (cmptr = CMSG_FIRSTHDR(&msg); cmptr; cmptr = CMSG_NXTHDR(&msg, cmptr))
+      if (cmptr->cmsg_level == IPPROTO_IP && cmptr->cmsg_type == IP_RECVIF)
+	iface_index = ((struct sockaddr_dl *)CMSG_DATA(cmptr))->sdl_index;
+  
   if (!iface_index || !if_indextoname(iface_index, ifr.ifr_name))
     return;
-
+  
+#ifdef MSG_BCAST
+  /* OpenBSD tells us when a packet was broadcast */
+  if (!(msg.msg_flags & MSG_BCAST))
+    unicast_dest = 1;
+#endif
+ 
 #else
+  /* fallback for systems without IP_RECVIF - allow only one interface
+     and assume packets arrive from it - yuk. */
   {
     struct iname *name;
     for (name = daemon->if_names; name->isloop; name = name->next);
@@ -179,7 +198,7 @@
 #endif
 
   ifr.ifr_addr.sa_family = AF_INET;
-  if (ioctl(daemon->dhcpfd, SIOCGIFADDR, &ifr) < 0 )
+  if (ioctl(daemon->dhcpfd, SIOCGIFADDR, &ifr) == -1 )
     return;
   iface_addr = ((struct sockaddr_in *) &ifr.ifr_addr)->sin_addr;
 
diff --git a/src/helper.c b/src/helper.c
index 15ee91b..0e85380 100644
--- a/src/helper.c
+++ b/src/helper.c
@@ -230,13 +230,10 @@
   if (daemon->helperfd == -1)
     return;
 
-  if (action == ACTION_ADD)
-    {
-      if (lease->vendorclass)
-	vclass_len = lease->vendorclass_len;
-      if (lease->userclass)
-	uclass_len = lease->userclass_len;
-    }
+  if (lease->vendorclass)
+    vclass_len = lease->vendorclass_len;
+  if (lease->userclass)
+    uclass_len = lease->userclass_len;
   if (lease->clid)
     clid_len = lease->clid_len;
   if (hostname)
diff --git a/src/rfc2131.c b/src/rfc2131.c
index 3ec4bc1..6bebd2c 100644
--- a/src/rfc2131.c
+++ b/src/rfc2131.c
@@ -95,7 +95,7 @@
   struct dhcp_vendor *vendor;
   struct dhcp_mac *mac;
   struct dhcp_netid_list *id_list;
-  int clid_len = 0, ignore = 0;
+  int clid_len = 0, ignore = 0, do_classes = 0;
   struct dhcp_packet *mess = daemon->dhcp_packet.iov_base;
   unsigned char *p, *end = (unsigned char *)(mess + 1);
   char *hostname = NULL, *offer_hostname = NULL, *client_hostname = NULL;
@@ -669,6 +669,9 @@
 	  /* SELECTING  or INIT_REBOOT */
 	  mess->yiaddr = option_addr(opt);
 	  
+	  /* send vendor and user class info for new or recreated lease */
+	  do_classes = 1;
+	  
 	  if ((opt = option_find(mess, sz, OPTION_SERVER_IDENTIFIER, INADDRSZ)))
 	    {
 	      /* SELECTING */
@@ -763,37 +766,10 @@
 	  
 	  else if (!lease)
 	    {	     
-	      if (!(lease = lease_allocate(mess->yiaddr)))
-		message = _("no leases left");
+	      if ((lease = lease_allocate(mess->yiaddr)))
+		do_classes = 1;
 	      else
-		{
-		  /* copy user-class and vendor class into new lease, for the script */
-		  if ((opt = option_find(mess, sz, OPTION_USER_CLASS, 1)))
-		    {
-		      int len = option_len(opt);
-		      unsigned char *ucp = option_ptr(opt);
-		      /* If the user-class option started as counted strings, the first byte will be zero. */
-		      if (len != 0 && ucp[0] == 0)
-			ucp++, len--;
-		      if ((lease->userclass = malloc(len+1)))
-			{
-			  memcpy(lease->userclass, ucp, len);
-			  lease->userclass[len] = 0;
-			  lease->userclass_len = len+1;
-			}
-		    }
-		  if ((opt = option_find(mess, sz, OPTION_VENDOR_ID, 1)))
-		    {
-		      int len = option_len(opt);
-		      unsigned char *ucp = option_ptr(opt);
-		      if ((lease->vendorclass = malloc(len+1)))
-			{
-			  memcpy(lease->vendorclass, ucp, len);
-			  lease->vendorclass[len] = 0;
-			  lease->vendorclass_len = len+1;
-			}
-		    }
-		}  
+		message = _("no leases left");
 	    }
 	}
 
@@ -818,8 +794,43 @@
 	}
       else
 	{
-	  if (!hostname_auth && (client_hostname = host_from_dns(daemon, mess->yiaddr)))
-	    {
+	   if (do_classes)
+	     {
+	       lease->changed = 1;
+	       /* copy user-class and vendor class into new lease, for the script */
+	       if ((opt = option_find(mess, sz, OPTION_USER_CLASS, 1)))
+		 {
+		   int len = option_len(opt);
+		   unsigned char *ucp = option_ptr(opt);
+		   /* If the user-class option started as counted strings, the first byte will be zero. */
+		   if (len != 0 && ucp[0] == 0)
+		     ucp++, len--;
+		   if (lease->userclass)
+		     free(lease->userclass);
+		   if ((lease->userclass = malloc(len+1)))
+		     {
+		       memcpy(lease->userclass, ucp, len);
+		       lease->userclass[len] = 0;
+		       lease->userclass_len = len+1;
+		     }
+		 }
+	       if ((opt = option_find(mess, sz, OPTION_VENDOR_ID, 1)))
+		 {
+		   int len = option_len(opt);
+		   unsigned char *ucp = option_ptr(opt);
+		   if (lease->vendorclass)
+		     free(lease->vendorclass);
+		   if ((lease->vendorclass = malloc(len+1)))
+		     {
+		       memcpy(lease->vendorclass, ucp, len);
+		       lease->vendorclass[len] = 0;
+		       lease->vendorclass_len = len+1;
+		     }
+		 }
+	     }
+	   
+	   if (!hostname_auth && (client_hostname = host_from_dns(daemon, mess->yiaddr)))
+	     {
 	      hostname = client_hostname;
 	      hostname_auth = 1;
 	    }