Commit e45473a3 authored by Alessandro Rubini's avatar Alessandro Rubini

rvlan: when sniffing, compare with all local addresses

Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 955cf469
......@@ -87,6 +87,17 @@ struct rvlan_binmac {
};
struct rvlan_binmac *macs;
/* Use the above */
int rvlan_mac_is_local(uint8_t *address)
{
struct rvlan_binmac *mac;
for (mac = macs; mac; mac = mac->next)
if (!memcmp(address, mac->mac, ETH_ALEN))
return 1;
return 0;
}
/* Authentication of a port is a state machine */
int rvlan_fsm(struct rvlan_dev *dev, fd_set *rdset)
{
......@@ -181,9 +192,8 @@ int rvlan_fsm(struct rvlan_dev *dev, fd_set *rdset)
dev->mac[0], dev->mac[1], dev->mac[2],
dev->mac[3], dev->mac[4], dev->mac[5]);
}
/* FIXME: check with all local addresses or packet type */
if (!memcmp(frame + ETH_ALEN, dev->mac, 5))
break; /* own sending, ignore */
if (rvlan_mac_is_local(frame + ETH_ALEN))
break;
/* success, it seems */
sprintf(dev->peer_mac, "%02x%02x%02x%02x%02x%02x",
......
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