if (gext && gext->vpt) {
uint32_t hash, start;
ssize_t slen;
- char const *p = NULL;
char buffer[1024];
/*
}
} else {
- slen = tmpl_expand(&p, buffer, sizeof(buffer), request, gext->vpt);
- if (slen < 0) {
- REDEBUG("Failed expanding template");
- goto randomly_choose;
- }
+ uint8_t *octets = NULL;
+
+ /*
+ * If the input is an IP address, prefix, etc., we don't need to convert it to a
+ * string. We can just hash the raw data directly.
+ */
+ slen = tmpl_expand(&octets, buffer, sizeof(buffer), request, gext->vpt);
+ if (slen <= 0) goto randomly_choose;
- hash = fr_hash(p, slen);
+ hash = fr_hash(octets, slen);
start = hash % g->num_children;
}