Compare commits

...
3 Commits
Author SHA1 Message Date
Simon Kelley 429798fd08 Allow addresses as well as interface names in --auth-server. 2012-12-10 20:45:53 +00:00
Simon Kelley b5a8dd1dec Fix FTBFS with NO_DHCP. 2012-12-10 11:37:25 +00:00
Simon Kelley 95a0bd3701 Add .gitignore file. 2012-12-10 11:29:03 +00:00
5 changed files with 96 additions and 44 deletions

No files matched your search

+13
View File
@@ -0,0 +1,13 @@
src/*.o
src/*.mo
src/dnsmasq.pot
src/dnsmasq
src/.configured
contrib/wrt/dhcp_lease_time
contrib/wrt/dhcp_release
debian/base/
debian/daemon/
debian/files
debian/substvars
debian/utils-substvars
debian/utils/
+4
View File
@@ -3,6 +3,10 @@ version 2.65
TCP which are not for A and AAAA and which were directed to TCP which are not for A and AAAA and which were directed to
non-default servers. Thanks to Niax for the bug report. non-default servers. Thanks to Niax for the bug report.
Fix failure to build with DHCP support excluded. Thanks to
Gustavo Zacarias for the patch.
version 2.64 version 2.64
Handle DHCP FQDN options with all flag bits zero and Handle DHCP FQDN options with all flag bits zero and
--dhcp-client-update set. Thanks to Bernd Krumbroeck for --dhcp-client-update set. Thanks to Bernd Krumbroeck for
+2 -1
View File
@@ -755,7 +755,8 @@ extern struct daemon {
char *lease_file; char *lease_file;
char *username, *groupname, *scriptuser; char *username, *groupname, *scriptuser;
char *luascript; char *luascript;
char *authserver, *authinterface, *hostmaster; char *authserver, *hostmaster;
struct iname *authinterface;
struct name_list *secondary_forward_server; struct name_list *secondary_forward_server;
int group_set, osport; int group_set, osport;
char *domain_suffix; char *domain_suffix;
+35 -20
View File
@@ -116,15 +116,7 @@ int iface_check(int family, struct all_addr *addr, char *name, int *auth)
"used" flags. */ "used" flags. */
if (auth) if (auth)
{ *auth = 0;
if (daemon->authinterface && strcmp(daemon->authinterface, name) == 0)
{
*auth = 1;
return 1;
}
else
*auth = 0;
}
if (daemon->if_names || daemon->if_addrs) if (daemon->if_names || daemon->if_addrs)
{ {
@@ -134,25 +126,48 @@ int iface_check(int family, struct all_addr *addr, char *name, int *auth)
if (tmp->name && (strcmp(tmp->name, name) == 0)) if (tmp->name && (strcmp(tmp->name, name) == 0))
ret = tmp->used = 1; ret = tmp->used = 1;
for (tmp = daemon->if_addrs; tmp; tmp = tmp->next) if (addr)
if (tmp->addr.sa.sa_family == family) for (tmp = daemon->if_addrs; tmp; tmp = tmp->next)
{ if (tmp->addr.sa.sa_family == family)
if (family == AF_INET && {
tmp->addr.in.sin_addr.s_addr == addr->addr.addr4.s_addr) if (family == AF_INET &&
ret = tmp->used = 1; tmp->addr.in.sin_addr.s_addr == addr->addr.addr4.s_addr)
ret = tmp->used = 1;
#ifdef HAVE_IPV6 #ifdef HAVE_IPV6
else if (family == AF_INET6 && else if (family == AF_INET6 &&
IN6_ARE_ADDR_EQUAL(&tmp->addr.in6.sin6_addr, IN6_ARE_ADDR_EQUAL(&tmp->addr.in6.sin6_addr,
&addr->addr.addr6)) &addr->addr.addr6))
ret = tmp->used = 1; ret = tmp->used = 1;
#endif #endif
} }
} }
for (tmp = daemon->if_except; tmp; tmp = tmp->next) for (tmp = daemon->if_except; tmp; tmp = tmp->next)
if (tmp->name && (strcmp(tmp->name, name) == 0)) if (tmp->name && (strcmp(tmp->name, name) == 0))
ret = 0; ret = 0;
for (tmp = daemon->authinterface; tmp; tmp = tmp->next)
if (tmp->name)
{
if (strcmp(tmp->name, name) == 0)
break;
}
else if (addr && tmp->addr.sa.sa_family == AF_INET && family == AF_INET &&
tmp->addr.in.sin_addr.s_addr == addr->addr.addr4.s_addr)
break;
#ifdef HAVE_IPV6
else if (addr && tmp->addr.sa.sa_family == AF_INET6 && family == AF_INET6 &&
IN6_ARE_ADDR_EQUAL(&tmp->addr.in6.sin6_addr, &addr->addr.addr6))
break;
#endif
if (tmp && auth)
{
*auth = 1;
ret = 1;
}
return ret; return ret;
} }
+42 -23
View File
@@ -623,24 +623,6 @@ static void do_usage(void)
#define ret_err(x) do { strcpy(errstr, (x)); return 0; } while (0) #define ret_err(x) do { strcpy(errstr, (x)); return 0; } while (0)
#ifdef HAVE_DHCP
static int is_tag_prefix(char *arg)
{
if (arg && (strstr(arg, "net:") == arg || strstr(arg, "tag:") == arg))
return 1;
return 0;
}
static char *set_prefix(char *arg)
{
if (strstr(arg, "set:") == arg)
return arg+4;
return arg;
}
char *parse_server(char *arg, union mysockaddr *addr, union mysockaddr *source_addr, char *interface, int *flags) char *parse_server(char *arg, union mysockaddr *addr, union mysockaddr *source_addr, char *interface, int *flags)
{ {
int source_port = 0, serv_port = NAMESERVER_PORT; int source_port = 0, serv_port = NAMESERVER_PORT;
@@ -728,6 +710,24 @@ char *parse_server(char *arg, union mysockaddr *addr, union mysockaddr *source_a
return NULL; return NULL;
} }
#ifdef HAVE_DHCP
static int is_tag_prefix(char *arg)
{
if (arg && (strstr(arg, "net:") == arg || strstr(arg, "tag:") == arg))
return 1;
return 0;
}
static char *set_prefix(char *arg)
{
if (strstr(arg, "set:") == arg)
return arg+4;
return arg;
}
/* This is too insanely large to keep in-line in the switch */ /* This is too insanely large to keep in-line in the switch */
static int parse_dhcp_opt(char *errstr, char *arg, int flags) static int parse_dhcp_opt(char *errstr, char *arg, int flags)
{ {
@@ -1544,7 +1544,26 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
ret_err(gen_err); ret_err(gen_err);
daemon->authserver = opt_string_alloc(arg); daemon->authserver = opt_string_alloc(arg);
daemon->authinterface = opt_string_alloc(comma); arg = comma;
do {
struct iname *new = opt_malloc(sizeof(struct iname));
comma = split(arg);
new->name = NULL;
unhide_metas(arg);
if ((new->addr.in.sin_addr.s_addr = inet_addr(arg)) != (in_addr_t)-1)
new->addr.sa.sa_family = AF_INET;
#ifdef HAVE_IPV6
else if (inet_pton(AF_INET6, arg, &new->addr.in6.sin6_addr) > 0)
new->addr.sa.sa_family = AF_INET6;
#endif
else
new->name = opt_string_alloc(arg);
new->next = daemon->authinterface;
daemon->authinterface = new;
arg = comma;
} while (arg);
break; break;
@@ -1554,7 +1573,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
do { do {
comma = split(arg); comma = split(arg);
new = safe_malloc(sizeof(struct name_list)); new = opt_malloc(sizeof(struct name_list));
new->name = opt_string_alloc(arg); new->name = opt_string_alloc(arg);
new->next = daemon->secondary_forward_server; new->next = daemon->secondary_forward_server;
daemon->secondary_forward_server = new; daemon->secondary_forward_server = new;
@@ -1571,7 +1590,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
if (!comma) if (!comma)
ret_err(gen_err); ret_err(gen_err);
new = safe_malloc(sizeof(struct auth_zone)); new = opt_malloc(sizeof(struct auth_zone));
new->domain = opt_string_alloc(arg); new->domain = opt_string_alloc(arg);
new->subnet = NULL; new->subnet = NULL;
new->next = daemon->auth_zones; new->next = daemon->auth_zones;
@@ -1581,7 +1600,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
{ {
int prefixlen = 0; int prefixlen = 0;
char *prefix; char *prefix;
struct subnet *subnet = safe_malloc(sizeof(struct subnet)); struct subnet *subnet = opt_malloc(sizeof(struct subnet));
subnet->next = new->subnet; subnet->next = new->subnet;
new->subnet = subnet; new->subnet = subnet;
@@ -1660,7 +1679,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
{ {
if (comma) if (comma)
{ {
struct cond_domain *new = safe_malloc(sizeof(struct cond_domain)); struct cond_domain *new = opt_malloc(sizeof(struct cond_domain));
char *netpart; char *netpart;
unhide_metas(comma); unhide_metas(comma);