Compare commits

...
13 Commits
17 changed files with 230 additions and 105 deletions

No files matched your search

+16
View File
@@ -1,3 +1,19 @@
version 2.64
Handle DHCP FQDN options with all flag bits zero and
--dhcp-client-update set. Thanks to Bernd Krumbroeck for
spotting the problem.
Finesse the check for /etc/hosts names which conflict with
DHCP names. Previously a name/address pair in /etc/hosts
which didn't match the name/address of a DHCP lease would
generate a warning. Now that only happesn if there is not
also a match. This allows multiple addresses for a name in
/etc/hosts with one of them assigned via DHCP.
Fix broken vendor-option processing for BOOTP. Thanks to
Hans-Joachim Baader for the bug report.
version 2.63 version 2.63
Do duplicate dhcp-host address check in --test mode. Do duplicate dhcp-host address check in --test mode.
+3 -1
View File
@@ -8,6 +8,8 @@
# which has a set of references substituted into it by git. # which has a set of references substituted into it by git.
# If we can find one which matches $v[0-9].* then we assume it's # If we can find one which matches $v[0-9].* then we assume it's
# a version-number tag, else we just use the whole string. # a version-number tag, else we just use the whole string.
# If there is more than one v[0-9].* tag, sort them and use the
# first. This favours, eg v2.63 over 2.63rc6.
if which git >/dev/null 2>&1 && [ -d $1/.git ]; then if which git >/dev/null 2>&1 && [ -d $1/.git ]; then
cd $1; git describe cd $1; git describe
@@ -18,7 +20,7 @@ else
vers=`cat $1/VERSION | sed 's/[(), ]/,/ g' | tr ',' '\n' | grep $v[0-9]` vers=`cat $1/VERSION | sed 's/[(), ]/,/ g' | tr ',' '\n' | grep $v[0-9]`
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "${vers}" | head -n 1 | sed 's/^v//' echo "${vers}" | sort | head -n 1 | sed 's/^v//'
else else
cat $1/VERSION cat $1/VERSION
fi fi
+22
View File
@@ -1,3 +1,25 @@
dnsmasq (2.64-1) unstable; urgency=low
* New upstream.
-- Simon Kelley <simon@thekelleys.org.uk> Tue, 4 Sep 2012 21:50:22 +0000
dnsmasq (2.63-3) unstable; urgency=low
* Move adduser dependency to dnsmasq-base. (closes: #686694)
-- Simon Kelley <simon@thekelleys.org.uk> Tue, 4 Sep 2012 21:44:15 +0000
dnsmasq (2.63-2) unstable; urgency=low
* Fix version script to report correct version.
* Unbotch move of dbus config file by using correct versions in
Replaces: and Breaks: lines. (closes: #685204)
* Create dnsmasq user in dnsmasq-base so that Dbus doesn't complain if
only dnsmasq-base is installed. (closes: #685987)
-- Simon Kelley <simon@thekelleys.org.uk> Tue, 28 Aug 2012 16:18:35 +0000
dnsmasq (2.63-1) unstable; urgency=low dnsmasq (2.63-1) unstable; urgency=low
* New upstream. * New upstream.
+4 -4
View File
@@ -7,7 +7,7 @@ Standards-Version: 3.9.3
Package: dnsmasq Package: dnsmasq
Architecture: all Architecture: all
Depends: netbase, adduser, dnsmasq-base(>= ${source:Version}) Depends: netbase, dnsmasq-base(>= ${source:Version})
Suggests: resolvconf Suggests: resolvconf
Conflicts: resolvconf (<<1.15) Conflicts: resolvconf (<<1.15)
Description: Small caching DNS proxy and DHCP/TFTP server Description: Small caching DNS proxy and DHCP/TFTP server
@@ -22,9 +22,9 @@ Description: Small caching DNS proxy and DHCP/TFTP server
Package: dnsmasq-base Package: dnsmasq-base
Architecture: any Architecture: any
Depends: ${shlibs:Depends} Depends: adduser, ${shlibs:Depends}
Breaks: dnsmasq (<< 2.62-3) Breaks: dnsmasq (<< 2.63-1~)
Replaces: dnsmasq (<< 2.62-3) Replaces: dnsmasq (<< 2.63-1~)
Description: Small caching DNS proxy and DHCP/TFTP server Description: Small caching DNS proxy and DHCP/TFTP server
This package contains the dnsmasq executable and documentation, but This package contains the dnsmasq executable and documentation, but
not the infrastructure required to run it as a system daemon. For not the infrastructure required to run it as a system daemon. For
+24
View File
@@ -0,0 +1,24 @@
#!/bin/sh
set -e
# Create the dnsmasq user in dnsmasq-base, so that Dbus doesn't complain.
# create a user to run as (code stolen from dovecot-common)
if [ "$1" = "configure" ]; then
if [ -z "`id -u dnsmasq 2> /dev/null`" ]; then
adduser --system --home /var/lib/misc --gecos "dnsmasq" \
--no-create-home --disabled-password \
--quiet dnsmasq || true
fi
# Make the directory where we keep the pid file - this
# has to be owned by "dnsmasq" so that the file can be unlinked.
# This is only actually used by the dnsmasq binary package, not
# dnsmasq-base, but it's much easier to create it here so that
# we don't have synchronisation issues with the creation of the
# dnsmasq user.
if [ ! -d /var/run/dnsmasq ]; then
mkdir /var/run/dnsmasq
chown dnsmasq:nogroup /var/run/dnsmasq
fi
fi
+11
View File
@@ -0,0 +1,11 @@
#!/bin/sh
set -e
if [ purge = "$1" ]; then
if [ -x "$(command -v deluser)" ]; then
deluser --quiet --system dnsmasq > /dev/null || true
else
echo >&2 "not removing dnsmasq system account because deluser command was not found"
fi
rm -rf /var/run/dnsmasq
fi
-27
View File
@@ -1,27 +1,6 @@
#!/bin/sh #!/bin/sh
set -e set -e
# create a user to run as (code stolen from dovecot-common)
if [ "$1" = "configure" ]; then
if [ -z "`id -u dnsmasq 2> /dev/null`" ]; then
adduser --system --home /var/lib/misc --gecos "dnsmasq" \
--no-create-home --disabled-password \
--quiet dnsmasq || true
fi
# Make the directory where we keep the pid file - this
# has to be owned by "dnsmasq" do that the file can be unlinked.
if [ ! -d /var/run/dnsmasq ]; then
mkdir /var/run/dnsmasq
chown dnsmasq:nogroup /var/run/dnsmasq
fi
# handle new location of pidfile during an upgrade
if [ -e /var/run/dnsmasq.pid ]; then
mv /var/run/dnsmasq.pid /var/run/dnsmasq
fi
fi
if [ -x /etc/init.d/dnsmasq ]; then if [ -x /etc/init.d/dnsmasq ]; then
update-rc.d dnsmasq defaults 15 85 >/dev/null update-rc.d dnsmasq defaults 15 85 >/dev/null
@@ -40,10 +19,4 @@ if [ -x /etc/init.d/dnsmasq ]; then
fi fi
fi fi
# dpkg can botch the change of /usr/share/doc/dnsmasq from
# directory to symlink. Fix up here.
if [ ! -h /usr/share/doc/dnsmasq ] && { rmdir /usr/share/doc/dnsmasq; }; then
cd /usr/share/doc/
ln -s /usr/share/doc/dnsmasq-base dnsmasq
fi
-6
View File
@@ -3,10 +3,4 @@ set -e
if [ purge = "$1" ]; then if [ purge = "$1" ]; then
update-rc.d dnsmasq remove >/dev/null update-rc.d dnsmasq remove >/dev/null
if [ -x "$(command -v deluser)" ]; then
deluser --quiet --system dnsmasq > /dev/null || true
else
echo >&2 "not removing dnsmasq system account because deluser command was not found"
fi
rm -rf /var/run/dnsmasq
fi fi
+2
View File
@@ -129,6 +129,8 @@ ifeq (,$(findstring nodocs,$(DEB_BUILD_OPTIONS)))
gzip -9 debian/base/usr/share/doc/$(package)/DBus-interface gzip -9 debian/base/usr/share/doc/$(package)/DBus-interface
endif endif
install -m 644 debian/dnsmasq-base.conffiles debian/base/DEBIAN/conffiles install -m 644 debian/dnsmasq-base.conffiles debian/base/DEBIAN/conffiles
install -m 755 debian/dnsmasq-base.postinst debian/base/DEBIAN/postinst
install -m 755 debian/dnsmasq-base.postrm debian/base/DEBIAN/postrm
install -m 644 debian/changelog debian/base/usr/share/doc/$(package)/changelog.Debian install -m 644 debian/changelog debian/base/usr/share/doc/$(package)/changelog.Debian
gzip -9 debian/base/usr/share/doc/$(package)/changelog.Debian gzip -9 debian/base/usr/share/doc/$(package)/changelog.Debian
install -m 644 debian/readme debian/base/usr/share/doc/$(package)/README.Debian install -m 644 debian/readme debian/base/usr/share/doc/$(package)/README.Debian
+34 -28
View File
@@ -1042,7 +1042,7 @@ static void add_dhcp_cname(struct crec *target, time_t ttd)
void cache_add_dhcp_entry(char *host_name, int prot, void cache_add_dhcp_entry(char *host_name, int prot,
struct all_addr *host_address, time_t ttd) struct all_addr *host_address, time_t ttd)
{ {
struct crec *crec = NULL; struct crec *crec = NULL, *fail_crec = NULL;
unsigned short flags = F_IPV4; unsigned short flags = F_IPV4;
int in_hosts = 0; int in_hosts = 0;
size_t addrlen = sizeof(struct in_addr); size_t addrlen = sizeof(struct in_addr);
@@ -1055,28 +1055,21 @@ void cache_add_dhcp_entry(char *host_name, int prot,
} }
#endif #endif
inet_ntop(prot, host_address, daemon->addrbuff, ADDRSTRLEN);
while ((crec = cache_find_by_name(crec, host_name, 0, flags | F_CNAME))) while ((crec = cache_find_by_name(crec, host_name, 0, flags | F_CNAME)))
{ {
/* check all addresses associated with name */ /* check all addresses associated with name */
if (crec->flags & F_HOSTS) if (crec->flags & F_HOSTS)
{ {
/* if in hosts, don't need DHCP record */
in_hosts = 1;
inet_ntop(prot, host_address, daemon->addrbuff, ADDRSTRLEN);
if (crec->flags & F_CNAME) if (crec->flags & F_CNAME)
my_syslog(MS_DHCP | LOG_WARNING, my_syslog(MS_DHCP | LOG_WARNING,
_("%s is a CNAME, not giving it to the DHCP lease of %s"), _("%s is a CNAME, not giving it to the DHCP lease of %s"),
host_name, daemon->addrbuff); host_name, daemon->addrbuff);
else if (memcmp(&crec->addr.addr, host_address, addrlen) != 0) else if (memcmp(&crec->addr.addr, host_address, addrlen) == 0)
{ in_hosts = 1;
inet_ntop(prot, &crec->addr.addr, daemon->namebuff, MAXDNAME); else
my_syslog(MS_DHCP | LOG_WARNING, fail_crec = crec;
_("not giving name %s to the DHCP lease of %s because "
"the name exists in %s with address %s"),
host_name, daemon->addrbuff,
record_source(crec->uid), daemon->namebuff);
}
} }
else if (!(crec->flags & F_DHCP)) else if (!(crec->flags & F_DHCP))
{ {
@@ -1086,21 +1079,34 @@ void cache_add_dhcp_entry(char *host_name, int prot,
} }
} }
if (in_hosts) /* if in hosts, don't need DHCP record */
if (in_hosts)
return; return;
if ((crec = cache_find_by_addr(NULL, (struct all_addr *)host_address, 0, flags))) /* Name in hosts, address doesn't match */
{ if (fail_crec)
if (crec->flags & F_NEG) {
{ inet_ntop(prot, &fail_crec->addr.addr, daemon->namebuff, MAXDNAME);
flags |= F_REVERSE; my_syslog(MS_DHCP | LOG_WARNING,
cache_scan_free(NULL, (struct all_addr *)host_address, 0, flags); _("not giving name %s to the DHCP lease of %s because "
} "the name exists in %s with address %s"),
} host_name, daemon->addrbuff,
else record_source(fail_crec->uid), daemon->namebuff);
flags |= F_REVERSE; return;
}
if ((crec = dhcp_spare))
if ((crec = cache_find_by_addr(NULL, (struct all_addr *)host_address, 0, flags)))
{
if (crec->flags & F_NEG)
{
flags |= F_REVERSE;
cache_scan_free(NULL, (struct all_addr *)host_address, 0, flags);
}
}
else
flags |= F_REVERSE;
if ((crec = dhcp_spare))
dhcp_spare = dhcp_spare->next; dhcp_spare = dhcp_spare->next;
else /* need new one */ else /* need new one */
crec = whine_malloc(sizeof(struct crec)); crec = whine_malloc(sizeof(struct crec));
+44 -13
View File
@@ -383,15 +383,48 @@ int main (int argc, char **argv)
/* write pidfile _after_ forking ! */ /* write pidfile _after_ forking ! */
if (daemon->runfile) if (daemon->runfile)
{ {
FILE *pidfile; int fd, err = 0;
sprintf(daemon->namebuff, "%d\n", (int) getpid());
/* Explanation: Some installations of dnsmasq (eg Debian/Ubuntu) locate the pid-file
in a directory which is writable by the non-privileged user that dnsmasq runs as. This
allows the daemon to delete the file as part of its shutdown. This is a security hole to the
extent that an attacker running as the unprivileged user could replace the pidfile with a
symlink, and have the target of that symlink overwritten as root next time dnsmasq starts.
The folowing code first deletes any existing file, and then opens it with the O_EXCL flag,
ensuring that the open() fails should there be any existing file (because the unlink() failed,
or an attacker exploited the race between unlink() and open()). This ensures that no symlink
attack can succeed.
Any compromise of the non-privileged user still theoretically allows the pid-file to be
replaced whilst dnsmasq is running. The worst that could allow is that the usual
"shutdown dnsmasq" shell command could be tricked into stopping any other process.
Note that if dnsmasq is started as non-root (eg for testing) it silently ignores
failure to write the pid-file.
*/
unlink(daemon->runfile);
/* only complain if started as root */ if ((fd = open(daemon->runfile, O_WRONLY|O_CREAT|O_TRUNC|O_EXCL, S_IWUSR|S_IRUSR|S_IRGRP|S_IROTH)) == -1)
if ((pidfile = fopen(daemon->runfile, "w")))
{ {
fprintf(pidfile, "%d\n", (int) getpid()); /* only complain if started as root */
fclose(pidfile); if (getuid() == 0)
err = 1;
} }
else if (getuid() == 0) else
{
if (!read_write(fd, (unsigned char *)daemon->namebuff, strlen(daemon->namebuff), 0))
err = 1;
while (!err && close(fd) == -1)
if (!retry_send())
err = 1;
}
if (err)
{ {
send_event(err_pipe[1], EVENT_PIDFILE, errno, daemon->runfile); send_event(err_pipe[1], EVENT_PIDFILE, errno, daemon->runfile);
_exit(0); _exit(0);
@@ -607,7 +640,7 @@ int main (int argc, char **argv)
end = &dhcp_tmp->end6; end = &dhcp_tmp->end6;
struct in6_addr subnet = dhcp_tmp->start6; struct in6_addr subnet = dhcp_tmp->start6;
setaddr6part(&subnet, 0); setaddr6part(&subnet, 0);
inet_ntop(AF_INET6, &subnet, daemon->addrbuff, 256); inet_ntop(AF_INET6, &subnet, daemon->dhcp_buff2, 256);
} }
#endif #endif
@@ -620,10 +653,8 @@ int main (int argc, char **argv)
prettyprint_time(p, dhcp_tmp->lease_time); prettyprint_time(p, dhcp_tmp->lease_time);
} }
if (daemon->dhcp_buff) inet_ntop(family, start, daemon->dhcp_buff, 256);
inet_ntop(family, start, daemon->dhcp_buff, 256); inet_ntop(family, end, daemon->dhcp_buff3, 256);
if (daemon->dhcp_buff3)
inet_ntop(family, end, daemon->dhcp_buff3, 256);
if ((dhcp_tmp->flags & CONTEXT_DHCP) || family == AF_INET) if ((dhcp_tmp->flags & CONTEXT_DHCP) || family == AF_INET)
my_syslog(MS_DHCP | LOG_INFO, my_syslog(MS_DHCP | LOG_INFO,
(dhcp_tmp->flags & CONTEXT_RA_STATELESS) ? (dhcp_tmp->flags & CONTEXT_RA_STATELESS) ?
@@ -637,7 +668,7 @@ int main (int argc, char **argv)
if (dhcp_tmp->flags & CONTEXT_RA_NAME) if (dhcp_tmp->flags & CONTEXT_RA_NAME)
my_syslog(MS_DHCP | LOG_INFO, _("DHCPv4-derived IPv6 names on %s"), my_syslog(MS_DHCP | LOG_INFO, _("DHCPv4-derived IPv6 names on %s"),
daemon->addrbuff); daemon->dhcp_buff2);
if (dhcp_tmp->flags & (CONTEXT_RA_ONLY | CONTEXT_RA_NAME | CONTEXT_RA_STATELESS)) if (dhcp_tmp->flags & (CONTEXT_RA_ONLY | CONTEXT_RA_NAME | CONTEXT_RA_STATELESS))
{ {
if (!(dhcp_tmp->flags & CONTEXT_DEPRECATE)) if (!(dhcp_tmp->flags & CONTEXT_DEPRECATE))
@@ -647,7 +678,7 @@ int main (int argc, char **argv)
prettyprint_time(p, dhcp_tmp->lease_time > 7200 ? dhcp_tmp->lease_time : 7200); prettyprint_time(p, dhcp_tmp->lease_time > 7200 ? dhcp_tmp->lease_time : 7200);
} }
my_syslog(MS_DHCP | LOG_INFO, _("SLAAC on %s %s"), my_syslog(MS_DHCP | LOG_INFO, _("SLAAC on %s %s"),
daemon->addrbuff, daemon->namebuff); daemon->dhcp_buff2, daemon->namebuff);
} }
} }
+1
View File
@@ -992,6 +992,7 @@ struct dhcp_lease *lease4_allocate(struct in_addr addr);
struct dhcp_lease *lease6_allocate(struct in6_addr *addrp, int lease_type); struct dhcp_lease *lease6_allocate(struct in6_addr *addrp, int lease_type);
struct dhcp_lease *lease6_find(unsigned char *clid, int clid_len, struct dhcp_lease *lease6_find(unsigned char *clid, int clid_len,
int lease_type, int iaid, struct in6_addr *addr); int lease_type, int iaid, struct in6_addr *addr);
void lease6_filter(int lease_type, int iaid, struct dhcp_context *context);
struct dhcp_lease *lease6_find_by_addr(struct in6_addr *net, int prefix, u64 addr); struct dhcp_lease *lease6_find_by_addr(struct in6_addr *net, int prefix, u64 addr);
u64 lease_find_max_addr6(struct dhcp_context *context); u64 lease_find_max_addr6(struct dhcp_context *context);
void lease_ping_reply(struct in6_addr *sender, unsigned char *packet, char *interface); void lease_ping_reply(struct in6_addr *sender, unsigned char *packet, char *interface);
+20 -7
View File
@@ -562,18 +562,31 @@ struct dhcp_lease *lease6_find(unsigned char *clid, int clid_len,
memcmp(clid, lease->clid, clid_len) != 0)) memcmp(clid, lease->clid, clid_len) != 0))
continue; continue;
if (clid || addr) lease->flags |= LEASE_USED;
{ return lease;
lease->flags |= LEASE_USED;
return lease;
}
else
lease->flags &= ~LEASE_USED;
} }
return NULL; return NULL;
} }
void lease6_filter(int lease_type, int iaid, struct dhcp_context *context)
{
struct dhcp_lease *lease;
for (lease = leases; lease; lease = lease->next)
{
/* reset "USED flag */
lease->flags &= ~LEASE_USED;
if (!(lease->flags & lease_type) || lease->hwaddr_type != iaid)
continue;
/* leases on the wrong interface get filtered out here */
if (!address6_available(context, (struct in6_addr *)&lease->hwaddr, NULL))
lease->flags |= LEASE_USED;
}
}
struct dhcp_lease *lease6_find_by_addr(struct in6_addr *net, int prefix, u64 addr) struct dhcp_lease *lease6_find_by_addr(struct in6_addr *net, int prefix, u64 addr)
{ {
struct dhcp_lease *lease; struct dhcp_lease *lease;
+14 -4
View File
@@ -338,13 +338,22 @@ static int make_sock(union mysockaddr *addr, int type, int dienow)
sprintf(daemon->addrbuff, "port %d", port); sprintf(daemon->addrbuff, "port %d", port);
s = _("failed to create listening socket for %s: %s"); s = _("failed to create listening socket for %s: %s");
if (fd != -1)
close (fd);
if (dienow) if (dienow)
die(s, daemon->addrbuff, EC_BADNET); {
/* failure to bind addresses given by --listen-address at this point
is OK if we're doing bind-dynamic */
if (!option_bool(OPT_CLEVERBIND))
die(s, daemon->addrbuff, EC_BADNET);
}
else
my_syslog(LOG_WARNING, s, daemon->addrbuff, strerror(errno));
my_syslog(LOG_ERR, s, daemon->addrbuff, strerror(errno));
return -1; return -1;
} }
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) == -1 || !fix_fd(fd)) if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) == -1 || !fix_fd(fd))
goto err; goto err;
@@ -513,7 +522,8 @@ void create_bound_listeners(int dienow)
no interface with a matching address. These may be valid: eg it's possible no interface with a matching address. These may be valid: eg it's possible
to listen on 127.0.1.1 even if the loopback interface is 127.0.0.1 to listen on 127.0.1.1 even if the loopback interface is 127.0.0.1
If the address isn't valid the bind() will fail and we'll die(). If the address isn't valid the bind() will fail and we'll die()
(except in bind-dynamic mode, when we'll complain but keep trying.)
The resulting listeners have the ->iface field NULL, and this has to be The resulting listeners have the ->iface field NULL, and this has to be
handled by the DNS and TFTP code. It disables --localise-queries processing handled by the DNS and TFTP code. It disables --localise-queries processing
+19 -7
View File
@@ -493,8 +493,9 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
lease_set_interface(lease, int_index, now); lease_set_interface(lease, int_index, now);
clear_packet(mess, end); clear_packet(mess, end);
match_vendor_opts(NULL, daemon->dhcp_opts); /* clear flags */
do_options(context, mess, end, NULL, hostname, get_domain(mess->yiaddr), do_options(context, mess, end, NULL, hostname, get_domain(mess->yiaddr),
netid, subnet_addr, 0, 0, 0, NULL, 0, now); netid, subnet_addr, 0, 0, -1, NULL, 0, now);
} }
} }
@@ -515,11 +516,22 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
op += 3; op += 3;
pp = op; pp = op;
/* Always force update, since the client has no way to do it itself. */ /* NB, the following always sets at least one bit */
if (!option_bool(OPT_FQDN_UPDATE) && !(fqdn_flags & 0x01)) if (option_bool(OPT_FQDN_UPDATE))
fqdn_flags |= 0x03; {
if (fqdn_flags & 0x01)
fqdn_flags &= ~0x08; {
fqdn_flags |= 0x02; /* set O */
fqdn_flags &= ~0x01; /* clear S */
}
fqdn_flags |= 0x08; /* set N */
}
else
{
if (!(fqdn_flags & 0x01))
fqdn_flags |= 0x03; /* set S and O */
fqdn_flags &= ~0x08; /* clear N */
}
if (fqdn_flags & 0x04) if (fqdn_flags & 0x04)
while (*op != 0 && ((op + (*op) + 1) - pp) < len) while (*op != 0 && ((op + (*op) + 1) - pp) < len)
@@ -2261,7 +2273,7 @@ static void do_options(struct dhcp_context *context,
if ((p = free_space(mess, end, OPTION_CLIENT_FQDN, len))) if ((p = free_space(mess, end, OPTION_CLIENT_FQDN, len)))
{ {
*(p++) = fqdn_flags; *(p++) = fqdn_flags & 0x0f; /* MBZ bits to zero */
*(p++) = 255; *(p++) = 255;
*(p++) = 255; *(p++) = 255;
+10 -5
View File
@@ -497,7 +497,7 @@ static int dhcp6_no_relay(int msg_type, struct in6_addr *link_address, struct dh
ia_option = opt6_find(opt6_ptr(opt, ia_type == OPTION6_IA_NA ? 12 : 4), ia_end, OPTION6_IAADDR, 24); ia_option = opt6_find(opt6_ptr(opt, ia_type == OPTION6_IA_NA ? 12 : 4), ia_end, OPTION6_IAADDR, 24);
/* reset "USED" flags on leases */ /* reset "USED" flags on leases */
lease6_find(NULL, 0, ia_type == OPTION6_IA_NA ? LEASE_NA : LEASE_TA, iaid, NULL); lease6_filter(ia_type == OPTION6_IA_NA ? LEASE_NA : LEASE_TA, iaid, context);
o = new_opt6(ia_type); o = new_opt6(ia_type);
put_opt6_long(iaid); put_opt6_long(iaid);
@@ -570,7 +570,12 @@ static int dhcp6_no_relay(int msg_type, struct in6_addr *link_address, struct dh
my_syslog(MS_DHCP | LOG_WARNING, _("not using configured address %s because it was previously declined"), my_syslog(MS_DHCP | LOG_WARNING, _("not using configured address %s because it was previously declined"),
daemon->addrbuff); daemon->addrbuff);
else else
addrp = &config->addr6; {
addrp = &config->addr6;
/* may have existing lease for this address */
lease = lease6_find(clid, clid_len,
ia_type == OPTION6_IA_NA ? LEASE_NA : LEASE_TA, iaid, addrp);
}
} }
/* existing lease */ /* existing lease */
@@ -832,7 +837,7 @@ static int dhcp6_no_relay(int msg_type, struct in6_addr *link_address, struct dh
iacntr = save_counter(-1); iacntr = save_counter(-1);
/* reset "USED" flags on leases */ /* reset "USED" flags on leases */
lease6_find(NULL, 0, ia_type == OPTION6_IA_NA ? LEASE_NA : LEASE_TA, iaid, NULL); lease6_filter(ia_type == OPTION6_IA_NA ? LEASE_NA : LEASE_TA, iaid, context);
ia_option = opt6_ptr(opt, ia_type == OPTION6_IA_NA ? 12 : 4); ia_option = opt6_ptr(opt, ia_type == OPTION6_IA_NA ? 12 : 4);
ia_end = opt6_ptr(opt, opt6_len(opt)); ia_end = opt6_ptr(opt, opt6_len(opt));
@@ -1036,7 +1041,7 @@ static int dhcp6_no_relay(int msg_type, struct in6_addr *link_address, struct dh
ia_option = opt6_ptr(opt, ia_type == OPTION6_IA_NA ? 12 : 4); ia_option = opt6_ptr(opt, ia_type == OPTION6_IA_NA ? 12 : 4);
/* reset "USED" flags on leases */ /* reset "USED" flags on leases */
lease6_find(NULL, 0, ia_type == OPTION6_IA_NA ? LEASE_NA : LEASE_TA, iaid, NULL); lease6_filter(ia_type == OPTION6_IA_NA ? LEASE_NA : LEASE_TA, iaid, context);
for (ia_option = opt6_find(ia_option, ia_end, OPTION6_IAADDR, 24); for (ia_option = opt6_find(ia_option, ia_end, OPTION6_IAADDR, 24);
ia_option; ia_option;
@@ -1115,7 +1120,7 @@ static int dhcp6_no_relay(int msg_type, struct in6_addr *link_address, struct dh
ia_option = opt6_ptr(opt, ia_type == OPTION6_IA_NA ? 12 : 4); ia_option = opt6_ptr(opt, ia_type == OPTION6_IA_NA ? 12 : 4);
/* reset "USED" flags on leases */ /* reset "USED" flags on leases */
lease6_find(NULL, 0, ia_type == OPTION6_IA_NA ? LEASE_NA : LEASE_TA, iaid, NULL); lease6_filter(ia_type == OPTION6_IA_NA ? LEASE_NA : LEASE_TA, iaid, context);
for (ia_option = opt6_find(ia_option, ia_end, OPTION6_IAADDR, 24); for (ia_option = opt6_find(ia_option, ia_end, OPTION6_IAADDR, 24);
ia_option; ia_option;
+6 -3
View File
@@ -113,7 +113,6 @@ void tftp_request(struct listener *listen, time_t now)
else else
{ {
struct cmsghdr *cmptr; struct cmsghdr *cmptr;
int check;
if (msg.msg_controllen < sizeof(struct cmsghdr)) if (msg.msg_controllen < sizeof(struct cmsghdr))
return; return;
@@ -193,10 +192,14 @@ void tftp_request(struct listener *listen, time_t now)
#ifdef HAVE_IPV6 #ifdef HAVE_IPV6
if (listen->family == AF_INET6) if (listen->family == AF_INET6)
check = iface_check(AF_INET6, (struct all_addr *)&addr.in6.sin6_addr, name); {
if (!iface_check(AF_INET6, (struct all_addr *)&addr.in6.sin6_addr, name))
return;
}
else else
#endif #endif
check = iface_check(AF_INET, (struct all_addr *)&addr.in.sin_addr, name); if (!iface_check(AF_INET, (struct all_addr *)&addr.in.sin_addr, name))
return;
#ifdef HAVE_DHCP #ifdef HAVE_DHCP
/* allowed interfaces are the same as for DHCP */ /* allowed interfaces are the same as for DHCP */