Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: Remove System routes from ip protocol route map choices #17953

Merged
merged 1 commit into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions doc/user/zebra.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1133,10 +1133,8 @@ kernel.
- any,
- babel,
- bgp,
- connected,
- eigrp,
- isis,
- kernel,
- nhrp,
- openfabric,
- ospf,
Expand Down
15 changes: 9 additions & 6 deletions lib/route_types.pl
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,12 @@ sub codelist {
print "\n";

sub collect {
my ($daemon, $ipv4, $ipv6, $any) = @_;
my ($daemon, $ipv4, $ipv6, $any, $ip_prot) = @_;
my (@names, @help) = ((), ());
for my $p (@protos) {
next if ($ip_prot == 1 && $daemon eq "zebra" && $protodetail{$p}->{"cname"} eq "kernel");
next if ($ip_prot == 1 && $daemon eq "zebra" && $protodetail{$p}->{"cname"} eq "connected");
next if ($ip_prot == 1 && $daemon eq "zebra" && $protodetail{$p}->{"cname"} eq "local");
next if ($protodetail{$p}->{"daemon"} eq $daemon && $daemon ne "zebra");
next if ($protodetail{$p}->{"restrict2"} ne "" &&
$protodetail{$p}->{"restrict2"} ne $daemon);
Expand All @@ -151,24 +154,24 @@ sub collect {
next unless ($daemons{$daemon}->{"ipv4"} || $daemons{$daemon}->{"ipv6"});
printf "/* %s */\n", $daemon;
if ($daemons{$daemon}->{"ipv4"} && $daemons{$daemon}->{"ipv6"}) {
my ($names, $help) = collect($daemon, 1, 1, 0);
my ($names, $help) = collect($daemon, 1, 1, 0, 0);
printf "#define FRR_REDIST_STR_%s \\\n %s\n", uc $daemon, $names;
printf "#define FRR_REDIST_HELP_STR_%s \\\n%s\n", uc $daemon, $help;

($names, $help) = collect($daemon, 1, 0, 0);
($names, $help) = collect($daemon, 1, 0, 0, 0);
printf "#define FRR_IP_REDIST_STR_%s \\\n %s\n", uc $daemon, $names;
printf "#define FRR_IP_REDIST_HELP_STR_%s \\\n%s\n", uc $daemon, $help;

($names, $help) = collect($daemon, 0, 1, 0);
($names, $help) = collect($daemon, 0, 1, 0, 0);
printf "#define FRR_IP6_REDIST_STR_%s \\\n %s\n", uc $daemon, $names;
printf "#define FRR_IP6_REDIST_HELP_STR_%s \\\n%s\n", uc $daemon, $help;

if ($daemon eq "zebra") {
($names, $help) = collect($daemon, 1, 0, 1);
($names, $help) = collect($daemon, 1, 0, 1, 1);
printf "#define FRR_IP_PROTOCOL_MAP_STR_%s \\\n %s\n", uc $daemon, $names;
printf "#define FRR_IP_PROTOCOL_MAP_HELP_STR_%s \\\n%s\n", uc $daemon, $help;

($names, $help) = collect($daemon, 0, 1, 1);
($names, $help) = collect($daemon, 0, 1, 1, 1);
printf "#define FRR_IP6_PROTOCOL_MAP_STR_%s \\\n %s\n", uc $daemon, $names;
printf "#define FRR_IP6_PROTOCOL_MAP_HELP_STR_%s \\\n%s\n", uc $daemon, $help;
}
Expand Down
4 changes: 4 additions & 0 deletions zebra/zebra_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -1983,6 +1983,10 @@ static void lib_vrf_zebra_ipv6_router_id_cli_write(struct vty *vty,
vty_out(vty, "ipv6 router-id %s\n", id);
}

/*
* Both the v4 and v6 version of this command are now limiting the
* usage of System route types from being considered here at all
*/
DEFPY_YANG (ip_protocol,
ip_protocol_cmd,
"[no] ip protocol " FRR_IP_PROTOCOL_MAP_STR_ZEBRA
Expand Down
Loading