Add Linux TAP
This commit is contained in:
@@ -20,7 +20,7 @@ void arp_monitor_init(void)
|
||||
arp_queue = xQueueCreate(ARP_QUEUE_LENGTH, sizeof(arp_event_t));
|
||||
if (arp_queue == NULL)
|
||||
{
|
||||
ESP_LOGE(TAG, "Failde to create ARP queue");
|
||||
ESP_LOGE(TAG, "Failed to create ARP queue");
|
||||
return;
|
||||
}
|
||||
ESP_LOGI(TAG, "ARP queue created");
|
||||
@@ -46,6 +46,11 @@ void arp_monitor_init(void)
|
||||
|
||||
bool arp_monitor_post_event(const arp_event_t *event)
|
||||
{
|
||||
if (event == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (arp_queue == NULL)
|
||||
{
|
||||
ESP_LOGE(TAG, "ARP queue isn't initialized");
|
||||
@@ -61,6 +66,21 @@ bool arp_monitor_post_event(const arp_event_t *event)
|
||||
return true;
|
||||
}
|
||||
|
||||
void arp_monitor_report(const ip4_addr_t *ip, const struct eth_addr *mac)
|
||||
{
|
||||
if ((ip == NULL) || (mac == NULL))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
arp_event_t event = {
|
||||
.ip = *ip
|
||||
};
|
||||
|
||||
memcpy(event.mac, mac->addr, ETH_HWADDR_LEN);
|
||||
arp_monitor_post_event(&event);
|
||||
}
|
||||
|
||||
static void process_arp_event(const arp_event_t *event)
|
||||
{
|
||||
device_info_t device = {
|
||||
@@ -88,4 +108,4 @@ static void arp_monitor_task(void *arg)
|
||||
process_arp_event(&event);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user