From patchwork Sat Aug 28 19:38:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Sowden X-Patchwork-Id: 1521914 X-Patchwork-Delegate: pablo@netfilter.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netfilter-devel-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=azazel.net header.i=@azazel.net header.a=rsa-sha256 header.s=20190108 header.b=oGeF9W32; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4Gxn4b4xgGz9sWS for ; Sun, 29 Aug 2021 05:40:47 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231495AbhH1Tlf (ORCPT ); Sat, 28 Aug 2021 15:41:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230316AbhH1Tle (ORCPT ); Sat, 28 Aug 2021 15:41:34 -0400 Received: from kadath.azazel.net (kadath.azazel.net [IPv6:2001:8b0:135f:bcd1:e0cb:4eff:fedf:e608]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC7C7C0613D9 for ; Sat, 28 Aug 2021 12:40:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=azazel.net; s=20190108; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Cf+xTkIYyI5H93QtwazoFQ+zepqhsotuoVP2bW1cRQc=; b=oGeF9W324CNoWONTjUdwPTRI3G k7uQ89i8QsPZYKs7WjgjoOdK2iB/OQuL/eyvNAgUk+Whygg3HtR2l5d92K3+GR1LoK4dHQ3QQZ4DM iJfQbwGQuUwPBzt9lI+SdTm4TLTUAAwnhStu8Xnm9URzUOsdgFmTSJpe6pITgq4j/Q55l6otjgn8U rzEYQW5nCaFLXEkES7+WBk5BJyfxTHNTi1eEa5pd6TS2OBqAKnqowAHFOzfsDlqyYdbPCwZP8gZNF 01hlNSG/tfTIIYuoxLrn58ee/R60Yc8HrEmOOpYsEcB4IYQ4/h0xn4/aOy5N5prfj39VrgSZ06kum 4rmRPA4A==; Received: from ulthar.dreamlands.azazel.net ([2001:8b0:fb7d:d6d7:2e4d:54ff:fe4b:a9ae]) by kadath.azazel.net with esmtp (Exim 4.94.2) (envelope-from ) id 1mK4C1-00FeN7-El; Sat, 28 Aug 2021 20:40:41 +0100 From: Jeremy Sowden To: Pablo Neira Ayuso Cc: Netfilter Devel Subject: [PATCH libnetfilter_log 1/6] Add doxygen directory to .gitignore. Date: Sat, 28 Aug 2021 20:38:19 +0100 Message-Id: <20210828193824.1288478-2-jeremy@azazel.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210828193824.1288478-1-jeremy@azazel.net> References: <20210828193824.1288478-1-jeremy@azazel.net> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:8b0:fb7d:d6d7:2e4d:54ff:fe4b:a9ae X-SA-Exim-Mail-From: jeremy@azazel.net X-SA-Exim-Scanned: No (on kadath.azazel.net); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org Signed-off-by: Jeremy Sowden --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index f4938e98d7e9..5eaabe38a514 100644 --- a/.gitignore +++ b/.gitignore @@ -13,5 +13,6 @@ Makefile.in /configure /libtool +/doxygen/ /doxygen.cfg /*.pc From patchwork Sat Aug 28 19:38:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Sowden X-Patchwork-Id: 1521915 X-Patchwork-Delegate: pablo@netfilter.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netfilter-devel-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=azazel.net header.i=@azazel.net header.a=rsa-sha256 header.s=20190108 header.b=gb5oZGXV; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4Gxn4c0Q4Vz9sWX for ; Sun, 29 Aug 2021 05:40:48 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231503AbhH1Tlf (ORCPT ); Sat, 28 Aug 2021 15:41:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230452AbhH1Tle (ORCPT ); Sat, 28 Aug 2021 15:41:34 -0400 Received: from kadath.azazel.net (kadath.azazel.net [IPv6:2001:8b0:135f:bcd1:e0cb:4eff:fedf:e608]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6572C061796 for ; Sat, 28 Aug 2021 12:40:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=azazel.net; s=20190108; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=RgEmlKQwQFo0a5kmP9bcOkPnLTMEQT4g1i/qrmeYDfs=; b=gb5oZGXVoGqN/Cof5Iaoj3VZze HgVRtCKoPy00kP50yOwRrezTiNlLEvu2lS0kgXYcw333l2OtbhFOW5EyA7R+z08N8Z0nFT3POCOR6 734IA7AncWjBN/CJ9GIMWq9bZQz9r0LwWgvpUDpvFHEJXKWHPtqiHWyaFeVcDVZXiq21WWbmMI4Ea 11yw2hxmma/WCCdvMIF1Qgs7pSM9336iBgmByXNhSI/IK35esaXFtbAYVHdLuAb0LtHezwL2S6jD6 3gMu8BqbyblizvvmWXFjni1qJnvq+FzDjFb1CPnUO5FDwHRUog8csgjr0Ufn0XTfIsAnu3KkYoCQ1 2obW1B9A==; Received: from ulthar.dreamlands.azazel.net ([2001:8b0:fb7d:d6d7:2e4d:54ff:fe4b:a9ae]) by kadath.azazel.net with esmtp (Exim 4.94.2) (envelope-from ) id 1mK4C1-00FeN7-Ia; Sat, 28 Aug 2021 20:40:41 +0100 From: Jeremy Sowden To: Pablo Neira Ayuso Cc: Netfilter Devel Subject: [PATCH libnetfilter_log 2/6] build: remove references to non-existent man-pages. Date: Sat, 28 Aug 2021 20:38:20 +0100 Message-Id: <20210828193824.1288478-3-jeremy@azazel.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210828193824.1288478-1-jeremy@azazel.net> References: <20210828193824.1288478-1-jeremy@azazel.net> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:8b0:fb7d:d6d7:2e4d:54ff:fe4b:a9ae X-SA-Exim-Mail-From: jeremy@azazel.net X-SA-Exim-Scanned: No (on kadath.azazel.net); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org Signed-off-by: Jeremy Sowden --- Makefile.am | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index 9a1cbcb481f4..2a9cdd826dae 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,9 +2,7 @@ SUBDIRS = include src utils ACLOCAL_AMFLAGS = -I m4 -EXTRA_DIST = $(man_MANS) Make_global.am - -man_MANS = #nfnetlink_log.3 nfnetlink_log.7 +EXTRA_DIST = Make_global.am pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libnetfilter_log.pc From patchwork Sat Aug 28 19:38:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Sowden X-Patchwork-Id: 1521916 X-Patchwork-Delegate: pablo@netfilter.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netfilter-devel-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=azazel.net header.i=@azazel.net header.a=rsa-sha256 header.s=20190108 header.b=fH71zSCQ; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4Gxn4c2jY1z9sW8 for ; Sun, 29 Aug 2021 05:40:48 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231544AbhH1Tlg (ORCPT ); Sat, 28 Aug 2021 15:41:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231186AbhH1Tle (ORCPT ); Sat, 28 Aug 2021 15:41:34 -0400 Received: from kadath.azazel.net (kadath.azazel.net [IPv6:2001:8b0:135f:bcd1:e0cb:4eff:fedf:e608]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD2EEC06179A for ; Sat, 28 Aug 2021 12:40:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=azazel.net; s=20190108; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=1NWa/yfYBgbEj5zv1rQHeyh1V4YOWng6X75oclEj0LY=; b=fH71zSCQW6HXn0Mizkr7/Q7Rnv 5D+vaYDLuxuA3ms4Ip4/w4cTxAIsoG2L0jTADL4JihAaHWRLjQfILapzzCDcFvANDl2jhIQeMI41/ mJv2GrvuF3A1ZCHzWDFY+tBwgPTzss4eRSHR8aAwhGX39GV80O9PlryRq30t/BXXB8dunm93hbDAX SbOafKi+Cn7YtOzRgo6HDLFlGrC1VqKOlsjwIe7w4Y1GIIR+WbXQoj51Xr2gc9Vuk0Te1gJ7oLuYE lofMCWqgKLzpqxrplR4avowH5pOComvg+3r5KbgMjnGDj6nz6YbZOHJzieAmjMaNBTT2x6xPFsaBE k3W8JCMQ==; Received: from ulthar.dreamlands.azazel.net ([2001:8b0:fb7d:d6d7:2e4d:54ff:fe4b:a9ae]) by kadath.azazel.net with esmtp (Exim 4.94.2) (envelope-from ) id 1mK4C1-00FeN7-L7; Sat, 28 Aug 2021 20:40:41 +0100 From: Jeremy Sowden To: Pablo Neira Ayuso Cc: Netfilter Devel Subject: [PATCH libnetfilter_log 3/6] doc: fix typo's in example. Date: Sat, 28 Aug 2021 20:38:21 +0100 Message-Id: <20210828193824.1288478-4-jeremy@azazel.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210828193824.1288478-1-jeremy@azazel.net> References: <20210828193824.1288478-1-jeremy@azazel.net> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:8b0:fb7d:d6d7:2e4d:54ff:fe4b:a9ae X-SA-Exim-Mail-From: jeremy@azazel.net X-SA-Exim-Scanned: No (on kadath.azazel.net); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org Use the right group number in nflog_bind_group example. Signed-off-by: Jeremy Sowden --- src/libnetfilter_log.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libnetfilter_log.c b/src/libnetfilter_log.c index 567049ccfb37..339f286f36bc 100644 --- a/src/libnetfilter_log.c +++ b/src/libnetfilter_log.c @@ -182,10 +182,10 @@ struct nfnl_handle *nflog_nfnlh(struct nflog_handle *h) * * Here's a little code snippet that binds to the group 100: * \verbatim - printf("binding this socket to group 0\n"); - qh = nflog_bind_group(h, 0); + printf("binding this socket to group 100\n"); + qh = nflog_bind_group(h, 100); if (!qh) { - fprintf(stderr, "no handle for grup 0\n"); + fprintf(stderr, "no handle for group 100\n"); exit(1); } From patchwork Sat Aug 28 19:38:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Sowden X-Patchwork-Id: 1521919 X-Patchwork-Delegate: pablo@netfilter.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netfilter-devel-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=azazel.net header.i=@azazel.net header.a=rsa-sha256 header.s=20190108 header.b=EVRUa/r0; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4Gxn4d2mrMz9sWS for ; Sun, 29 Aug 2021 05:40:49 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231667AbhH1Tlh (ORCPT ); Sat, 28 Aug 2021 15:41:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231258AbhH1Tle (ORCPT ); Sat, 28 Aug 2021 15:41:34 -0400 Received: from kadath.azazel.net (kadath.azazel.net [IPv6:2001:8b0:135f:bcd1:e0cb:4eff:fedf:e608]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE8FCC0617A8 for ; Sat, 28 Aug 2021 12:40:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=azazel.net; s=20190108; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=ZLHdj073IKs2CD6qqtSTiTkwHNeRVduZamF51rCd2BQ=; b=EVRUa/r0zVDZbqsBGGU0rjaSUh 7A19PO6dR8Q/NwyoxtLG6uRM0xxFOcgSXQAL5MQfZ+TNKAiy6zijL8CTlVev7fJwflM//neLoQbFx dT2NHZZRzQGaRwcItrKE+Ev1Ai5ZUwAmtg+jqffdiY2KNlB7BNf2bRHVB3Aku7ty9ULdMRfznWG9r +Ej5Itj5jWdVE9MRfk2qOHF5Mn5+dvIGWaBQTp9BcBCUWoF1ySkT5LzSVcRTiXr+ew4QAzsaNc5Fj YxY0I1fiCZHNe4CDdogxhpc39/Dca2nt0fxxvWr6Km2fV9p17EwE4QswO4+fHKn7H4eJtjGwbdXk6 GdZdWesQ==; Received: from ulthar.dreamlands.azazel.net ([2001:8b0:fb7d:d6d7:2e4d:54ff:fe4b:a9ae]) by kadath.azazel.net with esmtp (Exim 4.94.2) (envelope-from ) id 1mK4C1-00FeN7-PV; Sat, 28 Aug 2021 20:40:41 +0100 From: Jeremy Sowden To: Pablo Neira Ayuso Cc: Netfilter Devel Subject: [PATCH libnetfilter_log 4/6] src: use calloc instead of malloc + memset. Date: Sat, 28 Aug 2021 20:38:22 +0100 Message-Id: <20210828193824.1288478-5-jeremy@azazel.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210828193824.1288478-1-jeremy@azazel.net> References: <20210828193824.1288478-1-jeremy@azazel.net> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:8b0:fb7d:d6d7:2e4d:54ff:fe4b:a9ae X-SA-Exim-Mail-From: jeremy@azazel.net X-SA-Exim-Scanned: No (on kadath.azazel.net); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org Signed-off-by: Jeremy Sowden --- src/libipulog_compat.c | 3 +-- src/libnetfilter_log.c | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/libipulog_compat.c b/src/libipulog_compat.c index 2d5b23a25c88..99cd86622d9b 100644 --- a/src/libipulog_compat.c +++ b/src/libipulog_compat.c @@ -90,12 +90,11 @@ struct ipulog_handle *ipulog_create_handle(uint32_t gmask, struct ipulog_handle *h; unsigned int group = gmask2group(gmask); - h = malloc(sizeof(*h)+PAYLOAD_SIZE); + h = calloc(1, sizeof(*h)+PAYLOAD_SIZE); if (! h) { ipulog_errno = IPULOG_ERR_HANDLE; return NULL; } - memset(h, 0, sizeof(*h)); h->nfulh = nflog_open(); if (!h->nfulh) goto out_free; diff --git a/src/libnetfilter_log.c b/src/libnetfilter_log.c index 339f286f36bc..7d37570e70cb 100644 --- a/src/libnetfilter_log.c +++ b/src/libnetfilter_log.c @@ -238,11 +238,10 @@ struct nflog_handle *nflog_open_nfnl(struct nfnl_handle *nfnlh) struct nflog_handle *h; int err; - h = malloc(sizeof(*h)); + h = calloc(1, sizeof(*h)); if (!h) return NULL; - memset(h, 0, sizeof(*h)); h->nfnlh = nfnlh; h->nfnlssh = nfnl_subsys_open(h->nfnlh, NFNL_SUBSYS_ULOG, @@ -398,11 +397,10 @@ nflog_bind_group(struct nflog_handle *h, uint16_t num) if (find_gh(h, num)) return NULL; - gh = malloc(sizeof(*gh)); + gh = calloc(1, sizeof(*gh)); if (!gh) return NULL; - memset(gh, 0, sizeof(*gh)); gh->h = h; gh->id = num; From patchwork Sat Aug 28 19:38:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Sowden X-Patchwork-Id: 1521918 X-Patchwork-Delegate: pablo@netfilter.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netfilter-devel-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=azazel.net header.i=@azazel.net header.a=rsa-sha256 header.s=20190108 header.b=SxKh3DpO; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4Gxn4d0TXfz9sW8 for ; Sun, 29 Aug 2021 05:40:49 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231616AbhH1Tlh (ORCPT ); Sat, 28 Aug 2021 15:41:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231207AbhH1Tle (ORCPT ); Sat, 28 Aug 2021 15:41:34 -0400 Received: from kadath.azazel.net (kadath.azazel.net [IPv6:2001:8b0:135f:bcd1:e0cb:4eff:fedf:e608]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEE75C0617AD for ; Sat, 28 Aug 2021 12:40:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=azazel.net; s=20190108; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=/p5GdBJw1itKDswzvW8WXsg/43sfNEJQs+TTJxcAbEA=; b=SxKh3DpO9P2N29XBW50CRwzgJc MjhdTfTwgpPmz2ObTL118kzyVuzEhT5AXRzV1gSb70mN/cWNlliV//EXAEZvgjBogz5BQkc9soe6D j1kDc1uWGXrbhPUSBsWu9Aww5vYUZU0wLTC4PtHqQM+L52yAkVhCYP1D65FkG2iZKulup7GMxI166 tB2Epv0FscNO1+KLmRSlkqmBzRKkoWH1mYNKw9U3wmNoII0n1AWw6Gu8CSxcAOUGrvylSSx3Ku6Qh uZspNZbur2I5HELcq/KnJLkumm7XZNW2krMftAwq6YBDaGrPuBYxiR7YizYI3rch0d5N8PpcG/ftY 9k2NrvoA==; Received: from ulthar.dreamlands.azazel.net ([2001:8b0:fb7d:d6d7:2e4d:54ff:fe4b:a9ae]) by kadath.azazel.net with esmtp (Exim 4.94.2) (envelope-from ) id 1mK4C1-00FeN7-Ta; Sat, 28 Aug 2021 20:40:41 +0100 From: Jeremy Sowden To: Pablo Neira Ayuso Cc: Netfilter Devel Subject: [PATCH libnetfilter_log 5/6] libipulog: use correct index to find attribute in packet. Date: Sat, 28 Aug 2021 20:38:23 +0100 Message-Id: <20210828193824.1288478-6-jeremy@azazel.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210828193824.1288478-1-jeremy@azazel.net> References: <20210828193824.1288478-1-jeremy@azazel.net> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:8b0:fb7d:d6d7:2e4d:54ff:fe4b:a9ae X-SA-Exim-Mail-From: jeremy@azazel.net X-SA-Exim-Scanned: No (on kadath.azazel.net); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org The time-stamp is at `NFULA_TIMESTAMP-1` not `NFULA_TIMESTAMP`. Signed-off-by: Jeremy Sowden --- src/libipulog_compat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libipulog_compat.c b/src/libipulog_compat.c index 99cd86622d9b..bf957274ca22 100644 --- a/src/libipulog_compat.c +++ b/src/libipulog_compat.c @@ -158,7 +158,7 @@ next_msg: printf("next\n"); else h->upmsg.mark = 0; - if (tb[NFULA_TIMESTAMP]) { + if (tb[NFULA_TIMESTAMP-1]) { /* FIXME: 64bit network-to-host */ h->upmsg.timestamp_sec = h->upmsg.timestamp_usec = 0; } else From patchwork Sat Aug 28 19:38:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Sowden X-Patchwork-Id: 1521917 X-Patchwork-Delegate: pablo@netfilter.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netfilter-devel-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=azazel.net header.i=@azazel.net header.a=rsa-sha256 header.s=20190108 header.b=DqlR4Ogb; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4Gxn4c5162z9sWS for ; Sun, 29 Aug 2021 05:40:48 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231564AbhH1Tlg (ORCPT ); Sat, 28 Aug 2021 15:41:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231272AbhH1Tle (ORCPT ); Sat, 28 Aug 2021 15:41:34 -0400 Received: from kadath.azazel.net (kadath.azazel.net [IPv6:2001:8b0:135f:bcd1:e0cb:4eff:fedf:e608]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CC5CC0617AE for ; Sat, 28 Aug 2021 12:40:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=azazel.net; s=20190108; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=NyzxAq6qR6YXxy4vjPrNzZu97mU70icmM6M4QZGNMZI=; b=DqlR4OgbHuAk0kDfHwXtaDOitZ r4zTigp22VM4kn3lTzle2a8n71qjyNtujrhIjylO91dTtZ1FVY7C7UNCKPN41VaJ2JfkY0byi7GLW 9aUzExYipYoROaMKBcXSENLXgKrUdP+ROCQ+k5bEHfqPRj9M9b2mqxdUnx9ZVrucs/PK1DPpLOSH+ mrv3UXJZfCpTTuiH9OHR2+CJKL+yhH/lnYgsZbJQ3KPPpwDB9FOnVr8HEn5SvsSOx3C3udKc77qId qDKcFF2OdbxQ1p8t5IJwtIEUBYesCDBsoG6kzTNzUVBCAVvwf+lHV1Gy76GiC+DDYX+PR/RJlwWA1 1DbaiyMQ==; Received: from ulthar.dreamlands.azazel.net ([2001:8b0:fb7d:d6d7:2e4d:54ff:fe4b:a9ae]) by kadath.azazel.net with esmtp (Exim 4.94.2) (envelope-from ) id 1mK4C2-00FeN7-0L; Sat, 28 Aug 2021 20:40:42 +0100 From: Jeremy Sowden To: Pablo Neira Ayuso Cc: Netfilter Devel Subject: [PATCH libnetfilter_log 6/6] libipulog: fill in missing packet fields. Date: Sat, 28 Aug 2021 20:38:24 +0100 Message-Id: <20210828193824.1288478-7-jeremy@azazel.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210828193824.1288478-1-jeremy@azazel.net> References: <20210828193824.1288478-1-jeremy@azazel.net> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:8b0:fb7d:d6d7:2e4d:54ff:fe4b:a9ae X-SA-Exim-Mail-From: jeremy@azazel.net X-SA-Exim-Scanned: No (on kadath.azazel.net); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org Retrieval of time-stamp, input- and output-device fields had not been implemented in `ipulog_get_packet`. Signed-off-by: Jeremy Sowden --- src/libipulog_compat.c | 23 ++++++++++++++++------- utils/ulog_test.c | 7 +++++++ 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/libipulog_compat.c b/src/libipulog_compat.c index bf957274ca22..85f7cf59c2fc 100644 --- a/src/libipulog_compat.c +++ b/src/libipulog_compat.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -159,20 +160,29 @@ next_msg: printf("next\n"); h->upmsg.mark = 0; if (tb[NFULA_TIMESTAMP-1]) { - /* FIXME: 64bit network-to-host */ - h->upmsg.timestamp_sec = h->upmsg.timestamp_usec = 0; + struct nfulnl_msg_packet_timestamp *ts; + ts = NFA_DATA(tb[NFULA_TIMESTAMP-1]); + + h->upmsg.timestamp_sec = __be64_to_cpu(ts->sec); + h->upmsg.timestamp_usec = __be64_to_cpu(ts->usec); } else h->upmsg.timestamp_sec = h->upmsg.timestamp_usec = 0; if (tb[NFULA_IFINDEX_INDEV-1]) { - /* FIXME: ifindex lookup */ - h->upmsg.indev_name[0] = '\0'; + void *indev_ptr = NFA_DATA(tb[NFULA_IFINDEX_INDEV-1]); + uint32_t indev_idx = ntohl(*(uint32_t *)indev_ptr); + + if (!if_indextoname(indev_idx, h->upmsg.indev_name)) + h->upmsg.indev_name[0] = '\0'; } else h->upmsg.indev_name[0] = '\0'; if (tb[NFULA_IFINDEX_OUTDEV-1]) { - /* FIXME: ifindex lookup */ - h->upmsg.outdev_name[0] = '\0'; + void *outdev_ptr = NFA_DATA(tb[NFULA_IFINDEX_OUTDEV-1]); + uint32_t outdev_idx = ntohl(*(uint32_t *)outdev_ptr); + + if (!if_indextoname(outdev_idx, h->upmsg.outdev_name)) + h->upmsg.outdev_name[0] = '\0'; } else h->upmsg.outdev_name[0] = '\0'; @@ -222,4 +232,3 @@ void ipulog_perror(const char *s) fprintf(stderr, ": %s", strerror(errno)); fputc('\n', stderr); } - diff --git a/utils/ulog_test.c b/utils/ulog_test.c index f3adec2daf2e..20f61630d2ef 100644 --- a/utils/ulog_test.c +++ b/utils/ulog_test.c @@ -27,6 +27,13 @@ void handle_packet(ulog_packet_msg_t *pkt) pkt->hook, pkt->mark, pkt->data_len); if (strlen(pkt->prefix)) printf("Prefix=%s ", pkt->prefix); + if (strlen(pkt->indev_name)) + printf("Input device=%s ", pkt->indev_name); + if (strlen(pkt->outdev_name)) + printf("Output device=%s ", pkt->outdev_name); + if (pkt->timestamp_sec || pkt->timestamp_usec) + printf("Timestamp=%ld.%06lds ", + pkt->timestamp_sec, pkt->timestamp_usec); if (pkt->mac_len) {