Skip to content

Commit

Permalink
Fix Pi-hole-provided SQL function isIPv6(string)
Browse files Browse the repository at this point in the history
Signed-off-by: DL6ER <[email protected]>
  • Loading branch information
DL6ER committed Oct 22, 2024
1 parent 53d21a3 commit f21830b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/database/sqlite3-ext.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,15 @@ static void isIPv6_impl(sqlite3_context *context, int argc, sqlite3_value **argv
return;
}

struct in6_addr addr;
struct in6_addr addr = { 0 };
if(inet_pton(AF_INET6, input, &addr) == 1)
{
// IPv6 address, return 1 and exit
sqlite3_result_int(context, 1);
return;
}

// Not an IPv6 address
// Not an IPv6 address, return 0
sqlite3_result_int(context, 0);
}

Expand Down

0 comments on commit f21830b

Please sign in to comment.