summaryrefslogtreecommitdiffstats
path: root/babeld
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2015-05-20 03:03:45 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2015-05-20 03:03:45 +0200
commit8bb0831e232336a9d966920901216fa2098ea48a (patch)
treef3e045ec5e536cd845760399d96a70705c4818f8 /babeld
parentBGP: add addpath RX support (diff)
downloadfrr-8bb0831e232336a9d966920901216fa2098ea48a.tar.xz
frr-8bb0831e232336a9d966920901216fa2098ea48a.zip
Per AFI redist registrations
The problem is that zclient->redist[ZEBRA_ROUTE_MAX] used for storing a client’s redist state, has no address-family qualification. This means a client can only store its interest in a protocol (connected, static etc.), but cant choose IPv4 or ipv6 with that. This hindered implementation on client sides to manage redistribution of ipv4 and ipv6 both. BGP's redistribution of protocols like connected/static is one such place. One fix could be to overload this and flap the redist connection each time any new afi is added for redist, but that may have side-effects on the existing afi redist. The cleaner way is to modify redist data-structure to also take AFI, and adjust routines that deal with it, so that a client can register for a protocol redistribution based on the AFI. BGP already maintains redistribution state based on afi and protocol (bgp->redist[AFI_MAX][ZEBRA_ROUTE_MAX]). This patch takes care of filling up the gap in zclient/zserv redistribution state to also use AFI qualification. Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com> Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
Diffstat (limited to 'babeld')
-rw-r--r--babeld/babel_zebra.c25
-rw-r--r--babeld/babeld.c10
2 files changed, 24 insertions, 11 deletions
diff --git a/babeld/babel_zebra.c b/babeld/babel_zebra.c
index f584e0396..c7236d320 100644
--- a/babeld/babel_zebra.c
+++ b/babeld/babel_zebra.c
@@ -196,18 +196,23 @@ DEFUN (babel_redistribute_type,
QUAGGA_REDIST_HELP_STR_BABELD)
{
int type;
+ afi_t afi;
- type = proto_redistnum(AFI_IP6, argv[0]);
+ afi = AFI_IP6;
+ type = proto_redistnum(afi, argv[0]);
if (type < 0)
- type = proto_redistnum(AFI_IP, argv[0]);
+ {
+ afi = AFI_IP;
+ type = proto_redistnum(afi, argv[0]);
+ }
if (type < 0) {
vty_out(vty, "Invalid type %s%s", argv[0], VTY_NEWLINE);
return CMD_WARNING;
}
- zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient, type, 0);
+ zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient, afi, type, 0);
return CMD_SUCCESS;
}
@@ -220,18 +225,23 @@ DEFUN (no_babel_redistribute_type,
QUAGGA_REDIST_HELP_STR_BABELD)
{
int type;
+ afi_t afi;
- type = proto_redistnum(AFI_IP6, argv[0]);
+ afi = AFI_IP6;
+ type = proto_redistnum(afi, argv[0]);
if (type < 0)
- type = proto_redistnum(AFI_IP, argv[0]);
+ {
+ afi = AFI_IP;
+ type = proto_redistnum(afi, argv[0]);
+ }
if (type < 0) {
vty_out(vty, "Invalid type %s%s", argv[0], VTY_NEWLINE);
return CMD_WARNING;
}
- zclient_redistribute (ZEBRA_REDISTRIBUTE_DELETE, zclient, type, 0);
+ zclient_redistribute (ZEBRA_REDISTRIBUTE_DELETE, zclient, afi, type, 0);
/* perhaps should we remove xroutes having the same type... */
return CMD_SUCCESS;
}
@@ -364,7 +374,8 @@ zebra_config_write (struct vty *vty)
vty_out (vty, "no router zebra%s", VTY_NEWLINE);
return 1;
}
- else if (! zclient->redist[ZEBRA_ROUTE_BABEL].enabled)
+ else if (! (zclient->redist[AFI_IP][ZEBRA_ROUTE_BABEL].enabled ||
+ zclient->redist[AFI_IP6][ZEBRA_ROUTE_BABEL].enabled))
{
vty_out (vty, "router zebra%s", VTY_NEWLINE);
vty_out (vty, " no redistribute babel%s", VTY_NEWLINE);
diff --git a/babeld/babeld.c b/babeld/babeld.c
index 334f64c31..fff0f6131 100644
--- a/babeld/babeld.c
+++ b/babeld/babeld.c
@@ -95,6 +95,7 @@ babel_config_write (struct vty *vty)
{
int lines = 0;
int i;
+ afi_t afi;
/* list enabled debug modes */
lines += debug_babel_config_write (vty);
@@ -110,13 +111,14 @@ babel_config_write (struct vty *vty)
/* list enabled interfaces */
lines = 1 + babel_enable_if_config_write (vty);
/* list redistributed protocols */
- for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
+ for (afi = AFI_IP; afi < AFI_MAX; afi++)
+ for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
if (i != zclient->redist_default &&
- zclient->redist[i].enabled)
- {
+ zclient->redist[afi][i].enabled)
+ {
vty_out (vty, " redistribute %s%s", zebra_route_string (i), VTY_NEWLINE);
lines++;
- }
+ }
return lines;
}