From 3aabf79273537b146e063e32cd0443d8a156daa2 Mon Sep 17 00:00:00 2001 From: Marina Maslova <Marina.Maslova@iopsys.eu> Date: Fri, 28 Mar 2025 12:38:14 +0400 Subject: [PATCH] use bridge interface for arping if interface is in the bridge In case of bridge kernel uses bridge MAC for regular packets. arping doesn't check routing decision and in case of passing interface from the bridge it will use interface MAC as source. This might produce conflicting ARP entry on other side, because same IP has bridge MAC and at the same time interface MAC which might differ. --- src/neigh.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/neigh.c b/src/neigh.c index cc99ae2..fe05a51 100644 --- a/src/neigh.c +++ b/src/neigh.c @@ -493,14 +493,20 @@ static void neigh_probing_timer_run(atimer_t *t) getcurrtime(&now); list_for_each_entry(x, &e->iplist, list) { + char mifname[16] = {0}; char cmd[256] = {0}; char ipbuf[46] = {0}; + int mifindex = 0; if (x->ip.family != AF_INET) continue; inet_ntop(x->ip.family, &x->ip.addr, ipbuf, sizeof(ipbuf)); - snprintf(cmd, 255, "arping -q -I %s -c 1 -w 1 -f %s &", e->ifname, ipbuf); + mifindex = if_isbridge_interface(e->ifname); + if (mifindex > 0 && if_indextoname(mifindex, mifname)) + snprintf(cmd, 255, "arping -q -I %s -c 1 -w 1 -f %s &", mifname, ipbuf); + else + snprintf(cmd, 255, "arping -q -I %s -c 1 -w 1 -f %s &", e->ifname, ipbuf); dbg("[%jd.%jd] %s\n", (uintmax_t)now.tv_sec, (uintmax_t)now.tv_usec, cmd); runCmd(cmd); /* Flawfinder: ignore */ } -- GitLab