babeld: fix interface_recalculate function, initializing ipv4 field

In interface_recalculate function, one should initialize babel_ifp->ipv4 field.

Signed-off-by: Shbinging <bingshui@smail.nju.edu.cn>
This commit is contained in:
Shbinging 2025-03-25 20:07:09 +08:00
parent 45af7ea217
commit 72591bc8bf

View file

@ -580,6 +580,7 @@ interface_recalculate(struct interface *ifp)
int mtu, rc;
struct ipv6_mreq mreq;
babel_interface_nfo *babel_ifp = babel_get_if_nfo(ifp);
struct connected *connected;
assert (babel_ifp != NULL);
if (!IS_ENABLE(ifp))
@ -590,6 +591,14 @@ interface_recalculate(struct interface *ifp)
return -1;
}
babel_ifp->ipv4 = malloc(4);
frr_each (if_connected, ifp->connected, connected) {
if (connected->address->family == AF_INET) {
memcpy(babel_ifp->ipv4, &connected->address->u.prefix4, 4);
break;
}
}
SET_FLAG(babel_ifp->flags, BABEL_IF_IS_UP);
mtu = MIN(ifp->mtu, ifp->mtu6);