# lwIP：ARP超时，IP 192.168.1.100的队列已满，数据包丢弃

- **ID:** `embedded/lwip-arp-timeout-queue-full`
- **领域:** embedded
- **类别:** network_error
- **验证级别:** ai_generated
- **修复率:** 88%

## 根因

远程主机的ARP解析处于挂起或失败状态，lwIP ARP队列（启用ARP_QUEUEING）已达到最大挂起数据包计数，导致新数据包被丢弃。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| lwIP v2.1.3 | active | — | — |
| STM32Cube_FW_F4 v1.28.0 | active | — | — |
| FreeRTOS v10.5.1 | active | — | — |

## 解决方案

1. ```
   在lwipopts.h中增加ARP队列大小：设置#define ARP_QUEUE_LEN 10（默认为3），允许每个未解析IP有更多挂起数据包。同时设置#define MEMP_NUM_ARP_QUEUE 10以分配内存。
   ```
2. ```
   实现手动ARP探测：使用etharp_request()从设备定期发送免费ARP，刷新邻居缓存并减少队列堆积。
   ```

## 无效尝试

- **Increase ARP table size (ARP_TABLE_SIZE) to 20** — Larger table does not affect queue depth; queue full error comes from pending ARP requests, not table entries. (85% 失败率)
- **Disable ARP queueing (set ARP_QUEUEING to 0)** — Disabling queueing drops all packets during ARP resolution, causing total connectivity loss for new connections. (90% 失败率)
