Report correct error if prefix in dhcp-range is less than 64

Update debian/rules to provide no_dhcp6 and use_lua build opts.
Log DHCPv6 information request packets.
This commit is contained in:
Simon Kelley
2012-02-10 21:19:25 +00:00
parent c6cc03ed0c
commit 627797800d
4 changed files with 25 additions and 20 deletions

28
debian/rules vendored
View File

@@ -12,7 +12,7 @@
package=dnsmasq-base package=dnsmasq-base
# policy manual, section 10.1 # policy manual, section 10.1
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS = -g -O0 -Wall -W CFLAGS = -g -O0 -Wall -W
else else
CFLAGS = -g -O2 -Wall -W CFLAGS = -g -O2 -Wall -W
@@ -23,43 +23,51 @@ TARGET = install-i18n
DEB_BUILD_ARCH_OS := $(shell dpkg-architecture -qDEB_BUILD_ARCH_OS) DEB_BUILD_ARCH_OS := $(shell dpkg-architecture -qDEB_BUILD_ARCH_OS)
ifeq (,$(findstring nodbus,$(DEB_BUILD_OPTIONS))) ifeq (,$(filter nodbus,$(DEB_BUILD_OPTIONS)))
COPTS += -DHAVE_DBUS COPTS += -DHAVE_DBUS
endif endif
ifeq (,$(findstring noconntrack,$(DEB_BUILD_OPTIONS))) ifeq (,$(filter noconntrack,$(DEB_BUILD_OPTIONS)))
ifeq ($(DEB_BUILD_ARCH_OS),linux) ifeq ($(DEB_BUILD_ARCH_OS),linux)
COPTS += -DHAVE_CONNTRACK COPTS += -DHAVE_CONNTRACK
endif endif
endif endif
ifneq (,$(findstring noipv6,$(DEB_BUILD_OPTIONS))) ifneq (,$(filter noipv6,$(DEB_BUILD_OPTIONS)))
COPTS += -DNO_IPV6 COPTS += -DNO_IPV6
endif endif
ifneq (,$(findstring notftp,$(DEB_BUILD_OPTIONS))) ifneq (,$(filter notftp,$(DEB_BUILD_OPTIONS)))
COPTS += -DNO_TFTP COPTS += -DNO_TFTP
endif endif
ifneq (,$(findstring nodhcp,$(DEB_BUILD_OPTIONS))) ifneq (,$(filter nodhcp,$(DEB_BUILD_OPTIONS)))
COPTS += -DNO_DHCP COPTS += -DNO_DHCP
endif endif
ifneq (,$(findstring noscript,$(DEB_BUILD_OPTIONS))) ifneq (,$(filter nodhcp6,$(DEB_BUILD_OPTIONS)))
COPTS += -DNO_DHCP6
endif
ifneq (,$(filter noscript,$(DEB_BUILD_OPTIONS)))
COPTS += -DNO_SCRIPT COPTS += -DNO_SCRIPT
endif endif
ifneq (,$(findstring nortc,$(DEB_BUILD_OPTIONS))) ifneq (,$(filter nortc,$(DEB_BUILD_OPTIONS)))
COPTS += -DHAVE_BROKEN_RTC COPTS += -DHAVE_BROKEN_RTC
endif endif
ifneq (,$(findstring noi18n,$(DEB_BUILD_OPTIONS))) ifneq (,$(filter noi18n,$(DEB_BUILD_OPTIONS)))
TARGET = install TARGET = install
ifeq (,$(findstring noidn, $(DEB_BUILD_OPTIONS))) ifeq (,$(filter noidn, $(DEB_BUILD_OPTIONS)))
COPTS += -DHAVE_IDN COPTS += -DHAVE_IDN
endif endif
endif endif
ifneq (,$(filter uselua,$(DEB_BUILD_OPTIONS)))
COPTS += -DHAVE_LUASCRIPT
endif
clean: clean:
$(checkdir) $(checkdir)
rm -rf debian/daemon debian/base debian/utils debian/*~ debian/files debian/substvars debian/utils-substvars rm -rf debian/daemon debian/base debian/utils debian/*~ debian/files debian/substvars debian/utils-substvars

View File

@@ -140,8 +140,6 @@ static int join_multicast(struct in6_addr *local, int prefix,
} }
void dhcp6_packet(time_t now) void dhcp6_packet(time_t now)
{ {
struct dhcp_context *context; struct dhcp_context *context;
@@ -215,8 +213,7 @@ void dhcp6_packet(time_t now)
msg.msg_iov = &daemon->dhcp_packet; msg.msg_iov = &daemon->dhcp_packet;
sz = dhcp6_reply(parm.current, if_index, ifr.ifr_name, sz, IN6_IS_ADDR_MULTICAST(&from), now); sz = dhcp6_reply(parm.current, if_index, ifr.ifr_name, sz, IN6_IS_ADDR_MULTICAST(&from), now);
/* ifr.ifr_name, if_index, (size_t)sz,
now, unicast_dest, &is_inform, pxe_fd, iface_addr); */
lease_update_file(now); lease_update_file(now);
lease_update_dns(); lease_update_dns();

View File

@@ -2336,7 +2336,7 @@ static char *one_opt(int option, char *arg, char *gen_prob, int command_line)
daemon->dhcp6 = new; daemon->dhcp6 = new;
if (strcmp(a[1], "static") == 0) if (strcmp(a[1], "static") == 0)
{ {
new->end = new->start; memcpy(&new->end6, &new->start6, IN6ADDRSZ);
new->flags |= CONTEXT_STATIC; new->flags |= CONTEXT_STATIC;
} }
else if (!inet_pton(AF_INET6, a[1], &new->end6)) else if (!inet_pton(AF_INET6, a[1], &new->end6))
@@ -2357,10 +2357,9 @@ static char *one_opt(int option, char *arg, char *gen_prob, int command_line)
problem = _("prefix must be at least 64"); problem = _("prefix must be at least 64");
} }
} }
if (!is_same_net6(&new->start6, &new->end6, new->prefix)) if (!problem && !is_same_net6(&new->start6, &new->end6, new->prefix))
problem = _("inconsistent DHCP range"); problem = _("inconsistent DHCPv6 range");
else if (addr6part(&new->start6) > addr6part(&new->end6))
if (addr6part(&new->start6) > addr6part(&new->end6))
{ {
struct in6_addr tmp = new->start6; struct in6_addr tmp = new->start6;
new->start6 = new->end6; new->start6 = new->end6;

View File

@@ -39,12 +39,12 @@ static void log6_packet(char *type, unsigned char *clid, int clid_len, struct in
static void *opt6_find (void *opts, void *end, unsigned int search, unsigned int minsize); static void *opt6_find (void *opts, void *end, unsigned int search, unsigned int minsize);
static void *opt6_next(void *opts, void *end); static void *opt6_next(void *opts, void *end);
static unsigned int opt6_uint(unsigned char *opt, int offset, int size); static unsigned int opt6_uint(unsigned char *opt, int offset, int size);
#define opt6_len(opt) ((int)(opt6_uint(opt, -2, 2))) #define opt6_len(opt) ((int)(opt6_uint(opt, -2, 2)))
#define opt6_type(opt) (opt6_uint(opt, -4, 2)) #define opt6_type(opt) (opt6_uint(opt, -4, 2))
#define opt6_ptr(opt, i) ((void *)&(((unsigned char *)(opt))[4+(i)])) #define opt6_ptr(opt, i) ((void *)&(((unsigned char *)(opt))[4+(i)]))
size_t dhcp6_reply(struct dhcp_context *context, int interface, char *iface_name, size_t sz, int is_unicast, time_t now) size_t dhcp6_reply(struct dhcp_context *context, int interface, char *iface_name, size_t sz, int is_unicast, time_t now)
{ {
struct dhcp_netid *relay_tags = NULL; struct dhcp_netid *relay_tags = NULL;
@@ -929,6 +929,7 @@ static int dhcp6_no_relay(int msg_type, struct dhcp_netid *tags, struct dhcp_con
if (ignore) if (ignore)
return 0; return 0;
*outmsgtypep = DHCP6REPLY; *outmsgtypep = DHCP6REPLY;
log6_packet("DHCPINFORMATION-REQUEST", clid, clid_len, NULL, xid, iface_name, hostname);
break; break;
} }