Skip to content

Commit

Permalink
xdp-dns: lpm trie for domain lookup
Browse files Browse the repository at this point in the history
if insert 6bpfire3net in LPM trie map

domain 3foo6bpfire3net will not match because only the
common suffix 6bpfire3net matches, LPM trie is for prefix
match, need to reverse the suffix to prefix, which is to
reverse the 6bpfire3net string and insert in LPM trie map

then reverse 3foo6bpfire3net and do LPM trie map lookup
which will match the common prefix with reversed 6bpfire3net

see more detail in

#1
#2
vincentmli/BPFire#36

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
  • Loading branch information
vincentmli committed Sep 10, 2024
1 parent c5d7e3b commit 7f9bbd6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion xdp-dns/xdp_dns.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@
#include <errno.h>
#include <stdlib.h>

#define MAX_DOMAIN_SIZE 128 // Increased size to handle larger domains
#define MAX_DOMAIN_SIZE 18 // Increased size to handle larger domains

struct domain_key {
struct bpf_lpm_trie_key lpm_key;
char data[MAX_DOMAIN_SIZE + 1];
};

struct domain_key {
struct bpf_lpm_trie_key lpm_key;
Expand Down

0 comments on commit 7f9bbd6

Please sign in to comment.