peer-cfg: Use flags for boolean options

Makes it potentially easier to add new flags.

The mediation flag is not converted as the #ifdefs make it awkward.
This commit is contained in:
Tobias Brunner
2025-04-10 08:31:09 +02:00
parent b0a4b7f2dd
commit 6ed63be612
22 changed files with 174 additions and 167 deletions
+3 -3
View File
@@ -635,9 +635,9 @@ static peer_cfg_t *build_peer_cfg(private_stroke_config_t *this,
peer_cfg_create_t peer = {
.cert_policy = msg->add_conn.me.sendcert,
.keyingtries = msg->add_conn.rekey.tries,
.no_mobike = !msg->add_conn.mobike,
.aggressive = msg->add_conn.aggressive,
.push_mode = msg->add_conn.pushmode,
.options = (msg->add_conn.mobike ? 0 : OPT_NO_MOBIKE) |
(msg->add_conn.aggressive ? OPT_IKEV1_AGGRESSIVE : 0) |
(msg->add_conn.pushmode ? OPT_IKEV1_PUSH_MODE : 0),
.dpd = msg->add_conn.dpd.delay,
.dpd_timeout = msg->add_conn.dpd.timeout,
};
+2 -1
View File
@@ -566,7 +566,8 @@ METHOD(stroke_list_t, status, void,
fprintf(out, "%12s: %s...%s %N", peer_cfg->get_name(peer_cfg),
my_addr, other_addr, ike_version_names, ike_version);
if (ike_version == IKEV1 && peer_cfg->use_aggressive(peer_cfg))
if (ike_version == IKEV1 &&
peer_cfg->has_option(peer_cfg, OPT_IKEV1_AGGRESSIVE))
{
fprintf(out, " Aggressive");
}