[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] [lwip] ARP bug (compare MAC instead of IP)
From: |
leon . woestenberg |
Subject: |
[lwip-users] [lwip] ARP bug (compare MAC instead of IP) |
Date: |
Wed, 08 Jan 2003 22:27:17 -0000 |
Hello Adam,
in the ARP code, when adding an (MAC, IP) entry, you use IP
addresses to compare. You should, however, use the MAC
addresses to find an old entry.
----
To see what goes wrong, using IP address compare, an example:
Suppose client with MAC 01:02:03:04:05:06 has obtained
IP address 192.168.0.2, and by whatever means, is configured
to use 192.168.0.3 now.
Adding this (MAC, IP) mapping will not find the old entry, and create
a new entry in the ARP cache. The ARP cache will now hold two
mappings with the same MAC address.
----
static void
add_arp_entry(struct ip_addr *ipaddr, struct eth_addr *ethaddr)
{
u8_t i, j, k;
u8_t maxage;
/* Walk through the ARP mapping table and try to find an entry to
update. If none is found, the IP -> MAC address mapping is
inserted in the ARP table. */
for(i = 0; i < ARPTABLE_SIZE; ++i) {
/* Only check those entries that are actually in use. */
if(!ip_addr_isany(&arp_table[i].ipaddr)) {
/* Check if the source IP address of the incoming packet matches
the IP address in this ARP table entry. */
if(ip_addr_cmp(ipaddr, &arp_table[i].ipaddr)) {
<--------------------------- should test MAC bytes here, not IP address
/* An old entry found, update this and return. */
[This message was sent through the lwip discussion list.]
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lwip-users] [lwip] ARP bug (compare MAC instead of IP),
leon . woestenberg <=