summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2019-02-15 22:40:31 +0000
committerQuentin Young <qlyoung@cumulusnetworks.com>2019-05-17 00:27:08 +0000
commit114a413efa7bca86645e514cf568a8ac30023bb9 (patch)
tree6b2ce73851cd26a06c86e5f186e9bb95713b6da7
parent45505f63c5ff0e05e49e55393fa7b557a697b48c (diff)
vrrpd: check for v6 link-local before starting
Having a v6 link-local is a precondition for starting a v6 VRRP router; check that we do. Also add some helpful comments to the check-start function because good lord that thing is getting unwieldy. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
-rw-r--r--vrrpd/vrrp.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/vrrpd/vrrp.c b/vrrpd/vrrp.c
index 3c8f3fbfb3..5d97199f40 100644
--- a/vrrpd/vrrp.c
+++ b/vrrpd/vrrp.c
@@ -245,24 +245,39 @@ void vrrp_check_start(struct vrrp_vrouter *vr)
return;
r = vr->v4;
+ /* Must not already be started */
start = r->fsm.state == VRRP_STATE_INITIALIZE;
+ /* Must have a parent interface */
start = start && (vr->ifp != NULL);
+ /* Parent interface must be up */
start = start && (CHECK_FLAG(vr->ifp->flags, IFF_UP));
- start = start && vr->ifp->connected->count > 0;
+ /* Parent interface must have at least one v4 */
+ start = start && vr->ifp->connected->count > 1;
+ /* Must have a macvlan interface */
start = start && (r->mvl_ifp != NULL);
+ /* Macvlan interface must be up */
start = start && (CHECK_FLAG(r->mvl_ifp->flags, IFF_UP));
+ /* Must have at least one VIP configured */
start = start && r->addrs->count > 0;
if (start)
vrrp_event(r, VRRP_EVENT_STARTUP);
r = vr->v6;
+ /* Must not already be started */
start = r->fsm.state == VRRP_STATE_INITIALIZE;
+ /* Must have a parent interface */
start = start && (vr->ifp != NULL);
+ /* Parent interface must be up */
start = start && (CHECK_FLAG(vr->ifp->flags, IFF_UP));
- start = start && vr->ifp->connected->count;
+ /* Must have a macvlan interface */
start = start && (r->mvl_ifp != NULL);
+ /* Macvlan interface must be up */
start = start && (CHECK_FLAG(r->mvl_ifp->flags, IFF_UP));
- start = start && (r->mvl_ifp->connected->count > 0);
+ /* Macvlan interface must have at least two v6 */
+ start = start && (r->mvl_ifp->connected->count >= 2);
+ /* Macvlan interface must have a link local */
+ start = start && connected_get_linklocal(r->mvl_ifp);
+ /* Must have at least one VIP configured */
start = start && r->addrs->count > 0;
if (start)
vrrp_event(r, VRRP_EVENT_STARTUP);