Skip to content

Commit

Permalink
BGP: deal with vnc related string ambiguities (issue FRRouting#9)
Browse files Browse the repository at this point in the history
    - "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>
  • Loading branch information
paulzlabn authored and louberger committed Dec 20, 2016
1 parent 9768ff2 commit 0e294f1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
4 changes: 2 additions & 2 deletions doc/vnc.texi
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions lib/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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;
}
Expand Down
5 changes: 4 additions & 1 deletion lib/route_types.pl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

# else: 7-field line
my @f = split(/,/, $_);
unless (@f == 7) {
unless (@f == 7 || @f == 8) {
die "invalid input on route_types line $.\n";
}

Expand All @@ -73,6 +73,7 @@
"ipv4" => int($f[4]),
"ipv6" => int($f[5]),
"shorthelp" => $f[6],
"restrict2" => $f[7],
};
push @protos, $proto;
$daemons{$f[2]} = {
Expand Down Expand Up @@ -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"};
Expand Down
8 changes: 4 additions & 4 deletions lib/route_types.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"

0 comments on commit 0e294f1

Please sign in to comment.