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

Empty NeighborSet condition always evaluates to true #1968

Closed
thoro opened this issue Feb 12, 2019 · 8 comments
Closed

Empty NeighborSet condition always evaluates to true #1968

thoro opened this issue Feb 12, 2019 · 8 comments

Comments

@thoro
Copy link
Contributor

thoro commented Feb 12, 2019

I'm not sure if this is intended behaviour, but it definitly counts as confusing.

For example, this policy always matches, in case the nodes NeighborSet is empty.

StatementName export_accept_nodes:
Conditions:
PrefixSet: any default-nodes
NeighborSet: any nodes
Actions:
MED: 180
Nexthop: self
accept

There's actually the comment on the Evaluate function of the policy.go

"// If NeighborList's length is zero, return true."

But I'm wondering - why?

I would assume:

Empty NeighborSet matches never if match = any
Empty NeighborSet matches always if match = invert

thoro added a commit to thoro/gobgp that referenced this issue Feb 12, 2019
@thoro
Copy link
Contributor Author

thoro commented Feb 12, 2019

Is actually also affects NextHopCondition, but is correctly handled for PrefixCondition

@fujita
Copy link
Member

fujita commented Feb 12, 2019

Sounds like v1.X works in the above way. Then we cannot change the behavior (even if it's confusing) because the configuration file format for v1.X is supposed to work in the same way with v2.X.

@thoro
Copy link
Contributor Author

thoro commented Feb 12, 2019

I would rather think it's a bug that no one noticed before. But it really prompts a weird behaviour. Also, config file format was already changed as far as I know with node sets allowing only cidr-notation.

I'm populating the nodes via GRPC, if the second service isn't started yet, all routes are published to everyone -> not what you would want.

Work around would be to add a fake host into the nodeSet -> could put that as an info to the documentation, so that the behaviour is documented.

@fujita
Copy link
Member

fujita commented Feb 14, 2019

But it really prompts a weird behaviour. Also, config file format was already changed as far as I know with node sets allowing only cidr-notation.

The format was changed but the behavior wasn't. The point is that we cannot change the behavior.

Why you use empty NeighborCondition? If you don't have anything about neighbors, you don't need to create a NeighborCondition.

@thoro
Copy link
Contributor Author

thoro commented Feb 14, 2019

Please read the last comment, I'm prepopulating my rules with sets. The rules are static, the sets are not, and they might be empty at some point, or filled. With that bug one time the rules are applied to all hosts, and one time they are applied only to the hosts in the set.

I understand your concern about changing behaviour, but don't you think/feel that this behavior is wrong?

@fujita
Copy link
Member

fujita commented Feb 14, 2019

I understand your concern about changing behaviour, but don't you think/feel that this behavior is wrong?

If I started the project today, I might do differently. But changing the behavior is not an option.

btw, IMHO, modifying the existing Conditions isn't a good idea. I prefer creating a new Conditions.

@thoro
Copy link
Contributor Author

thoro commented Feb 15, 2019

ok, then let's agree on adding a big fat warning to the documentation, that the behaviour is documented.

@fujita
Copy link
Member

fujita commented Feb 15, 2019

Absolutely. Please add the description of the behavior.

thoro added a commit to thoro/gobgp that referenced this issue Feb 15, 2019
thoro added a commit to thoro/gobgp that referenced this issue Feb 16, 2019
fujita pushed a commit that referenced this issue Feb 16, 2019
@fujita fujita closed this as completed Feb 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants