diff options
author | Simon Kelley <simon@thekelleys.org.uk> | 2013-04-02 21:35:41 +0100 |
---|---|---|
committer | Simon Kelley <simon@thekelleys.org.uk> | 2013-04-02 21:35:41 +0100 |
commit | 96c727fda6db70352deb62b861e3d6c615dd5740 (patch) | |
tree | 3dda17e18e2ae244409da8a4083be64958e00612 | |
parent | 49dc570a72145e9c46f9df762134383e2e0e12d7 (diff) | |
download | dnsmasq-96c727fda6db70352deb62b861e3d6c615dd5740.tar.gz |
Cope with duplicate dhcp-options with tags (last one wins).v2.66rc4
-rw-r--r-- | src/dhcp-common.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/dhcp-common.c b/src/dhcp-common.c index 8ddec58..f4fd088 100644 --- a/src/dhcp-common.c +++ b/src/dhcp-common.c @@ -91,6 +91,7 @@ struct dhcp_netid *option_filter(struct dhcp_netid *tags, struct dhcp_netid *con { struct dhcp_netid *tagif = run_tag_if(tags); struct dhcp_opt *opt; + struct dhcp_opt *tmp; /* flag options which are valid with the current tag set (sans context tags) */ for (opt = opts; opt; opt = opt->next) @@ -135,7 +136,6 @@ struct dhcp_netid *option_filter(struct dhcp_netid *tags, struct dhcp_netid *con for (opt = opts; opt; opt = opt->next) if (!(opt->flags & (DHOPT_ENCAPSULATE | DHOPT_VENDOR | DHOPT_RFC3925 | DHOPT_TAGOK)) && !opt->netid) { - struct dhcp_opt *tmp; for (tmp = opts; tmp; tmp = tmp->next) if (tmp->opt == opt->opt && (tmp->flags & DHOPT_TAGOK)) break; @@ -145,6 +145,13 @@ struct dhcp_netid *option_filter(struct dhcp_netid *tags, struct dhcp_netid *con my_syslog(MS_DHCP | LOG_WARNING, _("Ignoring duplicate dhcp-option %d"), tmp->opt); } + /* Finally, eliminate duplicate options later in the chain, and therefore earlier in the config file. */ + for (opt = opts; opt; opt = opt->next) + if (opt->flags & DHOPT_TAGOK) + for (tmp = opt->next; tmp; tmp = tmp->next) + if (tmp->opt == opt->opt) + tmp->flags &= ~DHOPT_TAGOK; + return tagif; } |