github / glb-director

GitHub Load Balancer Director and supporting tooling.
Other
2.37k stars 227 forks source link

Refactor shared hashing components to shared codebase ahead of XDP. #95

Closed theojulienne closed 4 years ago

theojulienne commented 4 years ago

As part of a new XDP implementation of glb-director, this PR extracts a large amount of packet parsing, route context and hashing out of glb-director and into a shared source path that will be used by both implementations. Most of this is a copy-paste, with some refactoring, and some changes to use a single non-conflicting set of public domain network headers instead of copying the kernel ones to user space or copying the whole of rte_net into the kernel space compile context.

Of note, the adjusted siphash implementation in this PR is a simplified version of the original that maintains the same hash algorithm but uses significantly simpler patterns by forcing the caller to adhere to some constraints around input sizing. This allows it to be more easily understood and validated by the kernel eBPF verifier, unlike the original. Notes are in the file as to what has been changed and why.

Additionally, glb-director and the CLI utilities are pulled out into their own package to let them be reused by both implementations. This PR is just split out to make code review easier, in reality the plan is to merge both this and the upcoming XDP around the same time and before any release.