Skip to content

Commit

Permalink
net: arp: Enhance debug prints by printing interface index
Browse files Browse the repository at this point in the history
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 <jukka.rissanen@nordicsemi.no>
  • Loading branch information
jukkar committed Mar 19, 2024
1 parent 0281de3 commit 3aee9bf
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions subsys/net/l2/ethernet/arp.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 3aee9bf

Please sign in to comment.