[SLOF] [PATCH] dhcp: check if the DHCPOFFER matches our MAC

Nikunj A Dadhania nikunj at linux.vnet.ibm.com
Wed Jul 27 13:49:49 AEST 2016


Add missing check to see that the IP offered is for this mac address.

Signed-off-by: Nikunj A Dadhania <nikunj at linux.vnet.ibm.com>
---
 clients/net-snk/app/netlib/dhcp.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/clients/net-snk/app/netlib/dhcp.c b/clients/net-snk/app/netlib/dhcp.c
index 7e2e88c..3f45633 100644
--- a/clients/net-snk/app/netlib/dhcp.c
+++ b/clients/net-snk/app/netlib/dhcp.c
@@ -865,6 +865,8 @@ int8_t handle_dhcp(int fd, uint8_t * packet, int32_t packetsize)
 		switch (dhcp_state) {
 		case DHCP_STATE_SELECT :
 			if (opt.msg_type == DHCPOFFER) {
+				if(memcmp(btph->chaddr, get_mac_address(), 6))
+					break;
 				dhcp_own_ip = htonl(btph -> yiaddr);
 				dhcp_server_ip = opt.server_ID;
 				dhcp_send_request(fd);
-- 
2.7.4



More information about the SLOF mailing list