-
Notifications
You must be signed in to change notification settings - Fork 450
babeld: add del_filters function #911
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
Closed
PolynomialDivision
wants to merge
1
commit into
openwrt:master
from
PolynomialDivision:babeld-ubus-del-filters
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
65 changes: 65 additions & 0 deletions
65
babeld/patches/100-Add-functions-to-delete-filters-from-an-interface.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| From 7dc87f39dc5d1db7654f6ad89eca77766812affd Mon Sep 17 00:00:00 2001 | ||
| From: Nick Hainke <vincent@systemli.org> | ||
| Date: Tue, 18 Oct 2022 21:34:03 +0200 | ||
| Subject: [PATCH] Add functions to delete filters from an interface | ||
|
|
||
| Adding a delete function at runtime allows the babeld ipc to add and | ||
| remove interfaces with filters. Further, it also allows more dynamic | ||
| routing selection. | ||
|
|
||
| Signed-off-by: Nick Hainke <vincent@systemli.org> | ||
| --- | ||
| configuration.c | 42 ++++++++++++++++++++++++++++++++++++++++++ | ||
| 1 file changed, 42 insertions(+) | ||
|
|
||
| --- a/configuration.c | ||
| +++ b/configuration.c | ||
| @@ -859,6 +859,48 @@ parse_key(int c, gnc_t gnc, void *closur | ||
| return -2; | ||
| } | ||
|
|
||
| +void | ||
| +delete_filters_from_interface(char* ifname, struct filter **filters) | ||
| +{ | ||
| + struct filter *f; | ||
| + | ||
| + while(*filters && (*filters)->ifname && strcmp(ifname, (*filters)->ifname) == 0) | ||
| + { | ||
| + f = *filters; | ||
| + *filters = f->next; | ||
| + free(f); | ||
| + } | ||
| + | ||
| + f = *filters; | ||
| + while(f && f->next) | ||
| + { | ||
| + if(!f->next->ifname) | ||
| + { | ||
| + f = f->next; | ||
| + continue; | ||
| + } | ||
| + | ||
| + if(strcmp(ifname, f->next->ifname) == 0) | ||
| + { | ||
| + struct filter *tmp; | ||
| + tmp = f->next; | ||
| + f->next = f->next->next; | ||
| + free(tmp); | ||
| + } else { | ||
| + f = f->next; | ||
| + } | ||
| + } | ||
| +} | ||
| + | ||
| +void | ||
| +delete_all_filters_from_interface(char* ifname) | ||
| +{ | ||
| + delete_filters_from_interface(ifname, &input_filters); | ||
| + delete_filters_from_interface(ifname, &output_filters); | ||
| + delete_filters_from_interface(ifname, &redistribute_filters); | ||
| + delete_filters_from_interface(ifname, &install_filters); | ||
| +} | ||
| + | ||
| int | ||
| add_filter(struct filter *filter, int type) | ||
| { | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reference: jech/babeld#95