iptraf-ng: Upgrade to 1.2.1

Add patch to fix cross build
Fix runtime with systemd

Release notes
https://github.com/iptraf-ng/iptraf-ng/releases/tag/v1.2.0
https://github.com/iptraf-ng/iptraf-ng/releases/tag/v1.2.1

Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Khem Raj
2021-10-30 10:48:10 -07:00
parent ce3c3f2099
commit dfe7eef9ca
5 changed files with 100 additions and 88 deletions
@@ -1,54 +0,0 @@
From 86b4d398dbb95e2437b70eba3b30e995ec9be505 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 31 Aug 2017 20:47:50 -0700
Subject: [PATCH] Fix printd formatting strings
Fixes
error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security]
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
src/ipfilter.c | 2 +-
src/othptab.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/ipfilter.c b/src/ipfilter.c
index eb17ec7..8c76e4c 100644
--- a/src/ipfilter.c
+++ b/src/ipfilter.c
@@ -146,7 +146,7 @@ void gethostparams(struct hostparams *data, char *init_saddr, char *init_smask,
snprintf(msgstr, 60,
"Invalid protocol input at or near token \"%s\"",
bptr);
- tui_error(ANYKEY_MSG, msgstr);
+ tui_error(ANYKEY_MSG, "%s", msgstr);
doagain = 1;
} else
doagain = 0;
diff --git a/src/othptab.c b/src/othptab.c
index 142c9c2..fe395c2 100644
--- a/src/othptab.c
+++ b/src/othptab.c
@@ -410,7 +410,7 @@ void printothpentry(struct othptable *table, struct othptabent *entry,
break;
}
- sprintf(scratchpad, rarp_mac_addr);
+ sprintf(scratchpad, "%s", rarp_mac_addr);
strcat(msgstring, scratchpad);
wattrset(table->othpwin, ARPATTR);
break;
@@ -485,7 +485,7 @@ void printothpentry(struct othptable *table, struct othptabent *entry,
wattrset(table->othpwin, UNKNIPATTR);
protptr = getprotobynumber(entry->protocol);
if (protptr != NULL) {
- sprintf(protname, protptr->p_aliases[0]);
+ sprintf(protname, "%s", protptr->p_aliases[0]);
} else {
sprintf(protname, "IP protocol");
unknown = 1;
--
2.14.1
@@ -0,0 +1,44 @@
From 223de708552b1ab00ac1a119e82e13deed573036 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 30 Oct 2021 10:22:38 -0700
Subject: [PATCH] make: Make CC weak assignment
This ensures that if environment overrrides it then its respected, this
helps cross-compiling cases
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/Makefile
+++ b/Makefile
@@ -18,14 +18,14 @@ VERSION-FILE: FORCE
@$(SHELL_PATH) ./GEN-VERSION-FILE
-include VERSION-FILE
-CFLAGS = -g -O2 -Wall -W -Werror=format-security
-LDFLAGS =
+CFLAGS += -g -O2 -Wall -W -Werror=format-security
+LDFLAGS ?=
IPTRAF_CFLAGS := -std=gnu99 -D_GNU_SOURCE
ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS) $(IPTRAF_CFLAGS)
ALL_LDFLAGS = $(LDFLAGS)
STRIP ?= strip
-prefix = $(HOME)
+prefix ?= $(HOME)
sbindir_relative = sbin
sbindir = $(prefix)/$(sbindir_relative)
mandir = $(prefix)/share/man
@@ -39,7 +39,7 @@ pathsep = :
export prefix bindir sharedir sysconfdir gitwebdir localedir
-CC = cc
+CC ?= cc
RM = rm -f
INSTALL = install
RPMBUILD = rpmbuild
@@ -0,0 +1 @@
d /run/iptraf-ng 0755 root root -
@@ -2,11 +2,9 @@ Use pkg-config to search for ncurses libraries
Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
Upstream-Status: Pending Upstream-Status: Pending
Index: iptraf-ng-1.1.4/Makefile --- a/Makefile
=================================================================== +++ b/Makefile
--- iptraf-ng-1.1.4.orig/Makefile @@ -201,8 +201,8 @@ endif
+++ iptraf-ng-1.1.4/Makefile
@@ -205,8 +205,8 @@ endif
ifndef NCURSES_LDFLAGS ifndef NCURSES_LDFLAGS
ifdef NEEDS_NCURSES5 ifdef NEEDS_NCURSES5
@@ -17,7 +15,7 @@ Index: iptraf-ng-1.1.4/Makefile
ifndef NO_PANEL ifndef NO_PANEL
NCURSES_LDFLAGS += -lpanel NCURSES_LDFLAGS += -lpanel
endif endif
@@ -215,8 +215,8 @@ endif @@ -211,8 +211,8 @@ endif
ifndef NCURSES_LDFLAGS ifndef NCURSES_LDFLAGS
ifdef NEEDS_NCURSESW5 ifdef NEEDS_NCURSESW5
@@ -26,9 +24,9 @@ Index: iptraf-ng-1.1.4/Makefile
+ NCURSES_CFLAGS := $(shell p[k-config ncursesw --cflags 2>/dev/null) + NCURSES_CFLAGS := $(shell p[k-config ncursesw --cflags 2>/dev/null)
+ NCURSES_LDFLAGS := $(shell pkg-config ncursesw --libs 2>/dev/null) + NCURSES_LDFLAGS := $(shell pkg-config ncursesw --libs 2>/dev/null)
ifndef NO_PANEL ifndef NO_PANEL
NCURSES_LDFLAGS += -lpanel NCURSES_LDFLAGS += -lpanelw
endif endif
@@ -225,8 +225,8 @@ endif @@ -221,8 +221,8 @@ endif
ifndef NCURSES_LDFLAGS ifndef NCURSES_LDFLAGS
ifdef NEEDS_NCURSES6 ifdef NEEDS_NCURSES6
@@ -39,7 +37,7 @@ Index: iptraf-ng-1.1.4/Makefile
ifndef NO_PANEL ifndef NO_PANEL
NCURSES_LDFLAGS += -lpanel NCURSES_LDFLAGS += -lpanel
endif endif
@@ -235,8 +235,8 @@ endif @@ -231,8 +231,8 @@ endif
ifndef NCURSES_LDFLAGS ifndef NCURSES_LDFLAGS
ifdef NEEDS_NCURSESW6 ifdef NEEDS_NCURSESW6
@@ -48,34 +46,45 @@ Index: iptraf-ng-1.1.4/Makefile
+ NCURSES_CFLAGS := $(shell pkg-config ncursesw --cflags 2>/dev/null) + NCURSES_CFLAGS := $(shell pkg-config ncursesw --cflags 2>/dev/null)
+ NCURSES_LDFLAGS := $(shell pkg-config ncursesw --libs 2>/dev/null) + NCURSES_LDFLAGS := $(shell pkg-config ncursesw --libs 2>/dev/null)
ifndef NO_PANEL ifndef NO_PANEL
NCURSES_LDFLAGS += -lpanel NCURSES_LDFLAGS += -lpanelw
endif endif
@@ -246,17 +246,17 @@ endif @@ -241,27 +241,27 @@ endif
# try find ncuses by autodetect # try find ncuses by autodetect
ifndef NCURSES_LDFLAGS ifndef NCURSES_LDFLAGS
ifneq ($(shell ncursesw6-config --libs 2>/dev/null),) - ifneq ($(shell ncursesw6-config --libs 2>/dev/null),)
- NCURSES_CFLAGS := $(shell ncursesw6-config --cflags 2>/dev/null) - NCURSES_CFLAGS := $(shell ncursesw6-config --cflags 2>/dev/null)
- NCURSES_LDFLAGS := $(shell ncursesw6-config --libs 2>/dev/null) - NCURSES_LDFLAGS := $(shell ncursesw6-config --libs 2>/dev/null)
+ ifneq ($(shell pkg-config ncursesw --libs 2>/dev/null),)
+ NCURSES_CFLAGS := $(shell pkg-config ncursesw --cflags 2>/dev/null)
+ NCURSES_LDFLAGS := $(shell pkg-config ncursesw --libs 2>/dev/null)
ifndef NO_PANEL
NCURSES_LDFLAGS += -lpanelw
endif
- else ifneq ($(shell ncurses6-config --libs 2>/dev/null),) - else ifneq ($(shell ncurses6-config --libs 2>/dev/null),)
- NCURSES_CFLAGS := $(shell ncurses6-config --cflags 2>/dev/null) - NCURSES_CFLAGS := $(shell ncurses6-config --cflags 2>/dev/null)
- NCURSES_LDFLAGS := $(shell ncurses6-config --libs 2>/dev/null) - NCURSES_LDFLAGS := $(shell ncurses6-config --libs 2>/dev/null)
- else ifneq ($(shell ncursesw5-config --libs 2>/dev/null),)
- NCURSES_CFLAGS := $(shell ncursesw5-config --cflags 2>/dev/null)
- NCURSES_LDFLAGS := $(shell ncursesw5-config --libs 2>/dev/null)
- else ifneq ($(shell ncurses5-config --libs 2>/dev/null),)
- NCURSES_CFLAGS := $(shell ncurses5-config --cflags 2>/dev/null)
- NCURSES_LDFLAGS := $(shell ncurses5-config --libs 2>/dev/null)
+ NCURSES_CFLAGS := $(shell pkg-config ncursesw --cflags 2>/dev/null)
+ NCURSES_LDFLAGS := $(shell pkg-config ncursesw --libs 2>/dev/null)
+ else ifneq ($(shell pkg-config ncurses --libs 2>/dev/null),)
+ NCURSES_CFLAGS := $(shell pkg-config ncurses --cflags 2>/dev/null)
+ NCURSES_LDFLAGS := $(shell pkg-config ncurses --libs 2>/dev/null)
+ else ifneq ($(shell pkg-config ncursesw --libs 2>/dev/null),) + else ifneq ($(shell pkg-config ncursesw --libs 2>/dev/null),)
+ NCURSES_CFLAGS := $(shell pkg-config ncursesw --cflags 2>/dev/null) + NCURSES_CFLAGS := $(shell pkg-config ncursesw --cflags 2>/dev/null)
+ NCURSES_LDFLAGS := $(shell pkg-config ncursesw --libs 2>/dev/null) + NCURSES_LDFLAGS := $(shell pkg-config ncursesw --libs 2>/dev/null)
+ else ifneq ($(shell pkg-config ncurses --libs 2>/dev/null),) ifndef NO_PANEL
+ NCURSES_CFLAGS := $(shell pkg-config ncurses --cflags 2>/dev/null) NCURSES_LDFLAGS += -lpanel
+ NCURSES_LDFLAGS := $(shell pkg-config ncurses --libs 2>/dev/null) endif
- else ifneq ($(shell ncursesw5-config --libs 2>/dev/null),)
- NCURSES_CFLAGS := $(shell ncursesw5-config --cflags 2>/dev/null)
- NCURSES_LDFLAGS := $(shell ncursesw5-config --libs 2>/dev/null)
+ else ifneq ($(shell pkg-config ncursesw --libs 2>/dev/null),)
+ NCURSES_CFLAGS := $(shell pkg-config ncursesw --cflags 2>/dev/null)
+ NCURSES_LDFLAGS := $(shell pkg-config ncursesw --libs 2>/dev/null)
ifndef NO_PANEL
NCURSES_LDFLAGS += -lpanelw
endif
- else ifneq ($(shell ncurses5-config --libs 2>/dev/null),)
- NCURSES_CFLAGS := $(shell ncurses5-config --cflags 2>/dev/null)
- NCURSES_LDFLAGS := $(shell ncurses5-config --libs 2>/dev/null)
+ else ifneq ($(shell pkg-config ncursesw --libs 2>/dev/null),)
+ NCURSES_CFLAGS := $(shell pkg-config ncursesw --cflags 2>/dev/null)
+ NCURSES_LDFLAGS := $(shell pkg-config ncursesw --libs 2>/dev/null)
ifndef NO_PANEL
NCURSES_LDFLAGS += -lpanel
endif endif
ifneq ($(NCURSES_LDFLAGS),)
@@ -24,17 +24,29 @@ LICENSE = "GPL-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=e2b3850593b899b1a17594ed4cc4c731" LIC_FILES_CHKSUM = "file://LICENSE;md5=e2b3850593b899b1a17594ed4cc4c731"
DEPENDS = "ncurses" DEPENDS = "ncurses"
SRC_URI = "http://pkgs.fedoraproject.org/repo/pkgs/iptraf-ng/iptraf-ng-1.1.4.tar.gz/e0f8df3b7baf2b5106709abc4f8c029a/${BP}.tar.gz \ SRC_URI = "https://src.fedoraproject.org/repo/pkgs/iptraf-ng/v${PV}.tar.gz/sha512/44d36fc92cdbf379f62cb63638663c3ee610225b9c28d60ee55e62e358f398a6b0db281129327b3472e45fb553ee3dd605af09c129f2233f8839ae3dbd799384/v${PV}.tar.gz \
file://iptraf-ng-tmpfiles.conf \
file://ncurses-config.patch \ file://ncurses-config.patch \
file://0001-Fix-printd-formatting-strings.patch \ file://0001-make-Make-CC-weak-assignment.patch \
" "
SRC_URI[md5sum] = "e0f8df3b7baf2b5106709abc4f8c029a" SRC_URI[sha256sum] = "9f5cef584065420dea1ba32c86126aede1fa9bd25b0f8362b0f9fd9754f00870"
SRC_URI[sha256sum] = "16b9b05bf5d3725d86409b901696639ad46944d02de6def87b1ceae5310dd35c"
inherit autotools-brokensep pkgconfig inherit pkgconfig
CFLAGS += "-D_GNU_SOURCE" CFLAGS += "-D_GNU_SOURCE"
do_compile() {
oe_runmake
}
do_install() {
oe_runmake DESTDIR=${D} install
install -d -m 0755 ${D}${localstatedir}/{log,lib}/iptraf-ng
install -D -m 0644 -p ${S}/iptraf-ng-logrotate.conf ${D}${sysconfdir}/logrotate.d/iptraf-ng
install -Dm 0644 ${WORKDIR}/iptraf-ng-tmpfiles.conf ${D}${libdir}/tmpfiles.d/iptraf-ng-tmpfiles.conf
}
FILES:${PN} += "${libdir}/tmpfiles.d"
PROVIDES = "iptraf" PROVIDES = "iptraf"
RPROVIDES:${PN} += "iptraf" RPROVIDES:${PN} += "iptraf"
RREPLACES:${PN} += "iptraf" RREPLACES:${PN} += "iptraf"