Skip to content

Customer lookup based on host range and zone match#27

Open
unix1 wants to merge 13 commits intoPacket-Clearing-House:masterfrom
unix1:customer-host-range-constraint
Open

Customer lookup based on host range and zone match#27
unix1 wants to merge 13 commits intoPacket-Clearing-House:masterfrom
unix1:customer-host-range-constraint

Conversation

@unix1
Copy link
Contributor

@unix1 unix1 commented Dec 3, 2018

Overview

This PR implements requested feature in #23. Specifically, it modifies the customer lookup logic with the following:

  • look up customer based on host IP range first
  • if found, further filter based on qname longest common prefix match on customer zone
  • if >1 customers are matched after both of the above, return one and log a warning

Implementation

database

MySQL customers.zones table:

  • group_name field has been renamed to name
  • host field has been removed
  • the ip_start and ip_end binary fields have been added to store IP ranges

application logic

The radix tree has been removed and replaced with the newly forked and updated interval tree which stores IP ranges as intervals in memory. The logic has been adjusted to reflect the priority of IP range lookup over the qname prefix match.

Finally, there are few basic tests to validate the customer matching functionality.

Note that due to database schema updates, this change is not backward compatible. Any applications accessing the customers database must be updated to reflect the new schema.

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.

1 participant