Commit 2803a0b4 authored by Jakub Adam's avatar Jakub Adam Committed by Olivier Crête

ms-ice: limit legacy connchecks as per [MS-ICE2] 3.1.4.8.2

Client should stop sending connectivity checks with legacy FINGERPRINT
when it receives a conncheck message containing IMPLEMENTATION-VERSION
attribute.

Differential Revision: https://phabricator.freedesktop.org/D1139
parent 7e5ab23c
......@@ -787,6 +787,10 @@ static void ms_ice2_legacy_conncheck_send(StunMessage *msg, NiceSocket *sock,
uint16_t fingerprint_len;
size_t buffer_len;
if (msg->agent->ms_ice2_send_legacy_connchecks == FALSE) {
return;
}
fingerprint_attr = (uint32_t *)stun_message_find (msg,
STUN_ATTRIBUTE_FINGERPRINT, &fingerprint_len);
......
......@@ -62,6 +62,8 @@ void stun_agent_init (StunAgent *agent, const uint16_t *known_attributes,
agent->compatibility = compatibility;
agent->usage_flags = usage_flags;
agent->software_attribute = NULL;
agent->ms_ice2_send_legacy_connchecks =
compatibility == STUN_COMPATIBILITY_MSICE2;
for (i = 0; i < STUN_AGENT_MAX_SAVED_IDS; i++) {
agent->sent_ids[i].valid = FALSE;
......@@ -148,6 +150,7 @@ StunValidationStatus stun_agent_validate (StunAgent *agent, StunMessage *msg,
uint8_t *hash;
uint8_t sha[20];
uint16_t hlen;
uint32_t implementation_version;
int sent_id_idx = -1;
uint16_t unknown;
int error_code;
......@@ -335,6 +338,12 @@ StunValidationStatus stun_agent_validate (StunAgent *agent, StunMessage *msg,
agent->sent_ids[sent_id_idx].valid = FALSE;
}
/* [MS-ICE2] 3.1.4.8.2 stop sending additional connectivity checks */
if (stun_message_find32(msg, STUN_ATTRIBUTE_MS_IMPLEMENTATION_VERSION,
&implementation_version) == STUN_MESSAGE_RETURN_SUCCESS) {
msg->agent->ms_ice2_send_legacy_connchecks = FALSE;
}
if (stun_agent_find_unknowns (agent, msg, &unknown, 1) > 0) {
if (stun_message_get_class (msg) == STUN_REQUEST)
return STUN_VALIDATION_UNKNOWN_REQUEST_ATTRIBUTE;
......
......@@ -203,6 +203,7 @@ struct stun_agent_t {
uint16_t *known_attributes;
StunAgentUsageFlags usage_flags;
const char *software_attribute;
bool ms_ice2_send_legacy_connchecks;
};
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment