bootp: Prevent u-boot from using others responses.
authorAnton Persson <don.juanton@gmail.com>
Thu, 17 Mar 2016 08:38:21 +0000 (09:38 +0100)
committerTom Rini <trini@konsulko.com>
Sun, 27 Mar 2016 13:12:21 +0000 (09:12 -0400)
In rare circumstances two dhcp clients may generate the same
bootp ID. If this happens it is vital that the client also checks
the hw address in the received response to prevent IP address conflicts.

Signed-off-by: Anton Persson <don.juanton@gmail.com>
net/bootp.c

index aefc808391ac35eebafedef81686f047dfa98037..d7852dbb447a123b5e45af89e6483b5d5c3a9a53 100644 (file)
@@ -132,6 +132,8 @@ static int check_reply_packet(uchar *pkt, unsigned dest, unsigned src,
                retval = -5;
        else if (!bootp_match_id(net_read_u32(&bp->bp_id)))
                retval = -6;
+       else if (memcmp(bp->bp_chaddr, net_ethaddr, HWL_ETHER) != 0)
+               retval = -7;
 
        debug("Filtering pkt = %d\n", retval);