From: Jeremy Sowden Date: Mon, 21 Aug 2023 19:42:35 +0000 (+0100) Subject: sqlite3: correct binding of ipv4 addresses and 64-bit integers X-Git-Tag: ulogd-2.0.9~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=40517221e15e7518980b582cecf290bc5880064e;p=thirdparty%2Fulogd2.git sqlite3: correct binding of ipv4 addresses and 64-bit integers Hitherto we have bound ipv4 addresses as 64-bit ints and 64-bit ints as 32-bit. Move a `ULOGD_RET_BOOL` case for consistency and fix some nearby formatting. Fix some nearby formatting. Signed-off-by: Jeremy Sowden Signed-off-by: Florian Westphal --- diff --git a/output/sqlite3/ulogd_output_SQLITE3.c b/output/sqlite3/ulogd_output_SQLITE3.c index 0a9ad67..3a82389 100644 --- a/output/sqlite3/ulogd_output_SQLITE3.c +++ b/output/sqlite3/ulogd_output_SQLITE3.c @@ -145,6 +145,10 @@ sqlite3_interp(struct ulogd_pluginstance *pi) } switch (f->key->type) { + case ULOGD_RET_BOOL: + ret = sqlite3_bind_int(priv->p_stmt, i, k_ret->u.value.b); + break; + case ULOGD_RET_INT8: ret = sqlite3_bind_int(priv->p_stmt, i, k_ret->u.value.i8); break; @@ -158,7 +162,7 @@ sqlite3_interp(struct ulogd_pluginstance *pi) break; case ULOGD_RET_INT64: - ret = sqlite3_bind_int(priv->p_stmt, i, k_ret->u.value.i64); + ret = sqlite3_bind_int64(priv->p_stmt, i, k_ret->u.value.i64); break; case ULOGD_RET_UINT8: @@ -174,17 +178,16 @@ sqlite3_interp(struct ulogd_pluginstance *pi) break; case ULOGD_RET_IPADDR: - case ULOGD_RET_UINT64: - ret = sqlite3_bind_int64(priv->p_stmt, i, k_ret->u.value.ui64); + ret = sqlite3_bind_int(priv->p_stmt, i, k_ret->u.value.ui32); break; - case ULOGD_RET_BOOL: - ret = sqlite3_bind_int(priv->p_stmt, i, k_ret->u.value.b); + case ULOGD_RET_UINT64: + ret = sqlite3_bind_int64(priv->p_stmt, i, k_ret->u.value.ui64); break; case ULOGD_RET_STRING: ret = sqlite3_bind_text(priv->p_stmt, i, k_ret->u.value.ptr, - strlen(k_ret->u.value.ptr), SQLITE_STATIC); + strlen(k_ret->u.value.ptr), SQLITE_STATIC); break; default: