Compare commits

...
7 changed files with 19 additions and 18 deletions

No files matched your search

+1 -1
View File
@@ -783,7 +783,7 @@ compiled in and the kernel must have conntrack support
included and configured. This option cannot be combined with included and configured. This option cannot be combined with
--query-port. --query-port.
.TP .TP
.B \-F, --dhcp-range=[tag:<tag>[,tag:<tag>],][set:<tag>,]<start-addr>[,<end-addr>][,<mode>][,<netmask>[,<broadcast>]][,<lease time>] .B \-F, --dhcp-range=[tag:<tag>[,tag:<tag>],][set:<tag>,]<start-addr>[,<end-addr>|<mode>][,<netmask>[,<broadcast>]][,<lease time>]
.TP .TP
.B \-F, --dhcp-range=[tag:<tag>[,tag:<tag>],][set:<tag>,]<start-IPv6addr>[,<end-IPv6addr>|constructor:<interface>][,<mode>][,<prefix-len>][,<lease time>] .B \-F, --dhcp-range=[tag:<tag>[,tag:<tag>],][set:<tag>,]<start-IPv6addr>[,<end-IPv6addr>|constructor:<interface>][,<mode>][,<prefix-len>][,<lease time>]
+3
View File
@@ -561,11 +561,14 @@ int main (int argc, char **argv)
{ {
/* open stdout etc to /dev/null */ /* open stdout etc to /dev/null */
int nullfd = open("/dev/null", O_RDWR); int nullfd = open("/dev/null", O_RDWR);
if (nullfd != -1)
{
dup2(nullfd, STDOUT_FILENO); dup2(nullfd, STDOUT_FILENO);
dup2(nullfd, STDERR_FILENO); dup2(nullfd, STDERR_FILENO);
dup2(nullfd, STDIN_FILENO); dup2(nullfd, STDIN_FILENO);
close(nullfd); close(nullfd);
} }
}
/* if we are to run scripts, we need to fork a helper before dropping root. */ /* if we are to run scripts, we need to fork a helper before dropping root. */
daemon->helperfd = -1; daemon->helperfd = -1;
+1 -1
View File
@@ -145,7 +145,7 @@ size_t add_pseudoheader(struct dns_header *header, size_t plen, unsigned char *l
if (i + len > rdlen) if (i + len > rdlen)
{ {
rdlen = 0; rdlen = 0;
islast = 0; is_last = 0;
break; break;
} }
+4
View File
@@ -1110,10 +1110,14 @@ int do_script_run(time_t now)
} }
#ifdef HAVE_SCRIPT #ifdef HAVE_SCRIPT
/* delim == -1 -> delim = 0, but embeded 0s, creating extra records, are OK. */
void lease_add_extradata(struct dhcp_lease *lease, unsigned char *data, unsigned int len, int delim) void lease_add_extradata(struct dhcp_lease *lease, unsigned char *data, unsigned int len, int delim)
{ {
unsigned int i; unsigned int i;
if (delim == -1)
delim = 0;
else
/* check for embeded NULLs */ /* check for embeded NULLs */
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
if (data[i] == 0) if (data[i] == 0)
+7 -13
View File
@@ -1990,11 +1990,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
comma = split(arg); comma = split(arg);
daemon->soa_retry = (u32)atoi(arg); daemon->soa_retry = (u32)atoi(arg);
if (comma) if (comma)
{ daemon->soa_expiry = (u32)atoi(comma);
arg = comma;
comma = split(arg);
daemon->soa_expiry = (u32)atoi(arg);
}
} }
} }
} }
@@ -2776,7 +2772,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
leasepos = 3; leasepos = 3;
if (!is_same_net(new->start, new->end, new->netmask)) if (!is_same_net(new->start, new->end, new->netmask))
ret_err(_("inconsistent DHCP range")); ret_err(_("inconsistent DHCP range"));
}
if (k >= 4 && strchr(a[3], '.') && if (k >= 4 && strchr(a[3], '.') &&
(inet_pton(AF_INET, a[3], &new->broadcast) > 0)) (inet_pton(AF_INET, a[3], &new->broadcast) > 0))
@@ -2785,6 +2781,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
leasepos = 4; leasepos = 4;
} }
} }
}
#ifdef HAVE_DHCP6 #ifdef HAVE_DHCP6
else if (inet_pton(AF_INET6, a[0], &new->start6)) else if (inet_pton(AF_INET6, a[0], &new->start6))
{ {
@@ -2872,6 +2869,9 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
if (leasepos < k) if (leasepos < k)
{ {
if (leasepos != k-1)
ret_err(_("bad dhcp-range"));
if (strcmp(a[leasepos], "infinite") == 0) if (strcmp(a[leasepos], "infinite") == 0)
new->lease_time = 0xffffffff; new->lease_time = 0xffffffff;
else if (strcmp(a[leasepos], "deprecated") == 0) else if (strcmp(a[leasepos], "deprecated") == 0)
@@ -2966,7 +2966,6 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
} }
if (len == -1) if (len == -1)
ret_err(_("bad hex constant")); ret_err(_("bad hex constant"));
else if ((new->clid = opt_malloc(len))) else if ((new->clid = opt_malloc(len)))
{ {
@@ -3908,16 +3907,11 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
if (!atoi_check16(arg, &priority)) if (!atoi_check16(arg, &priority))
ret_err(_("invalid priority")); ret_err(_("invalid priority"));
if (comma) if (comma && !atoi_check16(comma, &weight))
{
arg = comma;
comma = split(arg);
if (!atoi_check16(arg, &weight))
ret_err(_("invalid weight")); ret_err(_("invalid weight"));
} }
} }
} }
}
new = opt_malloc(sizeof(struct mx_srv_record)); new = opt_malloc(sizeof(struct mx_srv_record));
new->next = daemon->mxnames; new->next = daemon->mxnames;
+1 -1
View File
@@ -1308,7 +1308,7 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
/* If the user-class option started as counted strings, the first byte will be zero. */ /* If the user-class option started as counted strings, the first byte will be zero. */
if (len != 0 && ucp[0] == 0) if (len != 0 && ucp[0] == 0)
ucp++, len--; ucp++, len--;
lease_add_extradata(lease, ucp, len, 0); lease_add_extradata(lease, ucp, len, -1);
} }
} }
#endif #endif
+2 -2
View File
@@ -323,12 +323,12 @@ int expand_workspace(unsigned char ***wkspc, int *szp, int new)
new += 5; new += 5;
if (!(p = whine_malloc(new * sizeof(unsigned char **)))) if (!(p = whine_malloc(new * sizeof(unsigned char *))))
return 0; return 0;
if (old != 0 && *wkspc) if (old != 0 && *wkspc)
{ {
memcpy(p, *wkspc, old * sizeof(unsigned char **)); memcpy(p, *wkspc, old * sizeof(unsigned char *));
free(*wkspc); free(*wkspc);
} }