BGP: deal with vnc related string ambiguities (issue #9)

- "redist foo" parsing modified to check for foo==vnc and foo==vnc-direct
      instead of just leading 'v' character
    - string designating ZEBRA_ROUTE_VNC_DIRECT changed from "vpn" to "vnc-direct"
    - route_types.pl parser recognizes 7th field to restrict availability
      of a route type in the redist command to specific daemons
    - restrict "vnc-direct" to bgpd only (doesn't make sense elsewhere)
    - vnc documentation updated to match

Signed-off-by: Lou Berger <lberger@labn.net>
This commit is contained in:
G. Paul Ziemba 2016-11-04 09:47:36 -07:00 committed by Lou Berger
parent 271a0c2548
commit 5ee62c66a9
4 changed files with 16 additions and 13 deletions

View File

@ -726,7 +726,7 @@ provided to other protocols, either via zebra or directly to BGP.
It is important to note that when exporting routes to other protocols,
the downstream protocol must also be configured to import the routes.
For example, when VNC routes are exported to unicast BGP, the BGP
configuration must include a corresponding @code{redistribute vpn}
configuration must include a corresponding @code{redistribute vnc-direct}
statement.
@deffn {VNC} {export bgp|zebra mode none|group-nve|registering-nve|ce}
@ -1115,7 +1115,7 @@ The configuration for @code{VNC-GW 1} is shown below.
router bgp 64512
bgp router-id 192.168.1.101
bgp cluster-id 1.2.3.4
redistribute vpn
redistribute vnc-direct
neighbor 192.168.1.102 remote-as 64512
no neighbor 192.168.1.102 activate
neighbor 192.168.1.103 remote-as 64512

View File

@ -1077,10 +1077,10 @@ proto_redistnum(int afi, const char *s)
return ZEBRA_ROUTE_BGP;
else if (strncmp (s, "ta", 2) == 0)
return ZEBRA_ROUTE_TABLE;
else if (strncmp (s, "v", 1) == 0)
return ZEBRA_ROUTE_VNC;
else if (strncmp (s, "vd", 1) == 0)
else if (strcmp (s, "vnc-direct") == 0)
return ZEBRA_ROUTE_VNC_DIRECT;
else if (strcmp (s, "vnc") == 0)
return ZEBRA_ROUTE_VNC;
}
if (afi == AFI_IP6)
{
@ -1100,10 +1100,10 @@ proto_redistnum(int afi, const char *s)
return ZEBRA_ROUTE_BGP;
else if (strncmp (s, "ta", 2) == 0)
return ZEBRA_ROUTE_TABLE;
else if (strncmp (s, "v", 1) == 0)
return ZEBRA_ROUTE_VNC;
else if (strncmp (s, "vd", 1) == 0)
else if (strcmp (s, "vnc-direct") == 0)
return ZEBRA_ROUTE_VNC_DIRECT;
else if (strcmp (s, "vnc") == 0)
return ZEBRA_ROUTE_VNC;
}
return -1;
}

View File

@ -56,7 +56,7 @@ while (<STDIN>) {
# else: 7-field line
my @f = split(/,/, $_);
unless (@f == 7) {
unless (@f == 7 || @f == 8) {
die "invalid input on route_types line $.\n";
}
@ -73,6 +73,7 @@ while (<STDIN>) {
"ipv4" => int($f[4]),
"ipv6" => int($f[5]),
"shorthelp" => $f[6],
"restrict2" => $f[7],
};
push @protos, $proto;
$daemons{$f[2]} = {
@ -137,6 +138,8 @@ sub collect {
my (@names, @help) = ((), ());
for my $p (@protos) {
next if ($protodetail{$p}->{"daemon"} eq $daemon && $daemon ne "zebra");
next if ($protodetail{$p}->{"restrict2"} ne "" &&
$protodetail{$p}->{"restrict2"} ne $daemon);
next unless (($ipv4 && $protodetail{$p}->{"ipv4"})
|| ($ipv6 && $protodetail{$p}->{"ipv6"}));
push @names, $protodetail{$p}->{"cname"};

View File

@ -64,9 +64,9 @@ ZEBRA_ROUTE_LDP, ldp, ldpd, 'L', 0, 0, "LDP"
#vnc when sent to zebra
ZEBRA_ROUTE_VNC, vnc, NULL, 'v', 1, 1, "VNC"
# vnc when sent to bgp
ZEBRA_ROUTE_VNC_DIRECT, vpn, NULL, 'V', 1, 1, "VPN"
# vnc when sent to bgp (remote next hop?)
ZEBRA_ROUTE_VNC_DIRECT_RH, vpn-rh, NULL, 'V', 0, 0, "VPN"
ZEBRA_ROUTE_VNC_DIRECT, vnc-direct,NULL, 'V', 1, 1, "VNC-Direct", bgpd
# vnc when sent to bgp (resolve NVE mode)
ZEBRA_ROUTE_VNC_DIRECT_RH, vnc-rn, NULL, 'V', 0, 0, "VNC-RN"
# bgp unicast -> vnc
ZEBRA_ROUTE_BGP_DIRECT, bgp-direct, NULL, 'b', 0, 0, "BGP-Direct"
# bgp unicast -> vnc
@ -90,4 +90,4 @@ ZEBRA_ROUTE_VNC, "Virtual Network Control (VNC)"
ZEBRA_ROUTE_OLSR, "Optimised Link State Routing (OLSR)"
ZEBRA_ROUTE_TABLE, "Non-main Kernel Routing Table"
ZEBRA_ROUTE_LDP, "Label Distribution Protocol (LDP)"
ZEBRA_ROUTE_VNC_DIRECT, "VPN routes(VPN)"
ZEBRA_ROUTE_VNC_DIRECT, "VNC direct (not via zebra) routes"