ipsec-types: Restrict the use of %unique and other keywords when parsing marks
%unique (and the upcoming %same key) are usable in specific contexts only. To restrict the user from using it in other places where it does not get the expected results, reject such keywords unless explicitly allowed.
This commit is contained in:
committed by
Tobias Brunner
parent
b9aacf9adc
commit
ebd2d3877e
@@ -2925,7 +2925,7 @@ static status_t manage_rule(private_kernel_netlink_net_t *this, int nlmsg_type,
|
||||
msg->rtm_flags |= FIB_RULE_INVERT;
|
||||
fwmark++;
|
||||
}
|
||||
if (mark_from_string(fwmark, &mark))
|
||||
if (mark_from_string(fwmark, MARK_OP_NONE, &mark))
|
||||
{
|
||||
chunk = chunk_from_thing(mark.value);
|
||||
netlink_add_attribute(hdr, FRA_FWMARK, chunk, sizeof(request));
|
||||
|
||||
@@ -745,7 +745,7 @@ static int open_socket(private_socket_default_socket_t *this,
|
||||
|
||||
fwmark = lib->settings->get_str(lib->settings,
|
||||
"%s.plugins.socket-default.fwmark", NULL, lib->ns);
|
||||
if (fwmark && mark_from_string(fwmark, &mark))
|
||||
if (fwmark && mark_from_string(fwmark, MARK_OP_NONE, &mark))
|
||||
{
|
||||
if (setsockopt(skt, SOL_SOCKET, SO_MARK, &mark.value,
|
||||
sizeof(mark.value)) < 0)
|
||||
|
||||
@@ -1181,7 +1181,7 @@ CALLBACK(parse_mark, bool,
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
return mark_from_string(buf, out);
|
||||
return mark_from_string(buf, MARK_OP_UNIQUE, out);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user