Merge pull request #423 from DrDoof/fix/arp-refresh-from-ip

Refresh ARP entries from incoming IP traffic
This commit is contained in:
René van Dorst authored and GitHub committed 2026-09-13 08:41:10 +00:00
commit 5e513daf17
3 files changed
+4 -9

No files matched your search

+1 -1
View File
@@ -1264,7 +1264,7 @@ void handle_rx(void)
} }
} else if (ETH_IN->ether_type == HTONS(0x0800)) { // IPv4 } else if (ETH_IN->ether_type == HTONS(0x0800)) { // IPv4
if (!management_vlan || management_vlan == rx_packet_vlan) { if (!management_vlan || management_vlan == rx_packet_vlan) {
uip_arp_ipin(); // Learn MAC addresses in TCP packets uip_arp_ipin();
uip_input(); uip_input();
if (uip_len) { if (uip_len) {
// Add ethernet frame // Add ethernet frame
+2 -6
View File
@@ -239,12 +239,9 @@ uip_arp_update(__xdata u16_t * __xdata ipaddr, __xdata struct uip_eth_addr * __x
* variable uip_len. * variable uip_len.
*/ */
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
#if 0
void void
uip_arp_ipin(void) uip_arp_ipin(void) __banked
{ {
uip_len -= sizeof(struct uip_eth_hdr);
/* Only insert/update an entry if the source IP address of the /* Only insert/update an entry if the source IP address of the
incoming IP packet comes from a host on the local network. */ incoming IP packet comes from a host on the local network. */
if((IPBUF->srcipaddr[0] & uip_netmask[0]) != if((IPBUF->srcipaddr[0] & uip_netmask[0]) !=
@@ -255,11 +252,10 @@ uip_arp_ipin(void)
(uip_hostaddr[1] & uip_netmask[1])) { (uip_hostaddr[1] & uip_netmask[1])) {
return; return;
} }
uip_arp_update(IPBUF->srcipaddr, &(IPBUF->ethhdr.src)); uip_arp_update(IPBUF->srcipaddr, &(BUF->ethhdr.src));
return; return;
} }
#endif /* 0 */
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
/** /**
* ARP processing for incoming ARP packets. * ARP processing for incoming ARP packets.
+1 -2
View File
@@ -78,8 +78,7 @@ void uip_arp_init(void) __banked;
inserts a new mapping if none exists. The function assumes that an inserts a new mapping if none exists. The function assumes that an
IP packet with an Ethernet header is present in the uip_buf buffer IP packet with an Ethernet header is present in the uip_buf buffer
and that the length of the packet is in the uip_len variable. */ and that the length of the packet is in the uip_len variable. */
/*void uip_arp_ipin(void);*/ void uip_arp_ipin(void) __banked;
#define uip_arp_ipin()
/* The uip_arp_arpin() should be called when an ARP packet is received /* The uip_arp_arpin() should be called when an ARP packet is received
by the Ethernet driver. This function also assumes that the by the Ethernet driver. This function also assumes that the