traffic-selector: Allow calling set_address() for any traffic selector

Users may check is_host(), is_dynamic() or includes() before calling this
if restrictions are required (most actually already do).
This commit is contained in:
Tobias Brunner
2017-02-27 18:21:02 +01:00
parent ae69863d4e
commit 2e52bbb4b2
3 changed files with 63 additions and 48 deletions
@@ -511,16 +511,24 @@ struct {
char *host;
char *after;
} set_address_tests[] = {
{ "0.0.0.0/0", "192.168.1.2", "0.0.0.0/0" },
{ "::/0", "fec2::1", "::/0" },
{ "0.0.0.0/0", "192.168.1.2", "192.168.1.2/32" },
{ "::/0", "fec2::1", "fec2::1/128" },
{ "192.168.1.2/32", "192.168.1.1", "192.168.1.1/32" },
{ "192.168.1.0/24", "192.168.1.1", "192.168.1.1/32" },
{ "192.168.1.2/32", "fec2::1", "fec2::1/128" },
{ "192.168.1.0/24", "fec2::1", "fec2::1/128" },
{ "192.168.1.2/32", "%any", "0.0.0.0/0" },
{ "192.168.1.0/24", "%any", "0.0.0.0/0" },
{ "192.168.1.2/32", "%any6", "::/0" },
{ "192.168.1.0/24", "%any6", "::/0" },
{ "fec2::1/128", "192.168.1.1", "192.168.1.1/32" },
{ "fec2::/64", "192.168.1.1", "192.168.1.1/32" },
{ "fec2::1/128", "fec2::2", "fec2::2/128" },
{ "fec2::/64", "fec2::2", "fec2::2/128" },
{ "fec2::1/128", "%any", "0.0.0.0/0" },
{ "fec2::/64", "%any", "0.0.0.0/0" },
{ "fec2::1/128", "%any6", "::/0" },
{ "fec2::/64", "%any6", "::/0" },
{ NULL, "192.168.1.1", "192.168.1.1/32" },
{ NULL, "fec2::1", "fec2::1/128" },
{ NULL, "%any", "0.0.0.0/0" },