Merge pull request #73 from fingon/pcp-int-check-mandatory-always
Internal address check is mandatory even if third party option is set.
This commit is contained in:
commit
5f288bf804
|
@ -1139,6 +1139,15 @@ static int ValidatePCPMsg(pcp_info_t *pcp_msg_info)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* RFC 6887, section 8.2: MUST return address mismatch if NAT
|
||||||
|
* in middle. */
|
||||||
|
if (memcmp(pcp_msg_info->int_ip,
|
||||||
|
&pcp_msg_info->sender_ip,
|
||||||
|
sizeof(pcp_msg_info->sender_ip)) != 0) {
|
||||||
|
pcp_msg_info->result_code = PCP_ERR_ADDRESS_MISMATCH;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (pcp_msg_info->thirdp_ip) {
|
if (pcp_msg_info->thirdp_ip) {
|
||||||
if (!GETFLAG(PCP_ALLOWTHIRDPARTYMASK)) {
|
if (!GETFLAG(PCP_ALLOWTHIRDPARTYMASK)) {
|
||||||
pcp_msg_info->result_code = PCP_ERR_UNSUPP_OPTION;
|
pcp_msg_info->result_code = PCP_ERR_UNSUPP_OPTION;
|
||||||
|
@ -1153,15 +1162,6 @@ static int ValidatePCPMsg(pcp_info_t *pcp_msg_info)
|
||||||
pcp_msg_info->result_code = PCP_ERR_MALFORMED_REQUEST;
|
pcp_msg_info->result_code = PCP_ERR_MALFORMED_REQUEST;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
/* RFC 6887, section 8.2: MUST return address mismatch if NAT
|
|
||||||
* in middle. */
|
|
||||||
if (memcmp(pcp_msg_info->int_ip,
|
|
||||||
&pcp_msg_info->sender_ip,
|
|
||||||
sizeof(pcp_msg_info->sender_ip)) != 0) {
|
|
||||||
pcp_msg_info->result_code = PCP_ERR_ADDRESS_MISMATCH;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Produce mapped_str for future use. */
|
/* Produce mapped_str for future use. */
|
||||||
|
|
Loading…
Reference in New Issue