Added missing check for int_ip.

This commit is contained in:
Markus Stenberg 2014-05-03 08:36:32 +03:00 committed by Thomas Bernard
parent 2f5c3ce959
commit 5e5a9d39eb
1 changed files with 10 additions and 1 deletions

View File

@ -1049,6 +1049,15 @@ static int ValidatePCPMsg(pcp_info_t *pcp_msg_info)
return 0;
}
/* RFC 6887, section 8.2: MUST return address mismatch if NAT
* in middle. (XXX n/a in thirdparty case) */
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;
}
/* protocol zero means 'all protocols' : internal port MUST be zero */
if (pcp_msg_info->protocol == 0 && pcp_msg_info->int_port != 0) {
pcp_msg_info->result_code = PCP_ERR_MALFORMED_REQUEST;
@ -1459,7 +1468,7 @@ int ProcessIncomingPCPPacket(int s, unsigned char *buff, int len,
lan_addr = get_lan_for_peer(senderaddr);
if(lan_addr == NULL) {
syslog(LOG_WARNING, "SSDP packet sender %s not from a LAN, ignoring",
syslog(LOG_WARNING, "PCP packet sender %s not from a LAN, ignoring",
addr_str);
return 0;
}