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

Go back to linked list instead of tree implementation for ip filter #426

Open
wants to merge 1 commit into
base: development
Choose a base branch
from

Conversation

mkrrr
Copy link

@mkrrr mkrrr commented Oct 13, 2016

It was not possible to configure an allowed host with the current implementation of the IP filter module. The tree based implementation has a "closest match" in mind whereas we want the filters to be evaluated sequentially.
This undoes the work done c5f02f4 (Task #832. Changed ip filter from queues to trees). Furthermore, the ALLOW filter was removed in this commit, added it back.
Still work in progress, would like a review. Example configuration:

        netmask.addr = ~(netmask.addr & 0);
        any_addr.addr = ~(any_addr.addr & 0);
        pico_ipv4_filter_add(ppp, 0, NULL, NULL, &allow_start_ip, &netmask, 0, 0, 0, 0, FILTER_ALLOW); 
        pico_ipv4_filter_add(ppp, 0, &allow_start_ip, &netmask, NULL, NULL, 0, 0, 0, 0, FILTER_ALLOW); 
        netmask.addr = 0;
        pico_ipv4_filter_add(ppp, 0, NULL, NULL, &any_addr, &netmask, 0, 0, 0, 0, FILTER_DROP);

Copy link
Contributor

@frederikvs frederikvs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally the code looks good. A bit surprising that your rather small commit can undo the work done in a much larger commit like c5f02f4, but then again, that commit seems to be a jumble of different changes all thrown together in the same commit...

a couple of small questions

  • Did you run the unit & smoke tests? Did they succeed? If they still succeed after this a modification, we need to add some tests there :-)
  • You mention that it's still a work progress, what exactly still needs to happen?

Just one small comment inline.

while (*node) {
if ((*node)->filter_id == filter_id){
pico_free(*node);
*node = (*node)->next_filter;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless my eyes deceive me, this looks like a use-after-free, no?

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

Successfully merging this pull request may close these issues.

None yet

2 participants