Commit 2c269dc0 authored by Adam Wujek's avatar Adam Wujek 💬 Committed by Grzegorz Daniluk

[BUG: 1361] Check the destination IP for rdate and ICMP

WRPC did now check destination IP address of incoming packets. By this WRPC
responded to the incoming packets regardless of destination IP.
It may generate an error when two nodes with the same MAC are connected to
the same network. It can happen when nodes fail to generate unique MAC.
It was observed that SNMP packets were forwarded randomly to two nodes.
Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent e4b8d99f
......@@ -130,6 +130,10 @@ static int icmp_poll(void)
if (ip_status == IP_TRAINING)
return 0;
/* check the destination IP */
if (check_dest_ip(buf))
return 0;
if ((len = process_icmp(buf, len)) > 0)
ptpd_netif_sendto(icmp_socket, &addr, buf, len, 0);
return 1;
......@@ -148,6 +152,10 @@ static int rdate_poll(void)
if (len <= 0)
return 0;
/* check the destination IP */
if (check_dest_ip(buf))
return 0;
shw_pps_gen_get_time(&secs, NULL);
result = htonl((uint32_t)(secs + 2208988800LL));
/* Magic above: $(date +%s --date="Jan 1 1900 00:00:00 UTC)" */
......
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