From 3aee9bf75eaabf6b554e2ec16b01174bc4e2e3fe Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Tue, 19 Mar 2024 11:02:07 +0200 Subject: [PATCH] net: arp: Enhance debug prints by printing interface index Print also network interface index together with the pointer value in order to get more useful information what is going on in the system. Signed-off-by: Jukka Rissanen --- subsys/net/l2/ethernet/arp.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/subsys/net/l2/ethernet/arp.c b/subsys/net/l2/ethernet/arp.c index 27e27b50f25b24d..07b98899b09f5a6 100644 --- a/subsys/net/l2/ethernet/arp.c +++ b/subsys/net/l2/ethernet/arp.c @@ -36,7 +36,7 @@ static struct k_mutex arp_mutex; static void arp_entry_cleanup(struct arp_entry *entry, bool pending) { - NET_DBG("%p", entry); + NET_DBG("entry %p", entry); if (pending) { struct net_pkt *pkt; @@ -64,8 +64,9 @@ static struct arp_entry *arp_entry_find(sys_slist_t *list, struct arp_entry *entry; SYS_SLIST_FOR_EACH_CONTAINER(list, entry, node) { - NET_DBG("iface %p dst %s", - iface, net_sprint_ipv4_addr(&entry->ip)); + NET_DBG("iface %d (%p) dst %s", + net_if_get_by_iface(iface), iface, + net_sprint_ipv4_addr(&entry->ip)); if (entry->iface == iface && net_ipv4_addr_cmp(&entry->ip, dst)) { @@ -690,10 +691,11 @@ enum net_verdict net_arp_input(struct net_pkt *pkt, * and the target IP address is our address. */ if (net_eth_is_addr_unspecified(&arp_hdr->dst_hwaddr)) { - NET_DBG("Updating ARP cache for %s [%s]", + NET_DBG("Updating ARP cache for %s [%s] iface %d", net_sprint_ipv4_addr(&arp_hdr->src_ipaddr), net_sprint_ll_addr((uint8_t *)&arp_hdr->src_hwaddr, - arp_hdr->hwlen)); + arp_hdr->hwlen), + net_if_get_by_iface(net_pkt_iface(pkt))); net_arp_update(net_pkt_iface(pkt), (struct in_addr *)arp_hdr->src_ipaddr,