diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-04-13 09:39:23 -0400 | 
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-04-13 12:56:19 -0400 | 
| commit | 82557cf0043b0e73adecd4daedfaf60cf262839c (patch) | |
| tree | f1a3e46f3dda0b813ea08bfbc9faedf047aa61d6 /lib/route_types.pl | |
| parent | a6528075a83492062ed31564256dce010e8d1b3b (diff) | |
lib: Restrict redistribution cli a bit
The PBR and PIM daemons, needed the ability to connect
to zebra.  Unfortunately this connection also implied
an ability to redistribute to other valid protocols.
Add a additional hook to the route_types.pl script
to allow us to specify if the client type should
be redistributed at all.
Additionally cleanup the PIM code to not show up
as a protocol under the header for a 'show ip route'
command
Ticket: CM-20568
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'lib/route_types.pl')
| -rwxr-xr-x | lib/route_types.pl | 14 | 
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/route_types.pl b/lib/route_types.pl index 9d50acaaed..66384fe449 100755 --- a/lib/route_types.pl +++ b/lib/route_types.pl @@ -54,15 +54,15 @@ while (<STDIN>) {  	$_ =~ s/\s*,\s*/,/g; -	# else: 7-field line +	# else: 8-field line  	my @f = split(/,/, $_); -	unless (@f == 7 || @f == 8) { +	unless (@f == 8 || @f == 9) {  		die "invalid input on route_types line $.\n";  	}  	my $proto = $f[0];  	$f[3] = $1 if ($f[3] =~ /^'(.*)'$/); -	$f[6] = $1 if ($f[6] =~ /^"(.*)"$/); +	$f[7] = $1 if ($f[7] =~ /^"(.*)"$/);  	$protodetail{$proto} = {  		"number" => scalar @protos, @@ -72,8 +72,9 @@ while (<STDIN>) {  		"char" => $f[3],  		"ipv4" => int($f[4]),  		"ipv6" => int($f[5]), -		"shorthelp" => $f[6], -		"restrict2" => $f[7], +		"redist" => int($f[6]), +		"shorthelp" => $f[7], +		"restrict2" => $f[8],  	};  	push @protos, $proto;  	$daemons{$f[2]} = { @@ -136,8 +137,9 @@ sub collect {  		next if ($protodetail{$p}->{"daemon"} eq $daemon && $daemon ne "zebra");  		next if ($protodetail{$p}->{"restrict2"} ne "" &&   		         $protodetail{$p}->{"restrict2"} ne $daemon); +		next if ($protodetail{$p}->{"redist"} eq 0);  		next unless (($ipv4 && $protodetail{$p}->{"ipv4"}) -				|| ($ipv6 && $protodetail{$p}->{"ipv6"})); +			     || ($ipv6 && $protodetail{$p}->{"ipv6"}));  		push @names, $protodetail{$p}->{"cname"};  		push @help, "  \"".$protodetail{$p}->{"longhelp"}."\\n\"";  	}  | 
