diff --git a/meta-sysmocom-bsp/recipes-extra/nfacct/files/0001-Add-JSON-output-formatting-to-nfacct-utility.patch b/meta-sysmocom-bsp/recipes-extra/nfacct/files/0001-Add-JSON-output-formatting-to-nfacct-utility.patch index f956d1174f..121ff24e50 100644 --- a/meta-sysmocom-bsp/recipes-extra/nfacct/files/0001-Add-JSON-output-formatting-to-nfacct-utility.patch +++ b/meta-sysmocom-bsp/recipes-extra/nfacct/files/0001-Add-JSON-output-formatting-to-nfacct-utility.patch @@ -1,4 +1,4 @@ -From aefba0f03444345dd5384631203f61647637175d Mon Sep 17 00:00:00 2001 +From 83745c87b294166ff4dbee4a781e7eb5d4f568b8 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Tue, 19 May 2015 22:12:06 +0200 Subject: [PATCH] Add JSON output formatting to nfacct utility @@ -6,8 +6,8 @@ Subject: [PATCH] Add JSON output formatting to nfacct utility This is based on the JSON support patch of libnetfilter_acct. --- nfacct.8 | 2 ++ - src/nfacct.c | 87 ++++++++++++++++++++++++++++++++++++++++++++---------------- - 2 files changed, 66 insertions(+), 23 deletions(-) + src/nfacct.c | 89 ++++++++++++++++++++++++++++++++++++++++++++---------------- + 2 files changed, 68 insertions(+), 23 deletions(-) diff --git a/nfacct.8 b/nfacct.8 index 0c3249c..bf563ae 100644 @@ -23,7 +23,7 @@ index 0c3249c..bf563ae 100644 .SH SEE ALSO .BR iptables (8) diff --git a/src/nfacct.c b/src/nfacct.c -index 2546a6e..a55655a 100644 +index 2546a6e..d46ee91 100644 --- a/src/nfacct.c +++ b/src/nfacct.c @@ -137,13 +137,13 @@ int main(int argc, char *argv[]) @@ -42,7 +42,7 @@ index 2546a6e..a55655a 100644 nfacct = nfacct_alloc(); if (nfacct == NULL) { -@@ -156,17 +156,36 @@ static int nfacct_cb(const struct nlmsghdr *nlh, void *data) +@@ -156,17 +156,38 @@ static int nfacct_cb(const struct nlmsghdr *nlh, void *data) goto err_free; } @@ -60,7 +60,9 @@ index 2546a6e..a55655a 100644 + break; + case NFACCT_SNPRINTF_T_JSON: + if (!fmt_header) { -+ printf("{ \"nfacct_counters\" : [\n"); ++ printf("{ \"timestamp\" : %lld, \n" ++ " \"nfacct_counters\" : [\n", ++ (long long) time(NULL)); + fmt_header = true; + } else + printf(",\n"); @@ -87,7 +89,7 @@ index 2546a6e..a55655a 100644 err_free: nfacct_free(nfacct); -@@ -174,9 +193,26 @@ err: +@@ -174,9 +195,26 @@ err: return MNL_CB_OK; } @@ -115,7 +117,7 @@ index 2546a6e..a55655a 100644 struct mnl_socket *nl; char buf[MNL_SOCKET_BUFFER_SIZE]; struct nlmsghdr *nlh; -@@ -190,9 +226,13 @@ static int nfacct_cmd_list(int argc, char *argv[]) +@@ -190,9 +228,13 @@ static int nfacct_cmd_list(int argc, char *argv[]) duparg(argv[i]); zeroctr = true; } else if (strncmp(argv[i], "xml", strlen(argv[i])) == 0) { @@ -131,7 +133,7 @@ index 2546a6e..a55655a 100644 } else if (strncmp(argv[i], "counters", strlen(argv[i])) == 0) { if (mask || value) duparg(argv[i]); -@@ -251,7 +291,7 @@ static int nfacct_cmd_list(int argc, char *argv[]) +@@ -251,7 +293,7 @@ static int nfacct_cmd_list(int argc, char *argv[]) ret = mnl_socket_recvfrom(nl, buf, sizeof(buf)); while (ret > 0) { @@ -140,7 +142,7 @@ index 2546a6e..a55655a 100644 if (ret <= 0) break; ret = mnl_socket_recvfrom(nl, buf, sizeof(buf)); -@@ -262,8 +302,7 @@ static int nfacct_cmd_list(int argc, char *argv[]) +@@ -262,8 +304,7 @@ static int nfacct_cmd_list(int argc, char *argv[]) } mnl_socket_close(nl); @@ -150,7 +152,7 @@ index 2546a6e..a55655a 100644 return 0; } -@@ -444,7 +483,8 @@ static int nfacct_cmd_delete(int argc, char *argv[]) +@@ -444,7 +485,8 @@ static int nfacct_cmd_delete(int argc, char *argv[]) static int nfacct_cmd_get(int argc, char *argv[]) { @@ -160,7 +162,7 @@ index 2546a6e..a55655a 100644 struct mnl_socket *nl; char buf[MNL_SOCKET_BUFFER_SIZE]; struct nlmsghdr *nlh; -@@ -460,7 +500,9 @@ static int nfacct_cmd_get(int argc, char *argv[]) +@@ -460,7 +502,9 @@ static int nfacct_cmd_get(int argc, char *argv[]) if (strncmp(argv[i], "reset", strlen(argv[i])) == 0) { zeroctr = true; } else if (strncmp(argv[i], "xml", strlen(argv[i])) == 0) { @@ -171,7 +173,7 @@ index 2546a6e..a55655a 100644 } else { nfacct_perror("unknown argument"); return -1; -@@ -503,7 +545,7 @@ static int nfacct_cmd_get(int argc, char *argv[]) +@@ -503,7 +547,7 @@ static int nfacct_cmd_get(int argc, char *argv[]) ret = mnl_socket_recvfrom(nl, buf, sizeof(buf)); while (ret > 0) { @@ -180,7 +182,7 @@ index 2546a6e..a55655a 100644 if (ret <= 0) break; ret = mnl_socket_recvfrom(nl, buf, sizeof(buf)); -@@ -514,8 +556,7 @@ static int nfacct_cmd_get(int argc, char *argv[]) +@@ -514,8 +558,7 @@ static int nfacct_cmd_get(int argc, char *argv[]) } mnl_socket_close(nl); @@ -190,7 +192,7 @@ index 2546a6e..a55655a 100644 return 0; } -@@ -660,7 +701,7 @@ static int nfacct_cmd_restore(int argc, char *argv[]) +@@ -660,7 +703,7 @@ static int nfacct_cmd_restore(int argc, char *argv[]) static int nfacct_cmd_monitor(int argc, char *argv[]) { struct mnl_socket *nl; @@ -199,7 +201,7 @@ index 2546a6e..a55655a 100644 char buf[MNL_SOCKET_BUFFER_SIZE]; int ret, option = NFNLGRP_ACCT_QUOTA; -@@ -685,7 +726,7 @@ static int nfacct_cmd_monitor(int argc, char *argv[]) +@@ -685,7 +728,7 @@ static int nfacct_cmd_monitor(int argc, char *argv[]) break; } diff --git a/meta-sysmocom-bsp/recipes-extra/nfacct/nfacct_git.bb b/meta-sysmocom-bsp/recipes-extra/nfacct/nfacct_git.bb index f7b5e58ea2..4f42ce0db8 100644 --- a/meta-sysmocom-bsp/recipes-extra/nfacct/nfacct_git.bb +++ b/meta-sysmocom-bsp/recipes-extra/nfacct/nfacct_git.bb @@ -4,6 +4,8 @@ LICENSE = "GPLv2+" LIC_FILES_CHKSUM = "file://COPYING;md5=8ca43cbc842c2336e835926c2166c28b" PV="1.0.1+git${SRCPV}" +PR="r1" + DEPENDS = "libmnl libnetfilter-acct" SRC_URI = "git://git.netfilter.org/nfacct;branch=master \ diff --git a/meta-sysmocom-bsp/recipes-extra/perl-json/libcommon-sense-perl_3.73.bb b/meta-sysmocom-bsp/recipes-extra/perl-json/libcommon-sense-perl_3.73.bb deleted file mode 100644 index aae2cdacde..0000000000 --- a/meta-sysmocom-bsp/recipes-extra/perl-json/libcommon-sense-perl_3.73.bb +++ /dev/null @@ -1,17 +0,0 @@ -SUMMARY = "Module needed by libjson-xs-perl" -DESCRIPTION = "" -HOMEPAGE = "http://search.cpan.org/~mlehmann/common-sense-3.73/sense.pod" -SECTION = "libs" -LICENSE = "Artistic-1.0 | GPL-1.0+" - -LIC_FILES_CHKSUM = "file://LICENSE;md5=043dba8b278e1db1b0ef93f30140b02b" - -SRC_URI = "http://search.cpan.org/CPAN/authors/id/M/ML/MLEHMANN/common-sense-${PV}.tar.gz" -SRC_URI[md5sum] = "6da7455a43ab60ed21c2a5e3b3ddeda8" -SRC_URI[sha256sum] = "8110c5e472641e0c218f8e023cecc1612ef66f9a1b313261fe219862efe3fd10" - -S = "${WORKDIR}/common-sense-${PV}" - -inherit cpan - -BBCLASSEXTEND = "native" diff --git a/meta-sysmocom-bsp/recipes-extra/perl-json/libjson-perl_2.90.bb b/meta-sysmocom-bsp/recipes-extra/perl-json/libjson-perl_2.90.bb index 3c90261c6b..94b0e62e3b 100644 --- a/meta-sysmocom-bsp/recipes-extra/perl-json/libjson-perl_2.90.bb +++ b/meta-sysmocom-bsp/recipes-extra/perl-json/libjson-perl_2.90.bb @@ -6,7 +6,6 @@ LICENSE = "Artistic-1.0 | GPL-1.0+" RDEPENDS_${PN} = " perl-module-carp \ perl-module-overload \ perl-module-constant \ - libjson-xs-perl \ " LIC_FILES_CHKSUM = "file://MYMETA.yml;md5=109a8b45192a65e7f220dd0bf3bdfbad" diff --git a/meta-sysmocom-bsp/recipes-extra/perl-json/libjson-xs-perl_3.01.bb b/meta-sysmocom-bsp/recipes-extra/perl-json/libjson-xs-perl_3.01.bb deleted file mode 100644 index ff33b2630a..0000000000 --- a/meta-sysmocom-bsp/recipes-extra/perl-json/libjson-xs-perl_3.01.bb +++ /dev/null @@ -1,20 +0,0 @@ -SUMMARY = "The Perl JSON API" -DESCRIPTION = "" -HOMEPAGE = "http://search.cpan.org/~makamaka/JSON-2.90/lib/JSON.pm" -SECTION = "libs" -LICENSE = "Artistic-1.0 | GPL-1.0+" -RDEPENDS_${PN} = " perl-module-encoding \ - libcommon-sense-perl \ -" - -LIC_FILES_CHKSUM = "file://COPYING;md5=043dba8b278e1db1b0ef93f30140b02b" - -SRC_URI = "http://search.cpan.org/CPAN/authors/id/M/ML/MLEHMANN/JSON-XS-${PV}.tar.gz" -SRC_URI[md5sum] = "b7be65295baf6dd9233c6494782c1153" -SRC_URI[sha256sum] = "4e8df3256a5aa9ed304ce1bbcd9140737deef31ba847bff9f4c15480c88c71ab" - -S = "${WORKDIR}/JSON-XS-${PV}" - -inherit cpan - -BBCLASSEXTEND = "native"