Commit 52a511ce3d for frr

commit 52a511ce3d6b83ec7004fa2254d7ab9de948308d
Author: Vincent Jardin <vjardin@free.fr>
Date:   Sat Nov 21 16:18:36 2026 +0100

    zebra: address deletions on BSD broadcast interfaces

    ifam_read() passes the RTA_BRD address of an RTM_DELADDR as the peer of
    connected_delete_ipv4(), unless it is the address itself or 0.0.0.0.

    On a broadcast interface, it is the broadcast address:
    connected_check_ptp() then looks for a point-to-point entry, finds
    none, and zebra keeps an IPv4 address that the kernel deleted, with its
    connected route.

    It is related to commit fd267f0808fa ("zebra: Correct /32 addr del with
    broadcast set"), which removed the check that ignored the destination
    of the IPv4 addresses that are not /32, since if_netlink.c had stopped
    reporting the broadcast address as the destination.

    kernel_socket.c still does, so the BSDs have ignored these deletions
    until now.

    connected_add_ipv4() already drops the destination of an address of a
    broadcast interface, so only the deletions are affected.

    Use RTA_BRD as the destination on point-to-point interfaces only.

    Signed-off-by: Vincent Jardin <vjardin@free.fr>

diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c
index c98f3067a3..31498b4a2a 100644
--- a/zebra/kernel_socket.c
+++ b/zebra/kernel_socket.c
@@ -921,7 +921,7 @@ static void ifam_read_mesg(struct ifa_msghdr *ifm, union sockunion *addr,
 int ifam_read(struct ifa_msghdr *ifam)
 {
 	struct interface *ifp = NULL;
-	union sockunion addr, mask, brd, zero = { 0 };
+	union sockunion addr, mask, brd;
 	bool dest_same = false;
 	char ifname[IFNAMSIZ];
 	short ifnlen = 0;
@@ -949,17 +949,16 @@ int ifam_read(struct ifa_msghdr *ifam)
 	if (isalias)
 		SET_FLAG(flags, ZEBRA_IFA_SECONDARY);

-	/* N.B. The info in ifa_msghdr does not tell us whether the RTA_BRD
-	   field contains a broadcast address or a peer address, so we are
-	   forced to
-	   rely upon the interface type. */
+	/*
+	 * N.B. The info in ifa_msghdr does not tell us whether the RTA_BRD
+	 * field contains a broadcast address or a peer address, so we are
+	 * forced to rely upon the interface type: on a broadcast interface it
+	 * is the broadcast address, which is not a destination.
+	 */
 	if (if_is_pointopoint(ifp))
 		SET_FLAG(flags, ZEBRA_IFA_PEER);
-	else {
-		if ((memcmp(&addr, &brd, sizeof(addr)) == 0)
-		    || (memcmp(&brd, &zero, sizeof(addr)) == 0))
-			dest_same = true;
-	}
+	else
+		dest_same = true;

 #if 0
   /* it might seem cute to grab the interface metric here, however