mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-09 09:22:32 +00:00
zebra: consolidate connected_implicit_withdraw
connected_implicit_withdraw is used at two places and followed by exactly the same code. Move that code into connected_implicit_withdraw and give that function a more descriptive name. Signed-off-by: Christian Franke <chris@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
parent
676e1a0142
commit
d7f5dad6d1
@ -137,14 +137,10 @@ connected_same (struct connected *ifc1, struct connected *ifc2)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Handle implicit withdrawals of addresses, where a system ADDs an address
|
/* Handle changes to addresses and send the neccesary announcements
|
||||||
* to an interface which already has the same address configured.
|
* to clients. */
|
||||||
*
|
static void
|
||||||
* Returns the struct connected which must be announced to clients,
|
connected_update(struct interface *ifp, struct connected *ifc)
|
||||||
* or NULL if nothing to do.
|
|
||||||
*/
|
|
||||||
static struct connected *
|
|
||||||
connected_implicit_withdraw (struct interface *ifp, struct connected *ifc)
|
|
||||||
{
|
{
|
||||||
struct connected *current;
|
struct connected *current;
|
||||||
|
|
||||||
@ -161,13 +157,17 @@ connected_implicit_withdraw (struct interface *ifp, struct connected *ifc)
|
|||||||
{
|
{
|
||||||
/* nothing to do */
|
/* nothing to do */
|
||||||
connected_free (ifc);
|
connected_free (ifc);
|
||||||
return NULL;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Clear the configured flag on the old ifc, so it will be freed by
|
||||||
|
* connected withdraw. */
|
||||||
UNSET_FLAG(current->conf, ZEBRA_IFC_CONFIGURED);
|
UNSET_FLAG(current->conf, ZEBRA_IFC_CONFIGURED);
|
||||||
connected_withdraw (current); /* implicit withdraw - freebsd does this */
|
connected_withdraw (current); /* implicit withdraw - freebsd does this */
|
||||||
}
|
}
|
||||||
return ifc;
|
|
||||||
|
/* If the connected is new or has changed, announce it */
|
||||||
|
connected_announce(ifp, ifc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called from if_up(). */
|
/* Called from if_up(). */
|
||||||
@ -273,11 +273,7 @@ connected_add_ipv4 (struct interface *ifp, int flags, struct in_addr *addr,
|
|||||||
if (label)
|
if (label)
|
||||||
ifc->label = XSTRDUP (MTYPE_CONNECTED_LABEL, label);
|
ifc->label = XSTRDUP (MTYPE_CONNECTED_LABEL, label);
|
||||||
|
|
||||||
/* nothing to do? */
|
connected_update(ifp, ifc);
|
||||||
if ((ifc = connected_implicit_withdraw (ifp, ifc)) == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
connected_announce (ifp, ifc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -402,10 +398,7 @@ connected_add_ipv6 (struct interface *ifp, int flags, struct in6_addr *addr,
|
|||||||
if (label)
|
if (label)
|
||||||
ifc->label = XSTRDUP (MTYPE_CONNECTED_LABEL, label);
|
ifc->label = XSTRDUP (MTYPE_CONNECTED_LABEL, label);
|
||||||
|
|
||||||
if ((ifc = connected_implicit_withdraw (ifp, ifc)) == NULL)
|
connected_update(ifp, ifc);
|
||||||
return;
|
|
||||||
|
|
||||||
connected_announce (ifp, ifc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user