Add support for per-Source Hidden Neighbors #143
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "jof/jof/hidden-neighbors"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #142
As part of Route Server operations, it is sometimes necessary to configure some BGP Neighbors which are not appropriate for a public Looking Glass interface.
For example, an internal route server peer used to collect routes for flow analytics, but which is not a "normal" Route Server peer. Another example: an internal (route server)-to-(route server) peer used to scale a multi-instance route server.
This PR adds some support to Alice to enable configuring some Neighbors to be hidden on a per-source basis. This filtration could be based on IPs, CIDRs, or Regular Expressions. As BIRD(watcher) has some some NeighborStatus IDs which are potentially not IP addresses, it seemed important to enable filtering either IPs or Neighbor Protocol names.
I'm currently reviewing this.
Hej! :)
Thanks again for the effort.
I added some notes how this could be improved and reuse already existing code. (To a degree)
@ -38,0 +58,4 @@
}
return excludeCIDRs, excludeIPs, excludePatterns, nil
}
This function has too many return values.
Also I think it should be done during config parsing.
Also, maybe the already existing filtering infrastructure could be reused:
There is
api.NeighborFilter
which could be extended:api.Filterable
this should maybe be split intoRouteFilterable
andNeighborFilterable
NeighborFilter.Match
should accept this interface, so this can be implemented forapi.Neighbor
andapi.NeighborStatus
The
NeighborFilter
could then include this list of CIDRs / IPs / RE patterns.The NeighborFilterable then could maybe expect
MatchAddress
MatchASN
,MatchDescription
MatchPattern?
something like this :)
@ -38,0 +68,4 @@
}
neighbors:
for _, neighbor := range neighbors {
neighborIP := net.ParseIP(neighbor.Address)
Another reason to do this at config parse time:
If there is a broken pattern in the config, this would fail when routes refresh starts or, if there is no global search enabled, on first request.
@ -38,0 +78,4 @@
continue neighbors
}
}
for _, cidr := range excludeCIDRs {
If the
hidden_members
config option is parsed into a e.g. []*NeighborFilter / filterset something likeThen the invocation in the source could be like
@ -38,0 +111,4 @@
for _, ip := range excludeIPs {
if ip.Equal(neighborIDAsIP) {
continue neighbors
}
This should rather be an early return, to reduce nesting.
Also this duplicated code would not longer be required.
Additionally: These functions feel a bit out of place here; so this would also be resolved.
@ -54,6 +54,7 @@ type NeighborsStoreBackend interface {
type NeighborsStore struct {
backend NeighborsStoreBackend
sources *SourcesStore
cfg *config.Config
I think this is an artifact?
@ -38,0 +78,4 @@
continue neighbors
}
}
for _, cidr := range excludeCIDRs {
Or: even better: before it is appended during decode:
Then the Exclude function would not even be required. :)
@ -54,6 +54,7 @@ type NeighborsStoreBackend interface {
type NeighborsStore struct {
backend NeighborsStoreBackend
sources *SourcesStore
cfg *config.Config
Indeed, it was.
I'm still thinking this through, but I understand the desire to have a common filtering interface.
I'll take me a little bit to get up to speed with the other filtering codepaths and interfaces.
Checkout
From your project repository, check out a new branch and test the changes.