-
Notifications
You must be signed in to change notification settings - Fork 94
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
Add support for inverting filter match conditions #98
Conversation
Could you please explain why this is useful? |
I believe my motivation for this was to slightly alleviate the problem of babeld's router filter composability. Like I mentioned in #74 (comment) I have multiple config files, one common one deployed across all routers and one local to each router. The local one is included via Problem is right now babeld's filter rules are "last match wins" which makes it extremely hard to compose things this way since any policy decision made in the local config file might be (usually accidentally) overridden by common.conf. With support for negation it would at least be possible to make exceptions to overlapping rules, but I'm starting to think this really is not enough. Perhaps a config option to change filter semantics to "first match wins" would be more universally useful. |
Typo here? It's the first match that wins, unless something broke at some point.
I'm sorry if I'm being dense, but could you please provide a concrete example of something that would be useful in production? I'd really like to avoid adding even more complexity unless we have a compelling example of why a given feature is useful. |
Indeed a typo I meant last match and that's the problem. It's not you, it's me :) I write these reports while knee deep in my configs so I have to be a bit terse. I'm always happy to elaborate, so here's an example of what I mean: I run babeld something like this I have this in common.conf
Then in local.conf I had:
in order to demote this router quite hard as I was still working on setting it up. Now what I found (and surprised me) is that all the IPv4 addresses are getting redistributed too since the earlier policy of denying ipv4 was being overridden by the >0 metric and last-match-wins semantics. This is by no means the only time this happened though, it's just the one that got me to report it ;) I think this is counterintuitive behavior in general. Every networking config I know uses first-match-wins plus usually some way to abort evaluating any more rules cf firewall rules. Routing tables being the exception of course, but even there policy-routing/ip-rule has the behaviour I want ;) Now it could be argued that perhaps I should just reorder my config files like this: I think we have a couple of options to make babeld better here, I can think of:
The original idea of this patch (negation) was, to stay with the redistribute example, to be able to say in local.conf (parens for clarity:
But that is going to not be powerful enough as soon as there's multiple filters in common.conf themselves using negation. Then we'd need per match clause negation. Anyway I digress :) In summary I'm not really sure what's best here. If it were up to me I'd probably add "final" actions and the metric match but maybe even this "hidden" state is too much complexity hrm. --Daniel |
Daniel, I'm confused: I've just tested, and it's the first match that triggers, which is the expected outcome. |
Well colour me confused as well. I'm back in the bowls of my babled config and here's what I'm seeing now. I'm trying to exclude a sub-prefix of my router's /56 from getting announce so I'm trying to
and
If babeld was indeed implementing first-match-wins I would expect the former ordering to filter the
I have these cmdline args
Thoroughly confused, |
Ok, the weirdness continues. I realised I might be missing
Will cause all /128s xroutes to be
causes those same /128s to be
WTF? It's as if the --Daniel EDIT: add |
Ok I found one problem in my report above: I had |
Additional datapoints. This gives me
Further, this gives me the behaviour I'm looking for, filter away the /128s:
|
Please show your kernel's addresses and routing table ( |
Hi Juliusz,
See direct mail "Re: babeld#98, filter evaluation debugging" the dumps were very large :) Here's another more digestible datapoint from a different routing policy change I just implemented. xroute dump with just my default babel.conf (
Now I add the following in babeld.local.conf (before the
Resulting xroute dump:
Ignoring the need to do the --Daniel |
The rule you have to deny the In your example the |
Doh, typo. Now I wish we had Ok, so changing |
Thanks to both of you for investigating. I'm closing this, please reopen if you still think there's a bug.
I'm rather fond of the current syntax, but I'm not opposed to tweaking it if there are strong arguments. Feel free to open a discussion on the mailing list. |
No description provided.