Compare commits

...
7 changed files with 36 additions and 35 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>]
+7 -4
View File
@@ -561,10 +561,13 @@ 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);
dup2(nullfd, STDOUT_FILENO); if (nullfd != -1)
dup2(nullfd, STDERR_FILENO); {
dup2(nullfd, STDIN_FILENO); dup2(nullfd, STDOUT_FILENO);
close(nullfd); dup2(nullfd, STDERR_FILENO);
dup2(nullfd, STDIN_FILENO);
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. */
+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;
} }
+11 -7
View File
@@ -1110,17 +1110,21 @@ 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;
/* check for embeded NULLs */ if (delim == -1)
for (i = 0; i < len; i++) delim = 0;
if (data[i] == 0) else
{ /* check for embeded NULLs */
len = i; for (i = 0; i < len; i++)
break; if (data[i] == 0)
} {
len = i;
break;
}
if ((lease->extradata_size - lease->extradata_len) < (len + 1)) if ((lease->extradata_size - lease->extradata_len) < (len + 1))
{ {
+13 -19
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,13 +2772,14 @@ 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], '.') &&
(inet_pton(AF_INET, a[3], &new->broadcast) > 0)) if (k >= 4 && strchr(a[3], '.') &&
{ (inet_pton(AF_INET, a[3], &new->broadcast) > 0))
new->flags |= CONTEXT_BRDCAST; {
leasepos = 4; new->flags |= CONTEXT_BRDCAST;
leasepos = 4;
}
} }
} }
#ifdef HAVE_DHCP6 #ifdef HAVE_DHCP6
@@ -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,13 +3907,8 @@ 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))
{ ret_err(_("invalid weight"));
arg = comma;
comma = split(arg);
if (!atoi_check16(arg, &weight))
ret_err(_("invalid weight"));
}
} }
} }
} }
+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);
} }