Add tag filtering of dhcp-host directives.

This commit is contained in:
Simon Kelley
2020-02-07 21:05:54 +00:00
parent 137286e9ba
commit 52ec783613
8 changed files with 58 additions and 28 deletions

View File

@@ -963,8 +963,7 @@ static char *set_prefix(char *arg)
return arg;
}
static struct dhcp_netid *
dhcp_netid_create(const char *net, struct dhcp_netid *next)
static struct dhcp_netid *dhcp_netid_create(const char *net, struct dhcp_netid *next)
{
struct dhcp_netid *tt;
tt = opt_malloc(sizeof (struct dhcp_netid));
@@ -1029,7 +1028,8 @@ static void dhcp_config_free(struct dhcp_config *config)
}
dhcp_netid_list_free(config->netid);
dhcp_netid_free(config->filter);
if (config->flags & CONFIG_CLID)
free(config->clid);
@@ -3217,6 +3217,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
new->flags = (option == LOPT_BANK) ? CONFIG_BANK : 0;
new->hwaddr = NULL;
new->netid = NULL;
new->filter = NULL;
new->clid = NULL;
new->addr6 = NULL;
@@ -3265,11 +3266,8 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
newlist->list = dhcp_netid_create(arg+4, NULL);
}
else if (strstr(arg, "tag:") == arg)
{
dhcp_config_free(new);
ret_err(_("cannot match tags in --dhcp-host"));
}
new->filter = dhcp_netid_create(arg+4, new->filter);
#ifdef HAVE_DHCP6
else if (arg[0] == '[' && arg[strlen(arg)-1] == ']')
{