Add a DSCP configuration value to IKE configs
This commit is contained in:
@@ -501,7 +501,7 @@ static gboolean connect_(NMVPNPlugin *plugin, NMConnection *connection,
|
|||||||
ike_cfg = ike_cfg_create(IKEV2, TRUE, encap, "0.0.0.0", FALSE,
|
ike_cfg = ike_cfg_create(IKEV2, TRUE, encap, "0.0.0.0", FALSE,
|
||||||
charon->socket->get_port(charon->socket, FALSE),
|
charon->socket->get_port(charon->socket, FALSE),
|
||||||
(char*)address, FALSE, IKEV2_UDP_PORT,
|
(char*)address, FALSE, IKEV2_UDP_PORT,
|
||||||
FRAGMENTATION_NO);
|
FRAGMENTATION_NO, 0);
|
||||||
ike_cfg->add_proposal(ike_cfg, proposal_create_default(PROTO_IKE));
|
ike_cfg->add_proposal(ike_cfg, proposal_create_default(PROTO_IKE));
|
||||||
peer_cfg = peer_cfg_create(priv->name, ike_cfg,
|
peer_cfg = peer_cfg_create(priv->name, ike_cfg,
|
||||||
CERT_SEND_IF_ASKED, UNIQUE_REPLACE, 1, /* keyingtries */
|
CERT_SEND_IF_ASKED, UNIQUE_REPLACE, 1, /* keyingtries */
|
||||||
@@ -718,4 +718,3 @@ NMStrongswanPlugin *nm_strongswan_plugin_new(nm_creds_t *creds,
|
|||||||
}
|
}
|
||||||
return plugin;
|
return plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ static ike_cfg_t *load_ike_config(private_config_t *this,
|
|||||||
settings->get_int(settings, "configs.%s.lport", 500, config),
|
settings->get_int(settings, "configs.%s.lport", 500, config),
|
||||||
settings->get_str(settings, "configs.%s.rhost", "%any", config), FALSE,
|
settings->get_str(settings, "configs.%s.rhost", "%any", config), FALSE,
|
||||||
settings->get_int(settings, "configs.%s.rport", 500, config),
|
settings->get_int(settings, "configs.%s.rport", 500, config),
|
||||||
FRAGMENTATION_NO);
|
FRAGMENTATION_NO, 0);
|
||||||
token = settings->get_str(settings, "configs.%s.proposal", NULL, config);
|
token = settings->get_str(settings, "configs.%s.proposal", NULL, config);
|
||||||
if (token)
|
if (token)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -472,7 +472,7 @@ static job_requeue_t initiate(private_android_service_t *this)
|
|||||||
ike_cfg = ike_cfg_create(IKEV2, TRUE, TRUE, "0.0.0.0", FALSE,
|
ike_cfg = ike_cfg_create(IKEV2, TRUE, TRUE, "0.0.0.0", FALSE,
|
||||||
charon->socket->get_port(charon->socket, FALSE),
|
charon->socket->get_port(charon->socket, FALSE),
|
||||||
this->gateway, FALSE, IKEV2_UDP_PORT,
|
this->gateway, FALSE, IKEV2_UDP_PORT,
|
||||||
FRAGMENTATION_NO);
|
FRAGMENTATION_NO, 0);
|
||||||
ike_cfg->add_proposal(ike_cfg, proposal_create_default(PROTO_IKE));
|
ike_cfg->add_proposal(ike_cfg, proposal_create_default(PROTO_IKE));
|
||||||
|
|
||||||
peer_cfg = peer_cfg_create("android", ike_cfg, CERT_SEND_IF_ASKED,
|
peer_cfg = peer_cfg_create("android", ike_cfg, CERT_SEND_IF_ASKED,
|
||||||
|
|||||||
@@ -94,6 +94,11 @@ struct private_ike_cfg_t {
|
|||||||
*/
|
*/
|
||||||
fragmentation_t fragmentation;
|
fragmentation_t fragmentation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DSCP value to use on sent IKE packets
|
||||||
|
*/
|
||||||
|
u_int8_t dscp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of proposals to use
|
* List of proposals to use
|
||||||
*/
|
*/
|
||||||
@@ -156,6 +161,12 @@ METHOD(ike_cfg_t, get_other_port, u_int16_t,
|
|||||||
return this->other_port;
|
return this->other_port;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
METHOD(ike_cfg_t, get_dscp, u_int8_t,
|
||||||
|
private_ike_cfg_t *this)
|
||||||
|
{
|
||||||
|
return this->dscp;
|
||||||
|
}
|
||||||
|
|
||||||
METHOD(ike_cfg_t, add_proposal, void,
|
METHOD(ike_cfg_t, add_proposal, void,
|
||||||
private_ike_cfg_t *this, proposal_t *proposal)
|
private_ike_cfg_t *this, proposal_t *proposal)
|
||||||
{
|
{
|
||||||
@@ -312,7 +323,7 @@ METHOD(ike_cfg_t, destroy, void,
|
|||||||
ike_cfg_t *ike_cfg_create(ike_version_t version, bool certreq, bool force_encap,
|
ike_cfg_t *ike_cfg_create(ike_version_t version, bool certreq, bool force_encap,
|
||||||
char *me, bool my_allow_any, u_int16_t my_port,
|
char *me, bool my_allow_any, u_int16_t my_port,
|
||||||
char *other, bool other_allow_any, u_int16_t other_port,
|
char *other, bool other_allow_any, u_int16_t other_port,
|
||||||
fragmentation_t fragmentation)
|
fragmentation_t fragmentation, u_int8_t dscp)
|
||||||
{
|
{
|
||||||
private_ike_cfg_t *this;
|
private_ike_cfg_t *this;
|
||||||
|
|
||||||
@@ -326,6 +337,7 @@ ike_cfg_t *ike_cfg_create(ike_version_t version, bool certreq, bool force_encap,
|
|||||||
.get_other_addr = _get_other_addr,
|
.get_other_addr = _get_other_addr,
|
||||||
.get_my_port = _get_my_port,
|
.get_my_port = _get_my_port,
|
||||||
.get_other_port = _get_other_port,
|
.get_other_port = _get_other_port,
|
||||||
|
.get_dscp = _get_dscp,
|
||||||
.add_proposal = _add_proposal,
|
.add_proposal = _add_proposal,
|
||||||
.get_proposals = _get_proposals,
|
.get_proposals = _get_proposals,
|
||||||
.select_proposal = _select_proposal,
|
.select_proposal = _select_proposal,
|
||||||
@@ -345,6 +357,7 @@ ike_cfg_t *ike_cfg_create(ike_version_t version, bool certreq, bool force_encap,
|
|||||||
.other_allow_any = other_allow_any,
|
.other_allow_any = other_allow_any,
|
||||||
.my_port = my_port,
|
.my_port = my_port,
|
||||||
.other_port = other_port,
|
.other_port = other_port,
|
||||||
|
.dscp = dscp,
|
||||||
.proposals = linked_list_create(),
|
.proposals = linked_list_create(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -107,6 +107,13 @@ struct ike_cfg_t {
|
|||||||
*/
|
*/
|
||||||
u_int16_t (*get_other_port)(ike_cfg_t *this);
|
u_int16_t (*get_other_port)(ike_cfg_t *this);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the DSCP value to use for IKE packets send from connections.
|
||||||
|
*
|
||||||
|
* @return DSCP value
|
||||||
|
*/
|
||||||
|
u_int8_t (*get_dscp)(ike_cfg_t *this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a proposal to the list.
|
* Adds a proposal to the list.
|
||||||
*
|
*
|
||||||
@@ -205,11 +212,12 @@ struct ike_cfg_t {
|
|||||||
* @param other_allow_any allow override of remote address by any address
|
* @param other_allow_any allow override of remote address by any address
|
||||||
* @param other_port IKE port to use as dest, 500 uses IKEv2 port floating
|
* @param other_port IKE port to use as dest, 500 uses IKEv2 port floating
|
||||||
* @param fragmentation use IKEv1 fragmentation
|
* @param fragmentation use IKEv1 fragmentation
|
||||||
|
* @param dscp DSCP value to send IKE packets with
|
||||||
* @return ike_cfg_t object.
|
* @return ike_cfg_t object.
|
||||||
*/
|
*/
|
||||||
ike_cfg_t *ike_cfg_create(ike_version_t version, bool certreq, bool force_encap,
|
ike_cfg_t *ike_cfg_create(ike_version_t version, bool certreq, bool force_encap,
|
||||||
char *me, bool my_allow_any, u_int16_t my_port,
|
char *me, bool my_allow_any, u_int16_t my_port,
|
||||||
char *other, bool other_allow_any, u_int16_t other_port,
|
char *other, bool other_allow_any, u_int16_t other_port,
|
||||||
fragmentation_t fragmentation);
|
fragmentation_t fragmentation, u_int8_t dscp);
|
||||||
|
|
||||||
#endif /** IKE_CFG_H_ @}*/
|
#endif /** IKE_CFG_H_ @}*/
|
||||||
|
|||||||
@@ -266,7 +266,8 @@ static job_requeue_t initiate(private_android_service_t *this)
|
|||||||
|
|
||||||
ike_cfg = ike_cfg_create(IKEV2, TRUE, FALSE, "0.0.0.0", FALSE,
|
ike_cfg = ike_cfg_create(IKEV2, TRUE, FALSE, "0.0.0.0", FALSE,
|
||||||
charon->socket->get_port(charon->socket, FALSE),
|
charon->socket->get_port(charon->socket, FALSE),
|
||||||
hostname, FALSE, IKEV2_UDP_PORT, FRAGMENTATION_NO);
|
hostname, FALSE, IKEV2_UDP_PORT, FRAGMENTATION_NO,
|
||||||
|
0);
|
||||||
ike_cfg->add_proposal(ike_cfg, proposal_create_default(PROTO_IKE));
|
ike_cfg->add_proposal(ike_cfg, proposal_create_default(PROTO_IKE));
|
||||||
|
|
||||||
peer_cfg = peer_cfg_create("android", ike_cfg, CERT_SEND_IF_ASKED,
|
peer_cfg = peer_cfg_create("android", ike_cfg, CERT_SEND_IF_ASKED,
|
||||||
@@ -386,4 +387,3 @@ android_service_t *android_service_create(android_creds_t *creds)
|
|||||||
|
|
||||||
return &this->public;
|
return &this->public;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ static void setup_tunnel(private_ha_tunnel_t *this,
|
|||||||
/* create config and backend */
|
/* create config and backend */
|
||||||
ike_cfg = ike_cfg_create(IKEV2, FALSE, FALSE, local, FALSE,
|
ike_cfg = ike_cfg_create(IKEV2, FALSE, FALSE, local, FALSE,
|
||||||
charon->socket->get_port(charon->socket, FALSE),
|
charon->socket->get_port(charon->socket, FALSE),
|
||||||
remote, FALSE, IKEV2_UDP_PORT, FRAGMENTATION_NO);
|
remote, FALSE, IKEV2_UDP_PORT, FRAGMENTATION_NO, 0);
|
||||||
ike_cfg->add_proposal(ike_cfg, proposal_create_default(PROTO_IKE));
|
ike_cfg->add_proposal(ike_cfg, proposal_create_default(PROTO_IKE));
|
||||||
peer_cfg = peer_cfg_create("ha", ike_cfg, CERT_NEVER_SEND,
|
peer_cfg = peer_cfg_create("ha", ike_cfg, CERT_NEVER_SEND,
|
||||||
UNIQUE_KEEP, 0, 86400, 0, 7200, 3600, FALSE, FALSE, 30,
|
UNIQUE_KEEP, 0, 86400, 0, 7200, 3600, FALSE, FALSE, 30,
|
||||||
@@ -288,4 +288,3 @@ ha_tunnel_t *ha_tunnel_create(char *local, char *remote, char *secret)
|
|||||||
|
|
||||||
return &this->public;
|
return &this->public;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -491,7 +491,7 @@ static peer_cfg_t* generate_config(private_load_tester_config_t *this, uint num)
|
|||||||
ike_cfg = ike_cfg_create(this->version, TRUE, FALSE,
|
ike_cfg = ike_cfg_create(this->version, TRUE, FALSE,
|
||||||
local, FALSE, this->port + num - 1,
|
local, FALSE, this->port + num - 1,
|
||||||
remote, FALSE, IKEV2_NATT_PORT,
|
remote, FALSE, IKEV2_NATT_PORT,
|
||||||
FRAGMENTATION_NO);
|
FRAGMENTATION_NO, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -499,7 +499,7 @@ static peer_cfg_t* generate_config(private_load_tester_config_t *this, uint num)
|
|||||||
local, FALSE,
|
local, FALSE,
|
||||||
charon->socket->get_port(charon->socket, FALSE),
|
charon->socket->get_port(charon->socket, FALSE),
|
||||||
remote, FALSE, IKEV2_UDP_PORT,
|
remote, FALSE, IKEV2_UDP_PORT,
|
||||||
FRAGMENTATION_NO);
|
FRAGMENTATION_NO, 0);
|
||||||
}
|
}
|
||||||
ike_cfg->add_proposal(ike_cfg, this->proposal->clone(this->proposal));
|
ike_cfg->add_proposal(ike_cfg, this->proposal->clone(this->proposal));
|
||||||
peer_cfg = peer_cfg_create("load-test", ike_cfg,
|
peer_cfg = peer_cfg_create("load-test", ike_cfg,
|
||||||
|
|||||||
@@ -325,7 +325,8 @@ static gboolean initiate_connection(private_maemo_service_t *this,
|
|||||||
|
|
||||||
ike_cfg = ike_cfg_create(IKEV2, TRUE, FALSE, "0.0.0.0", FALSE,
|
ike_cfg = ike_cfg_create(IKEV2, TRUE, FALSE, "0.0.0.0", FALSE,
|
||||||
charon->socket->get_port(charon->socket, FALSE),
|
charon->socket->get_port(charon->socket, FALSE),
|
||||||
hostname, FALSE, IKEV2_UDP_PORT, FRAGMENTATION_NO);
|
hostname, FALSE, IKEV2_UDP_PORT, FRAGMENTATION_NO,
|
||||||
|
0);
|
||||||
ike_cfg->add_proposal(ike_cfg, proposal_create_default(PROTO_IKE));
|
ike_cfg->add_proposal(ike_cfg, proposal_create_default(PROTO_IKE));
|
||||||
|
|
||||||
peer_cfg = peer_cfg_create(this->current, ike_cfg,
|
peer_cfg = peer_cfg_create(this->current, ike_cfg,
|
||||||
@@ -524,4 +525,3 @@ maemo_service_t *maemo_service_create()
|
|||||||
|
|
||||||
return &this->public;
|
return &this->public;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ METHOD(backend_t, get_peer_cfg_by_name, peer_cfg_t*,
|
|||||||
ike_cfg = ike_cfg_create(IKEV2, FALSE, FALSE,
|
ike_cfg = ike_cfg_create(IKEV2, FALSE, FALSE,
|
||||||
"0.0.0.0", FALSE,
|
"0.0.0.0", FALSE,
|
||||||
charon->socket->get_port(charon->socket, FALSE),
|
charon->socket->get_port(charon->socket, FALSE),
|
||||||
address, FALSE, IKEV2_UDP_PORT, FRAGMENTATION_NO);
|
address, FALSE, IKEV2_UDP_PORT, FRAGMENTATION_NO, 0);
|
||||||
ike_cfg->add_proposal(ike_cfg, proposal_create_default(PROTO_IKE));
|
ike_cfg->add_proposal(ike_cfg, proposal_create_default(PROTO_IKE));
|
||||||
med_cfg = peer_cfg_create(
|
med_cfg = peer_cfg_create(
|
||||||
"mediation", ike_cfg,
|
"mediation", ike_cfg,
|
||||||
@@ -381,7 +381,7 @@ medcli_config_t *medcli_config_create(database_t *db)
|
|||||||
"0.0.0.0", FALSE,
|
"0.0.0.0", FALSE,
|
||||||
charon->socket->get_port(charon->socket, FALSE),
|
charon->socket->get_port(charon->socket, FALSE),
|
||||||
"0.0.0.0", FALSE, IKEV2_UDP_PORT,
|
"0.0.0.0", FALSE, IKEV2_UDP_PORT,
|
||||||
FRAGMENTATION_NO),
|
FRAGMENTATION_NO, 0),
|
||||||
);
|
);
|
||||||
this->ike->add_proposal(this->ike, proposal_create_default(PROTO_IKE));
|
this->ike->add_proposal(this->ike, proposal_create_default(PROTO_IKE));
|
||||||
|
|
||||||
@@ -389,4 +389,3 @@ medcli_config_t *medcli_config_create(database_t *db)
|
|||||||
|
|
||||||
return &this->public;
|
return &this->public;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -143,10 +143,9 @@ medsrv_config_t *medsrv_config_create(database_t *db)
|
|||||||
"0.0.0.0", FALSE,
|
"0.0.0.0", FALSE,
|
||||||
charon->socket->get_port(charon->socket, FALSE),
|
charon->socket->get_port(charon->socket, FALSE),
|
||||||
"0.0.0.0", FALSE, IKEV2_UDP_PORT,
|
"0.0.0.0", FALSE, IKEV2_UDP_PORT,
|
||||||
FRAGMENTATION_NO),
|
FRAGMENTATION_NO, 0),
|
||||||
);
|
);
|
||||||
this->ike->add_proposal(this->ike, proposal_create_default(PROTO_IKE));
|
this->ike->add_proposal(this->ike, proposal_create_default(PROTO_IKE));
|
||||||
|
|
||||||
return &this->public;
|
return &this->public;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -262,7 +262,7 @@ static ike_cfg_t *build_ike_cfg(private_sql_config_t *this, enumerator_t *e,
|
|||||||
local, FALSE,
|
local, FALSE,
|
||||||
charon->socket->get_port(charon->socket, FALSE),
|
charon->socket->get_port(charon->socket, FALSE),
|
||||||
remote, FALSE, IKEV2_UDP_PORT,
|
remote, FALSE, IKEV2_UDP_PORT,
|
||||||
FRAGMENTATION_NO);
|
FRAGMENTATION_NO, 0);
|
||||||
add_ike_proposals(this, ike_cfg, id);
|
add_ike_proposals(this, ike_cfg, id);
|
||||||
return ike_cfg;
|
return ike_cfg;
|
||||||
}
|
}
|
||||||
@@ -620,4 +620,3 @@ sql_config_t *sql_config_create(database_t *db)
|
|||||||
|
|
||||||
return &this->public;
|
return &this->public;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -234,7 +234,8 @@ static ike_cfg_t *build_ike_cfg(private_stroke_config_t *this, stroke_msg_t *msg
|
|||||||
msg->add_conn.other.address,
|
msg->add_conn.other.address,
|
||||||
msg->add_conn.other.allow_any,
|
msg->add_conn.other.allow_any,
|
||||||
msg->add_conn.other.ikeport,
|
msg->add_conn.other.ikeport,
|
||||||
msg->add_conn.fragmentation);
|
msg->add_conn.fragmentation,
|
||||||
|
0);
|
||||||
add_proposals(this, msg->add_conn.algorithms.ike, ike_cfg, NULL);
|
add_proposals(this, msg->add_conn.algorithms.ike, ike_cfg, NULL);
|
||||||
return ike_cfg;
|
return ike_cfg;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ METHOD(enumerator_t, peer_enumerator_enumerate, bool,
|
|||||||
local_addr, FALSE,
|
local_addr, FALSE,
|
||||||
charon->socket->get_port(charon->socket, FALSE),
|
charon->socket->get_port(charon->socket, FALSE),
|
||||||
remote_addr, FALSE, IKEV2_UDP_PORT,
|
remote_addr, FALSE, IKEV2_UDP_PORT,
|
||||||
FRAGMENTATION_NO);
|
FRAGMENTATION_NO, 0);
|
||||||
ike_cfg->add_proposal(ike_cfg, create_proposal(ike_proposal, PROTO_IKE));
|
ike_cfg->add_proposal(ike_cfg, create_proposal(ike_proposal, PROTO_IKE));
|
||||||
this->peer_cfg = peer_cfg_create(
|
this->peer_cfg = peer_cfg_create(
|
||||||
name, ike_cfg, CERT_SEND_IF_ASKED, UNIQUE_NO,
|
name, ike_cfg, CERT_SEND_IF_ASKED, UNIQUE_NO,
|
||||||
@@ -255,7 +255,7 @@ METHOD(enumerator_t, ike_enumerator_enumerate, bool,
|
|||||||
local_addr, FALSE,
|
local_addr, FALSE,
|
||||||
charon->socket->get_port(charon->socket, FALSE),
|
charon->socket->get_port(charon->socket, FALSE),
|
||||||
remote_addr, FALSE, IKEV2_UDP_PORT,
|
remote_addr, FALSE, IKEV2_UDP_PORT,
|
||||||
FRAGMENTATION_NO);
|
FRAGMENTATION_NO, 0);
|
||||||
this->ike_cfg->add_proposal(this->ike_cfg,
|
this->ike_cfg->add_proposal(this->ike_cfg,
|
||||||
create_proposal(ike_proposal, PROTO_IKE));
|
create_proposal(ike_proposal, PROTO_IKE));
|
||||||
|
|
||||||
@@ -343,4 +343,3 @@ uci_config_t *uci_config_create(uci_parser_t *parser)
|
|||||||
|
|
||||||
return &this->public;
|
return &this->public;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user