Skip to content

Commit

Permalink
vrrpd: send ND Router Advertisements
Browse files Browse the repository at this point in the history
Send ND Router Advertisements when IPv6 VR is in Master state.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
  • Loading branch information
qlyoung committed May 17, 2019
1 parent 4f52e9a commit f3fe004
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
14 changes: 11 additions & 3 deletions vrrpd/vrrp.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "vrrp_arp.h"
#include "vrrp_ndisc.h"
#include "vrrp_packet.h"
#include "vrrp_zebra.h"

#define VRRP_LOGPFX "[CORE] "

Expand Down Expand Up @@ -900,7 +901,9 @@ DEFINE_HOOK(vrrp_change_state_hook, (struct vrrp_router * r, int to), (r, to));
*/
static void vrrp_change_state_master(struct vrrp_router *r)
{
/* NOTHING */
/* Enable ND Router Advertisements */
if (r->family == AF_INET6)
vrrp_zebra_radv_set(r, true);
}

/*
Expand All @@ -911,8 +914,9 @@ static void vrrp_change_state_master(struct vrrp_router *r)
*/
static void vrrp_change_state_backup(struct vrrp_router *r)
{
/* Uninstall ARP entry for router MAC */
/* ... */
/* Disable ND Router Advertisements */
if (r->family == AF_INET6)
vrrp_zebra_radv_set(r, false);
}

/*
Expand All @@ -929,6 +933,10 @@ static void vrrp_change_state_initialize(struct vrrp_router *r)
r->vr->advertisement_interval = r->vr->advertisement_interval;
r->master_adver_interval = 0;
vrrp_recalculate_timers(r);

/* Disable ND Router Advertisements */
if (r->family == AF_INET6)
vrrp_zebra_radv_set(r, false);
}

void (*vrrp_change_state_handlers[])(struct vrrp_router *vr) = {
Expand Down
1 change: 1 addition & 0 deletions vrrpd/vrrp.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
/* Global definitions */
#define VRRP_DEFAULT_ADVINT 100
#define VRRP_DEFAULT_PRIORITY 100
#define VRRP_RADV_INT 16
#define VRRP_PRIO_MASTER 255
#define VRRP_MCASTV4_GROUP_STR "224.0.0.18"
#define VRRP_MCASTV6_GROUP_STR "ff02:0:0:0:0:0:0:12"
Expand Down
6 changes: 6 additions & 0 deletions vrrpd/vrrp_zebra.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,12 @@ static int vrrp_zebra_if_address_del(int command, struct zclient *client,
return 0;
}

void vrrp_zebra_radv_set(struct vrrp_router *r, bool enable)
{
zclient_send_interface_radv_req(zclient, VRF_DEFAULT, r->mvl_ifp,
enable, VRRP_RADV_INT);
}

void vrrp_zebra_init(void)
{
/* Socket for receiving updates from Zebra daemon */
Expand Down
1 change: 1 addition & 0 deletions vrrpd/vrrp_zebra.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@
#define __VRRP_ZEBRA_H__

extern void vrrp_zebra_init(void);
extern void vrrp_zebra_radv_set(struct vrrp_router *r, bool enable);
#endif

0 comments on commit f3fe004

Please sign in to comment.