"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/option.c" between
dnsmasq-2.81.tar.xz and dnsmasq-2.82.tar.xz

About: Dnsmasq is a lightweight caching DNS forwarder and DHCP server.

option.c  (dnsmasq-2.81.tar.xz):option.c  (dnsmasq-2.82.tar.xz)
skipping to change at line 1225 skipping to change at line 1225
found_colon = 1; found_colon = 1;
} }
else if (c == '/') else if (c == '/')
{ {
is_addr6 = is_dec = is_hex = 0; is_addr6 = is_dec = is_hex = 0;
if (cp == comma) /* leading / means a pathname */ if (cp == comma) /* leading / means a pathname */
is_addr = 0; is_addr = 0;
} }
else if (c == '.') else if (c == '.')
{ {
is_addr6 = is_dec = is_hex = 0; is_dec = is_hex = 0;
dots++; dots++;
} }
else if (c == '-') else if (c == '-')
is_hex = is_addr = is_addr6 = 0; is_hex = is_addr = is_addr6 = 0;
else if (c == ' ') else if (c == ' ')
is_dec = is_hex = 0; is_dec = is_hex = 0;
else if (!(c >='0' && c <= '9')) else if (!(c >='0' && c <= '9'))
{ {
is_addr = 0; is_addr = 0;
if (cp[1] == 0 && is_dec && if (cp[1] == 0 && is_dec &&
skipping to change at line 2991 skipping to change at line 2991
break; break;
} }
case 'F': /* --dhcp-range */ case 'F': /* --dhcp-range */
{ {
int k, leasepos = 2; int k, leasepos = 2;
char *cp, *a[8] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; char *cp, *a[8] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
struct dhcp_context *new = opt_malloc(sizeof(struct dhcp_context)); struct dhcp_context *new = opt_malloc(sizeof(struct dhcp_context));
memset (new, 0, sizeof(*new)); memset (new, 0, sizeof(*new));
new->lease_time = DEFLEASE;
while(1) while(1)
{ {
for (cp = arg; *cp; cp++) for (cp = arg; *cp; cp++)
if (!(*cp == ' ' || *cp == '.' || *cp == ':' || if (!(*cp == ' ' || *cp == '.' || *cp == ':' ||
(*cp >= 'a' && *cp <= 'f') || (*cp >= 'A' && *cp <= 'F') || (*cp >= 'a' && *cp <= 'f') || (*cp >= 'A' && *cp <= 'F') ||
(*cp >='0' && *cp <= '9'))) (*cp >='0' && *cp <= '9')))
break; break;
if (*cp != ',' && (comma = split(arg))) if (*cp != ',' && (comma = split(arg)))
skipping to change at line 3041 skipping to change at line 3040
if (k < 2) if (k < 2)
{ {
dhcp_context_free(new); dhcp_context_free(new);
ret_err(_("bad dhcp-range")); ret_err(_("bad dhcp-range"));
} }
if (inet_pton(AF_INET, a[0], &new->start)) if (inet_pton(AF_INET, a[0], &new->start))
{ {
new->next = daemon->dhcp; new->next = daemon->dhcp;
new->lease_time = DEFLEASE;
daemon->dhcp = new; daemon->dhcp = new;
new->end = new->start; new->end = new->start;
if (strcmp(a[1], "static") == 0) if (strcmp(a[1], "static") == 0)
new->flags |= CONTEXT_STATIC; new->flags |= CONTEXT_STATIC;
else if (strcmp(a[1], "proxy") == 0) else if (strcmp(a[1], "proxy") == 0)
new->flags |= CONTEXT_PROXY; new->flags |= CONTEXT_PROXY;
else if (!inet_pton(AF_INET, a[1], &new->end)) else if (!inet_pton(AF_INET, a[1], &new->end))
{ {
dhcp_context_free(new); dhcp_context_free(new);
ret_err(_("bad dhcp-range")); ret_err(_("bad dhcp-range"));
skipping to change at line 3087 skipping to change at line 3087
} }
} }
#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))
{ {
const char *err = NULL; const char *err = NULL;
new->flags |= CONTEXT_V6; new->flags |= CONTEXT_V6;
new->prefix = 64; /* default */ new->prefix = 64; /* default */
new->end6 = new->start6; new->end6 = new->start6;
new->lease_time = DEFLEASE6;
new->next = daemon->dhcp6; new->next = daemon->dhcp6;
daemon->dhcp6 = new; daemon->dhcp6 = new;
for (leasepos = 1; leasepos < k; leasepos++) for (leasepos = 1; leasepos < k; leasepos++)
{ {
if (strcmp(a[leasepos], "static") == 0) if (strcmp(a[leasepos], "static") == 0)
new->flags |= CONTEXT_STATIC | CONTEXT_DHCP; new->flags |= CONTEXT_STATIC | CONTEXT_DHCP;
else if (strcmp(a[leasepos], "ra-only") == 0 || strcmp(a[leasepos ], "slaac") == 0 ) else if (strcmp(a[leasepos], "ra-only") == 0 || strcmp(a[leasepos ], "slaac") == 0 )
new->flags |= CONTEXT_RA; new->flags |= CONTEXT_RA;
else if (strcmp(a[leasepos], "ra-names") == 0) else if (strcmp(a[leasepos], "ra-names") == 0)
skipping to change at line 3186 skipping to change at line 3187
if (leasepos < k) if (leasepos < k)
{ {
if (leasepos != k-1) if (leasepos != k-1)
{ {
dhcp_context_free(new); dhcp_context_free(new);
ret_err(_("bad dhcp-range")); 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;
new->flags |= CONTEXT_SETLEASE;
}
else if (strcmp(a[leasepos], "deprecated") == 0) else if (strcmp(a[leasepos], "deprecated") == 0)
new->flags |= CONTEXT_DEPRECATE; new->flags |= CONTEXT_DEPRECATE;
else else
{ {
int fac = 1; int fac = 1;
if (strlen(a[leasepos]) > 0) if (strlen(a[leasepos]) > 0)
{ {
switch (a[leasepos][strlen(a[leasepos]) - 1]) switch (a[leasepos][strlen(a[leasepos]) - 1])
{ {
case 'w': case 'w':
skipping to change at line 3225 skipping to change at line 3229
} }
for (cp = a[leasepos]; *cp; cp++) for (cp = a[leasepos]; *cp; cp++)
if (!(*cp >= '0' && *cp <= '9')) if (!(*cp >= '0' && *cp <= '9'))
break; break;
if (*cp || (leasepos+1 < k)) if (*cp || (leasepos+1 < k))
ret_err_free(_("bad dhcp-range"), new); ret_err_free(_("bad dhcp-range"), new);
new->lease_time = atoi(a[leasepos]) * fac; new->lease_time = atoi(a[leasepos]) * fac;
new->flags |= CONTEXT_SETLEASE;
/* Leases of a minute or less confuse /* Leases of a minute or less confuse
some clients, notably Apple's */ some clients, notably Apple's */
if (new->lease_time < 120) if (new->lease_time < 120)
new->lease_time = 120; new->lease_time = 120;
} }
} }
} }
break; break;
} }
case LOPT_BANK: case LOPT_BANK:
case 'G': /* --dhcp-host */ case 'G': /* --dhcp-host */
{ {
struct dhcp_config *new; struct dhcp_config *new;
struct in_addr in; struct in_addr in;
new = opt_malloc(sizeof(struct dhcp_config)); new = opt_malloc(sizeof(struct dhcp_config));
 End of changes. 7 change blocks. 
3 lines changed or deleted 9 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)