support of xfrm marks for IKEv2
This commit is contained in:
@@ -235,6 +235,7 @@ static const token_info_t token_info[] =
|
||||
{ ARG_STR, offsetof(starter_conn_t, me_mediated_by), NULL },
|
||||
{ ARG_STR, offsetof(starter_conn_t, me_peerid), NULL },
|
||||
{ ARG_UINT, offsetof(starter_conn_t, reqid), NULL },
|
||||
{ ARG_MISC, 0, NULL /* KW_MARK */ },
|
||||
|
||||
/* ca section keywords */
|
||||
{ ARG_STR, offsetof(starter_ca_t, name), NULL },
|
||||
|
||||
@@ -671,6 +671,41 @@ static void load_conn(starter_conn_t *conn, kw_list_t *kw, starter_config_t *cfg
|
||||
}
|
||||
break;
|
||||
}
|
||||
case KW_MARK:
|
||||
{
|
||||
char *pos, *endptr;
|
||||
|
||||
pos = strchr(kw->value, '/');
|
||||
if (pos)
|
||||
{
|
||||
*pos = '\0';
|
||||
conn->mark_mask = strtoul(pos+1, &endptr, 0);
|
||||
if (*endptr != '\0')
|
||||
{
|
||||
plog("# invalid mark mask: %s", pos+1);
|
||||
cfg->err++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
conn->mark_mask = 0xffffffff;
|
||||
}
|
||||
if (*kw->value == '\0')
|
||||
{
|
||||
conn->mark_value = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
conn->mark_value = strtoul(kw->value, &endptr, 0);
|
||||
if (*endptr != '\0')
|
||||
{
|
||||
plog("# invalid mark value: %s", kw->value);
|
||||
cfg->err++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case KW_KEYINGTRIES:
|
||||
if (streq(kw->value, "%forever"))
|
||||
{
|
||||
|
||||
@@ -122,6 +122,8 @@ struct starter_conn {
|
||||
unsigned long sa_keying_tries;
|
||||
unsigned long sa_rekey_fuzz;
|
||||
u_int32_t reqid;
|
||||
u_int32_t mark_value;
|
||||
u_int32_t mark_mask;
|
||||
sa_family_t addr_family;
|
||||
sa_family_t tunnel_addr_family;
|
||||
bool install_policy;
|
||||
|
||||
@@ -98,9 +98,10 @@ typedef enum {
|
||||
KW_MEDIATED_BY,
|
||||
KW_ME_PEERID,
|
||||
KW_REQID,
|
||||
KW_MARK,
|
||||
|
||||
#define KW_CONN_FIRST KW_CONN_SETUP
|
||||
#define KW_CONN_LAST KW_REQID
|
||||
#define KW_CONN_LAST KW_MARK
|
||||
|
||||
/* ca section keywords */
|
||||
KW_CA_NAME,
|
||||
|
||||
@@ -89,6 +89,7 @@ mediation, KW_MEDIATION
|
||||
mediated_by, KW_MEDIATED_BY
|
||||
me_peerid, KW_ME_PEERID
|
||||
reqid, KW_REQID
|
||||
mark, KW_MARK
|
||||
cacert, KW_CACERT
|
||||
ldaphost, KW_LDAPHOST
|
||||
ldapbase, KW_LDAPBASE
|
||||
|
||||
@@ -270,6 +270,8 @@ int starter_stroke_add_conn(starter_config_t *cfg, starter_conn_t *conn)
|
||||
msg.add_conn.ikeme.mediated_by = push_string(&msg, conn->me_mediated_by);
|
||||
msg.add_conn.ikeme.peerid = push_string(&msg, conn->me_peerid);
|
||||
msg.add_conn.reqid = conn->reqid;
|
||||
msg.add_conn.mark.value = conn->mark_value;
|
||||
msg.add_conn.mark.mask = conn->mark_mask;
|
||||
|
||||
starter_stroke_add_end(&msg, &msg.add_conn.me, &conn->left);
|
||||
starter_stroke_add_end(&msg, &msg.add_conn.other, &conn->right);
|
||||
|
||||
Reference in New Issue
Block a user