diff options
| author | Felix Fietkau | 2023-10-18 12:44:45 +0000 |
|---|---|---|
| committer | Felix Fietkau | 2023-10-18 12:44:46 +0000 |
| commit | 479c7f8676d9cb6543ef516dc82cc53ed11b1142 (patch) | |
| tree | 4aa4aed5bae0f4d9f7fcb79c0725d0fc3596a94c | |
| parent | 65b3308d13de7d7975444d34389651612e2a4d38 (diff) | |
| download | mdnsd-479c7f8676d9cb6543ef516dc82cc53ed11b1142.tar.gz | |
cache: make record/hostname lookup case-insensitive
Fixes lookup issues on hosts that announce themselves with uppercase
in their hostname
Signed-off-by: Felix Fietkau <nbd@nbd.name>
| -rw-r--r-- | cache.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -42,7 +42,13 @@ static struct uloop_timeout cache_gc; struct avl_tree services; -AVL_TREE(records, avl_strcmp, true, NULL); + +static int avl_strcasecmp(const void *k1, const void *k2, void *ptr) +{ + return strcasecmp(k1, k2); +} + +AVL_TREE(records, avl_strcasecmp, true, NULL); static void cache_record_free(struct cache_record *r) @@ -111,7 +117,7 @@ cache_gc_timer(struct uloop_timeout *timeout) int cache_init(void) { - avl_init(&services, avl_strcmp, true, NULL); + avl_init(&services, avl_strcasecmp, true, NULL); cache_gc.cb = cache_gc_timer; uloop_timeout_set(&cache_gc, 10000); |