Commit 3187c81e authored by Adam Wujek's avatar Adam Wujek 💬 Committed by Grzegorz Daniluk

lib/ipv4: add the function to check destination IP

This function can be used to discard packets with the wrong destination IP.
Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent 69f53c93
......@@ -205,3 +205,11 @@ void setIP(unsigned char *IP)
ip_status = IP_TRAINING;
bootp_retry = 0;
}
/* Check the destination IP of the incoming packet */
int check_dest_ip(unsigned char *buf)
{
if (!buf)
return -1;
return memcmp(buf + IP_DEST, myIP, 4);
}
......@@ -61,6 +61,7 @@ struct wr_udp_addr {
};
void fill_udp(uint8_t * buf, int len, struct wr_udp_addr *uaddr);
int check_dest_ip(unsigned char *buf);
void syslog_init(void);
int syslog_poll(void);
......
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