nfqws,tpws: move --ipset to kavl

This commit is contained in:
bol-van
2025-05-27 16:03:28 +03:00
parent 323307cbfa
commit 02badb3c4c
11 changed files with 1118 additions and 233 deletions

View File

@@ -112,6 +112,17 @@ bool append_to_list_file(const char *filename, const char *s)
return bOK;
}
void expand_bits(void *target, const void *source, unsigned int source_bitlen, unsigned int target_bytelen)
{
unsigned int target_bitlen = target_bytelen<<3;
unsigned int bitlen = target_bitlen<source_bitlen ? target_bitlen : source_bitlen;
unsigned int bytelen = bitlen>>3;
if ((target_bytelen-bytelen)>=1) memset(target+bytelen,0,target_bytelen-bytelen);
memcpy(target,source,bytelen);
if ((bitlen &= 7)) ((uint8_t*)target)[bytelen] = ((uint8_t*)source)[bytelen] & (~((1 << (8-bitlen)) - 1));
}
void ntop46(const struct sockaddr *sa, char *str, size_t len)
{
if (!len) return;