aboutsummaryrefslogtreecommitdiffstats
path: root/src/starter
diff options
context:
space:
mode:
Diffstat (limited to 'src/starter')
-rw-r--r--src/starter/args.c1
-rw-r--r--src/starter/confread.c35
-rw-r--r--src/starter/confread.h2
-rw-r--r--src/starter/keywords.h3
-rw-r--r--src/starter/keywords.txt1
-rw-r--r--src/starter/starterstroke.c2
6 files changed, 43 insertions, 1 deletions
diff --git a/src/starter/args.c b/src/starter/args.c
index 26f3aaef4..4fe9c9d27 100644
--- a/src/starter/args.c
+++ b/src/starter/args.c
@@ -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 },
diff --git a/src/starter/confread.c b/src/starter/confread.c
index e9b9028d5..6ebdaf58b 100644
--- a/src/starter/confread.c
+++ b/src/starter/confread.c
@@ -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"))
{
diff --git a/src/starter/confread.h b/src/starter/confread.h
index 5d845c2b9..ada155d7a 100644
--- a/src/starter/confread.h
+++ b/src/starter/confread.h
@@ -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;
diff --git a/src/starter/keywords.h b/src/starter/keywords.h
index 85b847230..ea702fdbc 100644
--- a/src/starter/keywords.h
+++ b/src/starter/keywords.h
@@ -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,
diff --git a/src/starter/keywords.txt b/src/starter/keywords.txt
index 894e1e94f..a9d2af42a 100644
--- a/src/starter/keywords.txt
+++ b/src/starter/keywords.txt
@@ -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
diff --git a/src/starter/starterstroke.c b/src/starter/starterstroke.c
index 6a5000761..475f07c74 100644
--- a/src/starter/starterstroke.c
+++ b/src/starter/starterstroke.c
@@ -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);