mirror of
http://thekelleys.org.uk/git/dnsmasq.git
synced 2026-11-06 15:51:41 +00:00
Compare commits
9
Commits
v2.79rc2
...
v2.80test1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4441cf762c | ||
|
|
e83915d10d | ||
|
|
6d37924b86 | ||
|
|
f3d7974e86 | ||
|
|
734d53176f | ||
|
|
9a7be47614 | ||
|
|
26e27d0015 | ||
|
|
94b6878821 | ||
|
|
8b96552f0d |
No files matched your search
@@ -1,3 +1,8 @@
|
|||||||
|
version 2.80
|
||||||
|
Add support for RFC 4039 DHCP rapid commit. Thanks to Ashram Method
|
||||||
|
for the initial patch and motivation.
|
||||||
|
|
||||||
|
|
||||||
version 2.79
|
version 2.79
|
||||||
Fix parsing of CNAME arguments, which are confused by extra spaces.
|
Fix parsing of CNAME arguments, which are confused by extra spaces.
|
||||||
Thanks to Diego Aguirre for spotting the bug.
|
Thanks to Diego Aguirre for spotting the bug.
|
||||||
@@ -60,6 +65,9 @@ version 2.79
|
|||||||
internal-20.thekelleys.org.uk being 192.168.0.70
|
internal-20.thekelleys.org.uk being 192.168.0.70
|
||||||
Thanks to Andy Hawkins for the suggestion.
|
Thanks to Andy Hawkins for the suggestion.
|
||||||
|
|
||||||
|
Tidy up Crypto code, removing workarounds for ancient
|
||||||
|
versions of libnettle. We now require libnettle 3.
|
||||||
|
|
||||||
|
|
||||||
version 2.78
|
version 2.78
|
||||||
Fix logic of appending ".<layer>" to PXE basename. Thanks to Chris
|
Fix logic of appending ".<layer>" to PXE basename. Thanks to Chris
|
||||||
|
|||||||
@@ -100,7 +100,8 @@ clean : mostly_clean
|
|||||||
install : all install-common
|
install : all install-common
|
||||||
|
|
||||||
install-common :
|
install-common :
|
||||||
$(INSTALL) -d $(DESTDIR)$(BINDIR) -d $(DESTDIR)$(MANDIR)/man8
|
$(INSTALL) -d $(DESTDIR)$(BINDIR)
|
||||||
|
$(INSTALL) -d $(DESTDIR)$(MANDIR)/man8
|
||||||
$(INSTALL) -m 644 $(MAN)/dnsmasq.8 $(DESTDIR)$(MANDIR)/man8
|
$(INSTALL) -m 644 $(MAN)/dnsmasq.8 $(DESTDIR)$(MANDIR)/man8
|
||||||
$(INSTALL) -m 755 $(BUILDDIR)/dnsmasq $(DESTDIR)$(BINDIR)
|
$(INSTALL) -m 755 $(BUILDDIR)/dnsmasq $(DESTDIR)$(BINDIR)
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
-1
@@ -2,7 +2,7 @@ dnsmasq (2.79-1) unstable; urgency=low
|
|||||||
|
|
||||||
* New upstream. (closes: #888200)
|
* New upstream. (closes: #888200)
|
||||||
* Fix trust-anchor regex in init script. (closes: #884347)
|
* Fix trust-anchor regex in init script. (closes: #884347)
|
||||||
* Fix exit code for dhcp_release6 (closes: #833596)
|
* Fix exit code for dhcp_release6 (closes: #883596)
|
||||||
* Add project homepage to control file. (closes: #887764)
|
* Add project homepage to control file. (closes: #887764)
|
||||||
* New binary package dnsmasq-base-lua, includes Lua support.
|
* New binary package dnsmasq-base-lua, includes Lua support.
|
||||||
* Remove hardwired shlibs dependency for libnettle 3.3 and
|
* Remove hardwired shlibs dependency for libnettle 3.3 and
|
||||||
|
|||||||
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
# dnsmasq-base and dnsmasq-base-lua are mutually exclusive and both
|
||||||
|
# provide /usr/share/doc/dnsmasq-base
|
||||||
|
dnsmasq-base-lua binary: usr-share-doc-symlink-without-dependency dnsmasq-base
|
||||||
Vendored
+3
@@ -217,9 +217,12 @@ else
|
|||||||
rm -rf debian/trees/lua-base/usr/share/man
|
rm -rf debian/trees/lua-base/usr/share/man
|
||||||
endif
|
endif
|
||||||
$(call add_files,debian/trees/lua-base)
|
$(call add_files,debian/trees/lua-base)
|
||||||
|
install -m 755 -d debian/trees/lua-base/usr/share/lintian/overrides
|
||||||
|
install -m 644 debian/lintian-override debian/trees/lua-base/usr/share/lintian/overrides/dnsmasq-base-lua
|
||||||
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
|
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
|
||||||
$(DEB_HOST_GNU_TYPE)-strip -R .note -R .comment debian/trees/lua-base/usr/sbin/dnsmasq
|
$(DEB_HOST_GNU_TYPE)-strip -R .note -R .comment debian/trees/lua-base/usr/sbin/dnsmasq
|
||||||
endif
|
endif
|
||||||
|
ln -s $(package) debian/trees/lua-base/usr/share/doc/dnsmasq-base-lua
|
||||||
cd debian/trees/lua-base && find . -type f ! -regex '.*DEBIAN/.*' -printf '%P\0' | LC_ALL=C sort -z | xargs -r0 md5sum > DEBIAN/md5sums
|
cd debian/trees/lua-base && find . -type f ! -regex '.*DEBIAN/.*' -printf '%P\0' | LC_ALL=C sort -z | xargs -r0 md5sum > DEBIAN/md5sums
|
||||||
dpkg-shlibdeps --warnings=1 debian/trees/lua-base/usr/sbin/dnsmasq
|
dpkg-shlibdeps --warnings=1 debian/trees/lua-base/usr/sbin/dnsmasq
|
||||||
dpkg-gencontrol $(PACKAGE_VERSION) -pdnsmasq-base-lua -Pdebian/trees/lua-base
|
dpkg-gencontrol $(PACKAGE_VERSION) -pdnsmasq-base-lua -Pdebian/trees/lua-base
|
||||||
|
|||||||
@@ -547,6 +547,14 @@
|
|||||||
# http://www.isc.org/files/auth.html
|
# http://www.isc.org/files/auth.html
|
||||||
#dhcp-authoritative
|
#dhcp-authoritative
|
||||||
|
|
||||||
|
# Set the DHCP server to enable DHCPv4 Rapid Commit Option per RFC 4039.
|
||||||
|
# In this mode it will respond to a DHCPDISCOVER message including a Rapid Commit
|
||||||
|
# option with a DHCPACK including a Rapid Commit option and fully committed address
|
||||||
|
# and configuration information. This must only be enabled if either the server is
|
||||||
|
# the only server for the subnet, or multiple servers are present and they each
|
||||||
|
# commit a binding for all clients.
|
||||||
|
#dhcp-rapid-commit
|
||||||
|
|
||||||
# Run an executable when a DHCP lease is created or destroyed.
|
# Run an executable when a DHCP lease is created or destroyed.
|
||||||
# The arguments sent to the script are "add" or "del",
|
# The arguments sent to the script are "add" or "del",
|
||||||
# then the MAC address, the IP address and finally the hostname
|
# then the MAC address, the IP address and finally the hostname
|
||||||
|
|||||||
@@ -1452,6 +1452,13 @@ allows dnsmasq to rebuild its lease database without each client needing to
|
|||||||
reacquire a lease, if the database is lost. For DHCPv6 it sets the
|
reacquire a lease, if the database is lost. For DHCPv6 it sets the
|
||||||
priority in replies to 255 (the maximum) instead of 0 (the minimum).
|
priority in replies to 255 (the maximum) instead of 0 (the minimum).
|
||||||
.TP
|
.TP
|
||||||
|
.B --dhcp-rapid-commit
|
||||||
|
Enable DHCPv4 Rapid Commit Option specified in RFC 4039. When enabled, dnsmasq
|
||||||
|
will respond to a DHCPDISCOVER message including a Rapid Commit
|
||||||
|
option with a DHCPACK including a Rapid Commit option and fully committed
|
||||||
|
address and configuration information. Should only be enabled if either the
|
||||||
|
server is the only server for the subnet, or multiple servers are present and they each commit a binding for all clients.
|
||||||
|
.TP
|
||||||
.B --dhcp-alternate-port[=<server port>[,<client port>]]
|
.B --dhcp-alternate-port[=<server port>[,<client port>]]
|
||||||
(IPv4 only) Change the ports used for DHCP from the default. If this option is
|
(IPv4 only) Change the ports used for DHCP from the default. If this option is
|
||||||
given alone, without arguments, it changes the ports used for DHCP
|
given alone, without arguments, it changes the ports used for DHCP
|
||||||
|
|||||||
@@ -137,9 +137,6 @@ NO_INOTIFY
|
|||||||
otherwise be enabled automatically (HAVE_IPV6, >2Gb file sizes) or
|
otherwise be enabled automatically (HAVE_IPV6, >2Gb file sizes) or
|
||||||
which are enabled by default in the distributed source tree. Building dnsmasq
|
which are enabled by default in the distributed source tree. Building dnsmasq
|
||||||
with something like "make COPTS=-DNO_SCRIPT" will do the trick.
|
with something like "make COPTS=-DNO_SCRIPT" will do the trick.
|
||||||
|
|
||||||
NO_NETTLE_ECC
|
|
||||||
Don't include the ECDSA cypher in DNSSEC validation. Needed for older Nettle versions.
|
|
||||||
NO_GMP
|
NO_GMP
|
||||||
Don't use and link against libgmp, Useful if nettle is built with --enable-mini-gmp.
|
Don't use and link against libgmp, Useful if nettle is built with --enable-mini-gmp.
|
||||||
|
|
||||||
|
|||||||
+23
-33
@@ -20,20 +20,12 @@
|
|||||||
|
|
||||||
#include <nettle/rsa.h>
|
#include <nettle/rsa.h>
|
||||||
#include <nettle/dsa.h>
|
#include <nettle/dsa.h>
|
||||||
#ifndef NO_NETTLE_ECC
|
#include <nettle/ecdsa.h>
|
||||||
# include <nettle/ecdsa.h>
|
#include <nettle/ecc-curve.h>
|
||||||
# include <nettle/ecc-curve.h>
|
#include <nettle/eddsa.h>
|
||||||
# include <nettle/eddsa.h>
|
|
||||||
#endif
|
|
||||||
#include <nettle/nettle-meta.h>
|
#include <nettle/nettle-meta.h>
|
||||||
#include <nettle/bignum.h>
|
#include <nettle/bignum.h>
|
||||||
|
|
||||||
/* Nettle-3.0 moved to a new API for DSA. We use a name that's defined in the new API
|
|
||||||
to detect Nettle-3, and invoke the backwards compatibility mode. */
|
|
||||||
#ifdef dsa_params_init
|
|
||||||
#include <nettle/dsa-compat.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Implement a "hash-function" to the nettle API, which simply returns
|
/* Implement a "hash-function" to the nettle API, which simply returns
|
||||||
the input data, concatenated into a single, statically maintained, buffer.
|
the input data, concatenated into a single, statically maintained, buffer.
|
||||||
|
|
||||||
@@ -109,8 +101,6 @@ static struct nettle_hash null_hash = {
|
|||||||
/* Find pointer to correct hash function in nettle library */
|
/* Find pointer to correct hash function in nettle library */
|
||||||
const struct nettle_hash *hash_find(char *name)
|
const struct nettle_hash *hash_find(char *name)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
|
|
||||||
if (!name)
|
if (!name)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@@ -120,18 +110,21 @@ const struct nettle_hash *hash_find(char *name)
|
|||||||
|
|
||||||
/* libnettle >= 3.4 provides nettle_lookup_hash() which avoids nasty ABI
|
/* libnettle >= 3.4 provides nettle_lookup_hash() which avoids nasty ABI
|
||||||
incompatibilities if sizeof(nettle_hashes) changes between library
|
incompatibilities if sizeof(nettle_hashes) changes between library
|
||||||
versions. */
|
versions. It also #defines nettle_hashes, so use that to tell
|
||||||
|
if we have the new facilities. */
|
||||||
|
|
||||||
#if (NETTLE_VERSION_MAJOR>3) || ((NETTLE_VERSION_MAJOR==3) && (NETTLE_VERSION_MINOR >=4))
|
#ifdef nettle_hashes
|
||||||
return nettle_lookup_hash(name);
|
return nettle_lookup_hash(name);
|
||||||
#else
|
#else
|
||||||
for (i = 0; nettle_hashes[i]; i++)
|
{
|
||||||
{
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; nettle_hashes[i]; i++)
|
||||||
if (strcmp(nettle_hashes[i]->name, name) == 0)
|
if (strcmp(nettle_hashes[i]->name, name) == 0)
|
||||||
return nettle_hashes[i];
|
return nettle_hashes[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,18 +226,20 @@ static int dnsmasq_dsa_verify(struct blockdata *key_data, unsigned int key_len,
|
|||||||
unsigned char *p;
|
unsigned char *p;
|
||||||
unsigned int t;
|
unsigned int t;
|
||||||
|
|
||||||
static struct dsa_public_key *key = NULL;
|
static mpz_t y;
|
||||||
|
static struct dsa_params *params = NULL;
|
||||||
static struct dsa_signature *sig_struct;
|
static struct dsa_signature *sig_struct;
|
||||||
|
|
||||||
(void)digest_len;
|
(void)digest_len;
|
||||||
|
|
||||||
if (key == NULL)
|
if (params == NULL)
|
||||||
{
|
{
|
||||||
if (!(sig_struct = whine_malloc(sizeof(struct dsa_signature))) ||
|
if (!(sig_struct = whine_malloc(sizeof(struct dsa_signature))) ||
|
||||||
!(key = whine_malloc(sizeof(struct dsa_public_key))))
|
!(params = whine_malloc(sizeof(struct dsa_params))))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
nettle_dsa_public_key_init(key);
|
mpz_init(y);
|
||||||
|
nettle_dsa_params_init(params);
|
||||||
nettle_dsa_signature_init(sig_struct);
|
nettle_dsa_signature_init(sig_struct);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,20 +251,19 @@ static int dnsmasq_dsa_verify(struct blockdata *key_data, unsigned int key_len,
|
|||||||
if (key_len < (213 + (t * 24)))
|
if (key_len < (213 + (t * 24)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
mpz_import(key->q, 20, 1, 1, 0, 0, p); p += 20;
|
mpz_import(params->q, 20, 1, 1, 0, 0, p); p += 20;
|
||||||
mpz_import(key->p, 64 + (t*8), 1, 1, 0, 0, p); p += 64 + (t*8);
|
mpz_import(params->p, 64 + (t*8), 1, 1, 0, 0, p); p += 64 + (t*8);
|
||||||
mpz_import(key->g, 64 + (t*8), 1, 1, 0, 0, p); p += 64 + (t*8);
|
mpz_import(params->g, 64 + (t*8), 1, 1, 0, 0, p); p += 64 + (t*8);
|
||||||
mpz_import(key->y, 64 + (t*8), 1, 1, 0, 0, p); p += 64 + (t*8);
|
mpz_import(y, 64 + (t*8), 1, 1, 0, 0, p); p += 64 + (t*8);
|
||||||
|
|
||||||
mpz_import(sig_struct->r, 20, 1, 1, 0, 0, sig+1);
|
mpz_import(sig_struct->r, 20, 1, 1, 0, 0, sig+1);
|
||||||
mpz_import(sig_struct->s, 20, 1, 1, 0, 0, sig+21);
|
mpz_import(sig_struct->s, 20, 1, 1, 0, 0, sig+21);
|
||||||
|
|
||||||
(void)algo;
|
(void)algo;
|
||||||
|
|
||||||
return nettle_dsa_sha1_verify_digest(key, digest, sig_struct);
|
return nettle_dsa_verify(params, y, digest_len, digest, sig_struct);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NO_NETTLE_ECC
|
|
||||||
static int dnsmasq_ecdsa_verify(struct blockdata *key_data, unsigned int key_len,
|
static int dnsmasq_ecdsa_verify(struct blockdata *key_data, unsigned int key_len,
|
||||||
unsigned char *sig, size_t sig_len,
|
unsigned char *sig, size_t sig_len,
|
||||||
unsigned char *digest, size_t digest_len, int algo)
|
unsigned char *digest, size_t digest_len, int algo)
|
||||||
@@ -371,8 +365,6 @@ static int dnsmasq_eddsa_verify(struct blockdata *key_data, unsigned int key_len
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int (*verify_func(int algo))(struct blockdata *key_data, unsigned int key_len, unsigned char *sig, size_t sig_len,
|
static int (*verify_func(int algo))(struct blockdata *key_data, unsigned int key_len, unsigned char *sig, size_t sig_len,
|
||||||
unsigned char *digest, size_t digest_len, int algo)
|
unsigned char *digest, size_t digest_len, int algo)
|
||||||
{
|
{
|
||||||
@@ -390,13 +382,11 @@ static int (*verify_func(int algo))(struct blockdata *key_data, unsigned int key
|
|||||||
case 3: case 6:
|
case 3: case 6:
|
||||||
return dnsmasq_dsa_verify;
|
return dnsmasq_dsa_verify;
|
||||||
|
|
||||||
#ifndef NO_NETTLE_ECC
|
|
||||||
case 13: case 14:
|
case 13: case 14:
|
||||||
return dnsmasq_ecdsa_verify;
|
return dnsmasq_ecdsa_verify;
|
||||||
|
|
||||||
case 15: case 16:
|
case 15: case 16:
|
||||||
return dnsmasq_eddsa_verify;
|
return dnsmasq_eddsa_verify;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@@ -556,6 +556,7 @@ static const struct opttab_t {
|
|||||||
{ "nntp-server", 71, OT_ADDR_LIST },
|
{ "nntp-server", 71, OT_ADDR_LIST },
|
||||||
{ "irc-server", 74, OT_ADDR_LIST },
|
{ "irc-server", 74, OT_ADDR_LIST },
|
||||||
{ "user-class", 77, 0 },
|
{ "user-class", 77, 0 },
|
||||||
|
{ "rapid-commit", 80, 0 },
|
||||||
{ "FQDN", 81, OT_INTERNAL },
|
{ "FQDN", 81, OT_INTERNAL },
|
||||||
{ "agent-id", 82, OT_INTERNAL },
|
{ "agent-id", 82, OT_INTERNAL },
|
||||||
{ "client-arch", 93, 2 | OT_DEC },
|
{ "client-arch", 93, 2 | OT_DEC },
|
||||||
|
|||||||
@@ -54,6 +54,7 @@
|
|||||||
#define OPTION_SNAME 66
|
#define OPTION_SNAME 66
|
||||||
#define OPTION_FILENAME 67
|
#define OPTION_FILENAME 67
|
||||||
#define OPTION_USER_CLASS 77
|
#define OPTION_USER_CLASS 77
|
||||||
|
#define OPTION_RAPID_COMMIT 80
|
||||||
#define OPTION_CLIENT_FQDN 81
|
#define OPTION_CLIENT_FQDN 81
|
||||||
#define OPTION_AGENT_ID 82
|
#define OPTION_AGENT_ID 82
|
||||||
#define OPTION_ARCH 93
|
#define OPTION_ARCH 93
|
||||||
|
|||||||
+3
-2
@@ -250,7 +250,8 @@ struct event_desc {
|
|||||||
#define OPT_MAC_B64 54
|
#define OPT_MAC_B64 54
|
||||||
#define OPT_MAC_HEX 55
|
#define OPT_MAC_HEX 55
|
||||||
#define OPT_TFTP_APREF_MAC 56
|
#define OPT_TFTP_APREF_MAC 56
|
||||||
#define OPT_LAST 57
|
#define OPT_RAPID_COMMIT 57
|
||||||
|
#define OPT_LAST 58
|
||||||
|
|
||||||
/* extra flags for my_syslog, we use a couple of facilities since they are known
|
/* extra flags for my_syslog, we use a couple of facilities since they are known
|
||||||
not to occupy the same bits as priorities, no matter how syslog.h is set up. */
|
not to occupy the same bits as priorities, no matter how syslog.h is set up. */
|
||||||
@@ -505,7 +506,7 @@ struct serverfd {
|
|||||||
int fd;
|
int fd;
|
||||||
union mysockaddr source_addr;
|
union mysockaddr source_addr;
|
||||||
char interface[IF_NAMESIZE+1];
|
char interface[IF_NAMESIZE+1];
|
||||||
unsigned int ifindex, used;
|
unsigned int ifindex, used, preallocated;
|
||||||
struct serverfd *next;
|
struct serverfd *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+12
-5
@@ -1234,6 +1234,7 @@ static struct serverfd *allocate_sfd(union mysockaddr *addr, char *intname)
|
|||||||
struct serverfd *sfd;
|
struct serverfd *sfd;
|
||||||
unsigned int ifindex = 0;
|
unsigned int ifindex = 0;
|
||||||
int errsave;
|
int errsave;
|
||||||
|
int opt = 1;
|
||||||
|
|
||||||
/* when using random ports, servers which would otherwise use
|
/* when using random ports, servers which would otherwise use
|
||||||
the INADDR_ANY/port0 socket have sfd set to NULL */
|
the INADDR_ANY/port0 socket have sfd set to NULL */
|
||||||
@@ -1275,9 +1276,10 @@ static struct serverfd *allocate_sfd(union mysockaddr *addr, char *intname)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!local_bind(sfd->fd, addr, intname, ifindex, 0) || !fix_fd(sfd->fd))
|
if ((addr->sa.sa_family == AF_INET6 && setsockopt(sfd->fd, IPPROTO_IPV6, IPV6_V6ONLY, &opt, sizeof(opt)) == -1) ||
|
||||||
|
!local_bind(sfd->fd, addr, intname, ifindex, 0) || !fix_fd(sfd->fd))
|
||||||
{
|
{
|
||||||
errsave = errno; /* save error from bind. */
|
errsave = errno; /* save error from bind/setsockopt. */
|
||||||
close(sfd->fd);
|
close(sfd->fd);
|
||||||
free(sfd);
|
free(sfd);
|
||||||
errno = errsave;
|
errno = errsave;
|
||||||
@@ -1288,6 +1290,7 @@ static struct serverfd *allocate_sfd(union mysockaddr *addr, char *intname)
|
|||||||
sfd->source_addr = *addr;
|
sfd->source_addr = *addr;
|
||||||
sfd->next = daemon->sfds;
|
sfd->next = daemon->sfds;
|
||||||
sfd->ifindex = ifindex;
|
sfd->ifindex = ifindex;
|
||||||
|
sfd->preallocated = 0;
|
||||||
daemon->sfds = sfd;
|
daemon->sfds = sfd;
|
||||||
|
|
||||||
return sfd;
|
return sfd;
|
||||||
@@ -1298,6 +1301,7 @@ static struct serverfd *allocate_sfd(union mysockaddr *addr, char *intname)
|
|||||||
void pre_allocate_sfds(void)
|
void pre_allocate_sfds(void)
|
||||||
{
|
{
|
||||||
struct server *srv;
|
struct server *srv;
|
||||||
|
struct serverfd *sfd;
|
||||||
|
|
||||||
if (daemon->query_port != 0)
|
if (daemon->query_port != 0)
|
||||||
{
|
{
|
||||||
@@ -1309,7 +1313,8 @@ void pre_allocate_sfds(void)
|
|||||||
#ifdef HAVE_SOCKADDR_SA_LEN
|
#ifdef HAVE_SOCKADDR_SA_LEN
|
||||||
addr.in.sin_len = sizeof(struct sockaddr_in);
|
addr.in.sin_len = sizeof(struct sockaddr_in);
|
||||||
#endif
|
#endif
|
||||||
allocate_sfd(&addr, "");
|
if ((sfd = allocate_sfd(&addr, "")))
|
||||||
|
sfd->preallocated = 1;
|
||||||
#ifdef HAVE_IPV6
|
#ifdef HAVE_IPV6
|
||||||
memset(&addr, 0, sizeof(addr));
|
memset(&addr, 0, sizeof(addr));
|
||||||
addr.in6.sin6_family = AF_INET6;
|
addr.in6.sin6_family = AF_INET6;
|
||||||
@@ -1318,7 +1323,8 @@ void pre_allocate_sfds(void)
|
|||||||
#ifdef HAVE_SOCKADDR_SA_LEN
|
#ifdef HAVE_SOCKADDR_SA_LEN
|
||||||
addr.in6.sin6_len = sizeof(struct sockaddr_in6);
|
addr.in6.sin6_len = sizeof(struct sockaddr_in6);
|
||||||
#endif
|
#endif
|
||||||
allocate_sfd(&addr, "");
|
if ((sfd = allocate_sfd(&addr, "")))
|
||||||
|
sfd->preallocated = 1;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1472,8 +1478,9 @@ void check_servers(void)
|
|||||||
if (!option_bool(OPT_NOWILD))
|
if (!option_bool(OPT_NOWILD))
|
||||||
enumerate_interfaces(0);
|
enumerate_interfaces(0);
|
||||||
|
|
||||||
|
/* don't garbage collect pre-allocated sfds. */
|
||||||
for (sfd = daemon->sfds; sfd; sfd = sfd->next)
|
for (sfd = daemon->sfds; sfd; sfd = sfd->next)
|
||||||
sfd->used = 0;
|
sfd->used = sfd->preallocated;
|
||||||
|
|
||||||
for (count = 0, serv = daemon->servers; serv; serv = serv->next)
|
for (count = 0, serv = daemon->servers; serv; serv = serv->next)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -160,6 +160,7 @@ struct myoption {
|
|||||||
#define LOPT_DHCPTTL 348
|
#define LOPT_DHCPTTL 348
|
||||||
#define LOPT_TFTP_MTU 349
|
#define LOPT_TFTP_MTU 349
|
||||||
#define LOPT_REPLY_DELAY 350
|
#define LOPT_REPLY_DELAY 350
|
||||||
|
#define LOPT_RAPID_COMMIT 351
|
||||||
|
|
||||||
#ifdef HAVE_GETOPT_LONG
|
#ifdef HAVE_GETOPT_LONG
|
||||||
static const struct option opts[] =
|
static const struct option opts[] =
|
||||||
@@ -325,6 +326,7 @@ static const struct myoption opts[] =
|
|||||||
{ "script-arp", 0, 0, LOPT_SCRIPT_ARP },
|
{ "script-arp", 0, 0, LOPT_SCRIPT_ARP },
|
||||||
{ "dhcp-ttl", 1, 0 , LOPT_DHCPTTL },
|
{ "dhcp-ttl", 1, 0 , LOPT_DHCPTTL },
|
||||||
{ "dhcp-reply-delay", 1, 0, LOPT_REPLY_DELAY },
|
{ "dhcp-reply-delay", 1, 0, LOPT_REPLY_DELAY },
|
||||||
|
{ "dhcp-rapid-commit", 0, 0, LOPT_RAPID_COMMIT },
|
||||||
{ NULL, 0, 0, 0 }
|
{ NULL, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -497,6 +499,7 @@ static struct {
|
|||||||
{ LOPT_IGNORE_ADDR, ARG_DUP, "<ipaddr>", gettext_noop("Ignore DNS responses containing ipaddr."), NULL },
|
{ LOPT_IGNORE_ADDR, ARG_DUP, "<ipaddr>", gettext_noop("Ignore DNS responses containing ipaddr."), NULL },
|
||||||
{ LOPT_DHCPTTL, ARG_ONE, "<ttl>", gettext_noop("Set TTL in DNS responses with DHCP-derived addresses."), NULL },
|
{ LOPT_DHCPTTL, ARG_ONE, "<ttl>", gettext_noop("Set TTL in DNS responses with DHCP-derived addresses."), NULL },
|
||||||
{ LOPT_REPLY_DELAY, ARG_ONE, "<integer>", gettext_noop("Delay DHCP replies for at least number of seconds."), NULL },
|
{ LOPT_REPLY_DELAY, ARG_ONE, "<integer>", gettext_noop("Delay DHCP replies for at least number of seconds."), NULL },
|
||||||
|
{ LOPT_RAPID_COMMIT, OPT_RAPID_COMMIT, NULL, gettext_noop("Enables DHCPv4 Rapid Commit option."), NULL },
|
||||||
{ 0, 0, NULL, NULL, NULL }
|
{ 0, 0, NULL, NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+18
-3
@@ -75,7 +75,7 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
|
|||||||
struct dhcp_vendor *vendor;
|
struct dhcp_vendor *vendor;
|
||||||
struct dhcp_mac *mac;
|
struct dhcp_mac *mac;
|
||||||
struct dhcp_netid_list *id_list;
|
struct dhcp_netid_list *id_list;
|
||||||
int clid_len = 0, ignore = 0, do_classes = 0, selecting = 0, pxearch = -1;
|
int clid_len = 0, ignore = 0, do_classes = 0, rapid_commit = 0, selecting = 0, pxearch = -1;
|
||||||
struct dhcp_packet *mess = (struct dhcp_packet *)daemon->dhcp_packet.iov_base;
|
struct dhcp_packet *mess = (struct dhcp_packet *)daemon->dhcp_packet.iov_base;
|
||||||
unsigned char *end = (unsigned char *)(mess + 1);
|
unsigned char *end = (unsigned char *)(mess + 1);
|
||||||
unsigned char *real_end = (unsigned char *)(mess + 1);
|
unsigned char *real_end = (unsigned char *)(mess + 1);
|
||||||
@@ -1073,6 +1073,13 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
|
|||||||
|
|
||||||
log_tags(tagif_netid, ntohl(mess->xid));
|
log_tags(tagif_netid, ntohl(mess->xid));
|
||||||
apply_delay(mess->xid, recvtime, tagif_netid);
|
apply_delay(mess->xid, recvtime, tagif_netid);
|
||||||
|
|
||||||
|
if (option_bool(OPT_RAPID_COMMIT) && option_find(mess, sz, OPTION_RAPID_COMMIT, 0))
|
||||||
|
{
|
||||||
|
rapid_commit = 1;
|
||||||
|
goto rapid_commit;
|
||||||
|
}
|
||||||
|
|
||||||
log_packet("DHCPOFFER" , &mess->yiaddr, emac, emac_len, iface_name, NULL, NULL, mess->xid);
|
log_packet("DHCPOFFER" , &mess->yiaddr, emac, emac_len, iface_name, NULL, NULL, mess->xid);
|
||||||
|
|
||||||
time = calc_time(context, config, option_find(mess, sz, OPTION_LEASE_TIME, 4));
|
time = calc_time(context, config, option_find(mess, sz, OPTION_LEASE_TIME, 4));
|
||||||
@@ -1086,6 +1093,7 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
|
|||||||
|
|
||||||
return dhcp_packet_size(mess, agent_id, real_end);
|
return dhcp_packet_size(mess, agent_id, real_end);
|
||||||
|
|
||||||
|
|
||||||
case DHCPREQUEST:
|
case DHCPREQUEST:
|
||||||
if (ignore || have_config(config, CONFIG_DISABLE))
|
if (ignore || have_config(config, CONFIG_DISABLE))
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1186,6 +1194,7 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
|
|||||||
|
|
||||||
log_packet("DHCPREQUEST", &mess->yiaddr, emac, emac_len, iface_name, NULL, NULL, mess->xid);
|
log_packet("DHCPREQUEST", &mess->yiaddr, emac, emac_len, iface_name, NULL, NULL, mess->xid);
|
||||||
|
|
||||||
|
rapid_commit:
|
||||||
if (!message)
|
if (!message)
|
||||||
{
|
{
|
||||||
struct dhcp_config *addr_config;
|
struct dhcp_config *addr_config;
|
||||||
@@ -1256,7 +1265,11 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
|
|||||||
|
|
||||||
if (message)
|
if (message)
|
||||||
{
|
{
|
||||||
log_packet("DHCPNAK", &mess->yiaddr, emac, emac_len, iface_name, NULL, message, mess->xid);
|
log_packet(rapid_commit ? "NOANSWER" : "DHCPNAK", &mess->yiaddr, emac, emac_len, iface_name, NULL, message, mess->xid);
|
||||||
|
|
||||||
|
/* rapid commit case: lease allocate failed but don't send DHCPNAK */
|
||||||
|
if (rapid_commit)
|
||||||
|
return 0;
|
||||||
|
|
||||||
mess->yiaddr.s_addr = 0;
|
mess->yiaddr.s_addr = 0;
|
||||||
clear_packet(mess, end);
|
clear_packet(mess, end);
|
||||||
@@ -1419,7 +1432,9 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
|
|||||||
option_put(mess, end, OPTION_MESSAGE_TYPE, 1, DHCPACK);
|
option_put(mess, end, OPTION_MESSAGE_TYPE, 1, DHCPACK);
|
||||||
option_put(mess, end, OPTION_SERVER_IDENTIFIER, INADDRSZ, ntohl(server_id(context, override, fallback).s_addr));
|
option_put(mess, end, OPTION_SERVER_IDENTIFIER, INADDRSZ, ntohl(server_id(context, override, fallback).s_addr));
|
||||||
option_put(mess, end, OPTION_LEASE_TIME, 4, time);
|
option_put(mess, end, OPTION_LEASE_TIME, 4, time);
|
||||||
do_options(context, mess, end, req_options, hostname, get_domain(mess->yiaddr),
|
if (rapid_commit)
|
||||||
|
option_put(mess, end, OPTION_RAPID_COMMIT, 0, 0);
|
||||||
|
do_options(context, mess, end, req_options, hostname, get_domain(mess->yiaddr),
|
||||||
netid, subnet_addr, fqdn_flags, borken_opt, pxearch, uuid, vendor_class_len, now, time, fuzz);
|
netid, subnet_addr, fqdn_flags, borken_opt, pxearch, uuid, vendor_class_len, now, time, fuzz);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user