Bug 276516 - net-mgmt/fastnetmon: Update to 1.2.6
Summary: net-mgmt/fastnetmon: Update to 1.2.6
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Daniel Engberg
URL: https://github.com/pavel-odintsov/fas...
Keywords:
Depends on: 276617
Blocks: 276718
  Show dependency treegraph
 
Reported: 2024-01-22 09:28 UTC by Marek Zarychta
Modified: 2024-02-18 16:27 UTC (History)
5 users (show)

See Also:
farrokhi: maintainer-feedback+


Attachments
upgrade patch (1.31 KB, patch)
2024-01-22 09:28 UTC, Marek Zarychta
no flags Details | Diff
upgrade patch v2 (1.98 KB, patch)
2024-01-23 23:09 UTC, Marek Zarychta
no flags Details | Diff
build log (5.94 KB, text/plain)
2024-01-24 06:02 UTC, Marek Zarychta
no flags Details
upgrade patch (2.32 KB, patch)
2024-01-24 18:19 UTC, Marek Zarychta
no flags Details | Diff
upgrade patch (1.98 KB, patch)
2024-01-24 18:51 UTC, Marek Zarychta
no flags Details | Diff
upgrade patch (5.74 KB, patch)
2024-01-24 22:15 UTC, Marek Zarychta
no flags Details | Diff
upgrade patch (4.88 KB, patch)
2024-01-25 11:11 UTC, Marek Zarychta
no flags Details | Diff
Patch for fastnetmon (10.20 KB, patch)
2024-01-25 19:51 UTC, Daniel Engberg
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marek Zarychta 2024-01-22 09:28:46 UTC
Created attachment 247837 [details]
upgrade patch

Please don't hesitate to commit this. The daemon is working fine in production on 13.3-PRERELEASE with the most recent version of net/gobgp (3.22). I am not attaching build logs, but bumping CXXSTD to c++20 is required.
Comment 1 Marek Zarychta 2024-01-23 23:09:18 UTC
Created attachment 247907 [details]
upgrade patch v2

Today devel/grpc142 was marked broken by the maintainer. It's not possible to build net-mgmt/fastnetmon with the suggested devel/grpc so I created devel/grpc151 following the Debian approach. Perhaps it will get committed (see bug 276574). 
The port upgrade patch was refreshed accordingly. Adding -DENABLE_CAPNP_SUPPORT=OFF was suggested by the author - it simplifies the build process and apparently has no impact on any feature (suggested on IRC by the developer). Thus the port can be built now with clang 17 from the base.
Comment 2 Vladimir Druzenko freebsd_committer freebsd_triage 2024-01-24 05:51:16 UTC
Why authors can't update it with support of grpc 1.60?
Comment 3 Marek Zarychta 2024-01-24 06:02:56 UTC
Created attachment 247913 [details]
build log

(In reply to Vladimir Druzenko from comment #2)
Apparently, the port builds with the most recent gRPC on MacOS, but I wasn't able to build it (see attached build log excerpt).
Comment 4 Vladimir Druzenko freebsd_committer freebsd_triage 2024-01-24 07:01:45 UTC
Probably something like this can help (used in devel/grpc):
USES= compiler:c++17-lang
USE_CSTD=       c11
USE_CXXSTD=	c++17
CMAKE_ARGS=     -DCMAKE_CXX_STANDARD=17
Comment 5 Marek Zarychta 2024-01-24 08:31:26 UTC
(In reply to Vladimir Druzenko from comment #4)
Fastnetmon 1.2.6 will not build with c++17 standard, at least using llvm, regardless it was Clang 15 or 17 from the base. The only acceptable standard seems to be c++20 I have not tried to build it with gcc compiler though - perhaps it's right solution.
Comment 6 Marek Zarychta 2024-01-24 18:19:08 UTC
Created attachment 247931 [details]
upgrade patch

Patch updated to reflect changes in bug 276574
Comment 7 Marek Zarychta 2024-01-24 18:51:06 UTC
Created attachment 247932 [details]
upgrade patch

Removed extra patch added accidentally
Comment 8 Marek Zarychta 2024-01-24 22:15:42 UTC
Created attachment 247938 [details]
upgrade patch

Troubleshoot again, as suggested by diizzy@. Now it builds with the recent devel/grpc.
Comment 9 Matthias Fechner freebsd_committer freebsd_triage 2024-01-25 07:01:24 UTC
Can you maybe rebase your patch on the current version that is present in ports?
It seems to apply, but it shows a lot of whitespace problems:

g apply 247938.patch
247938.patch:81: trailing whitespace.

247938.patch:82: trailing whitespace.
-    # By default use module supplied by cmake to search for Protobuf
247938.patch:89: trailing whitespace.
       # protobuf_21_12/lib/cmake/protobuf or  protobuf_21_12/lib64/cmake/protobuf on CentOS
247938.patch:90: trailing whitespace.
       list(APPEND CMAKE_PREFIX_PATH ${PROTOCOL_BUFFERS_CUSTOM_INSTALL_PATH})
247938.patch:92: trailing whitespace.

warning: squelched 5 whitespace errors
warning: 10 lines add whitespace errors.

If the maintainer approve it, I can commit the update.
Comment 11 Marek Zarychta 2024-01-25 07:17:04 UTC
(In reply to Matthias Fechner from comment #9)
Thank you for looking at this PR. The patch you mentioned was taken from this commit[1]. If it's required I will eventually try to fix it and rebase later.
Of course, I have tested not only the build, but I am running this vicious daemon. I thought about polishing it a bit, so perhaps it should be reworked to use samples and avoid overwriting customized files in 3 cases:
bin/notify_about_attack.sh
etc/networks_list
etc/networks_whitelist
There is also a flaw with the pid file creation, which I tried to fix, but it requires debugging.
Anyway, it's worth updating this port, considering that devel/grpc142 is marked broken.

1. https://github.com/pavel-odintsov/fastnetmon/commit/fad8757b8986226024d549a6dfb40abbab01643e.patch?full_index=1
Comment 12 Matthias Fechner freebsd_committer freebsd_triage 2024-01-25 07:45:33 UTC
(In reply to Marek Zarychta from comment #11)
There is no need to add upstream patches as local files.
You can include them, see e.g. in `devel/gitlab-runner/Makefile` for an example.

Search the ports directory to find an example for github.

If you include it as a MR (merge request) or an upstream commit, it is also easier in the future if that commit is included into a newer version to better understand build errors.
Comment 13 Marek Zarychta 2024-01-25 07:56:36 UTC
(In reply to Matthias Fechner from comment #12)
OK, thanks for the clue. I have a great mentor inside the FreeBSD community who suggested the same, but since it's farokhi@'s port I don't want to mess too much with it. I will change and submit an updated patch later today.
Comment 14 Marek Zarychta 2024-01-25 11:11:50 UTC
Created attachment 247945 [details]
upgrade patch

net-mgmt/fastnetmon: Update to 1.2.6

	- Updated dependency on gRPC
	- Fixed build with updated Protobuf
	- Fixed pid file logic
	- Customized configuration files and script are now preserved during upgrades
Comment 15 Matthias Fechner freebsd_committer freebsd_triage 2024-01-25 12:21:29 UTC
(In reply to Marek Zarychta from comment #14)
Just test building it:
https://gitlab.fechner.net/mfechner/Gitlab/-/commits/276516
Comment 16 Marek Zarychta 2024-01-25 12:55:18 UTC
(In reply to Matthias Fechner from comment #15)
Of course, it builds and runs fine, otherwise, I wouldn't submit it.

http://pkg.pansjar.eu/data/builder13stable-default/2024-01-25_11h18m22s/logs/fastnetmon-1.2.6.log
http://pkg.pansjar.eu/data/builder14stable-default/2024-01-25_13h47m36s/logs/fastnetmon-1.2.6.log
Comment 17 Babak Farrokhi freebsd_committer freebsd_triage 2024-01-25 16:03:55 UTC
LGTM. I will test and commit.
Comment 18 Daniel Engberg freebsd_committer freebsd_triage 2024-01-25 19:51:34 UTC
Created attachment 247958 [details]
Patch for fastnetmon

Improvements on Marek's patch

* PORTVERSION --> DISTVERSION (and order of variables)
  https://docs.freebsd.org/en/books/porters-handbook/book/#makefile-master_sites-github
* Drop USE_CXXSTD (not needed)
  https://github.com/pavel-odintsov/fastnetmon/blob/v1.2.6/src/CMakeLists.txt#L66
* Drop devel/json-c in LIB_DEPENDS (bogus dependency)
* Use WRKSRC_SUBDIR
* Drop -DBOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED
* Remove LLVM version requirements, not needed
* Use CMAKE helpers
* Rearrange Makefile for better readability
* Disable unsupported -W switches making the build a lot less noisy
* Don't add bogus include paths

Poudriere testport ok on 13.2 and 14.0 (amd64)

NOT runtime tested

This port should probably also use USES= ncurses ?
Comment 19 Daniel Engberg freebsd_committer freebsd_triage 2024-01-25 20:48:57 UTC
I forgot to add, fixes location of manpages
Comment 20 Marek Zarychta 2024-01-26 10:33:41 UTC
(In reply to Daniel Engberg from comment #18)

Thank you for polishing this port and updating canproto in bug 276617 which made the building process a lot easier!
Comment 21 Marek Zarychta 2024-01-29 09:07:08 UTC
(In reply to Daniel Engberg from comment #18)
Works fine in production for a few days.
Comment 22 Pavel Odintsov 2024-02-09 11:23:55 UTC
Hello!

Thank you very much for doing such great progress and thank you for your effort in upgrading FastNetMon port.

Looking forward to see it merged to make announcement to community.
Comment 23 Marek Zarychta 2024-02-10 18:05:03 UTC
I was able to test FastNetMon running in netmap mode on FreeBSD 14.0-STABLE stable/14-n266656-da9cc2e97be3 and I have to confirm that it works great. We can get rid of the spurious patch
files/patch-src_netmap__plugin_netmap__collector.cpp though this patch is rather harmless.
Comment 24 commit-hook freebsd_committer freebsd_triage 2024-02-18 16:23:03 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=77c0579bf6608c0691170fcf1e86e620b38a150f

commit 77c0579bf6608c0691170fcf1e86e620b38a150f
Author:     Daniel Engberg <diizzy@FreeBSD.org>
AuthorDate: 2024-02-18 09:22:53 +0000
Commit:     Daniel Engberg <diizzy@FreeBSD.org>
CommitDate: 2024-02-18 16:16:12 +0000

    net-mgmt/fastnetmon: Update to 1.2.6

    * Switch from PORTVERSION to DISTVERSION
    * Remove USE_CXXSTD (no longer needed)
    * Drop devel/json-c in LIB_DEPENDS (not used)
    * Use WRKSRC_SUBDIR
    * Drop -DBOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED switch
    * Remove LLVM version requirements (no longer needed)
    * Use CMAKE helpers
    * Rearrange Makefile for better readability
    * Disable unsupported -W switches making the build a lot less noisy
    * Remove bogus include paths

    Based on patch submitted by Marek Zarychta

    Changelog:
    https://github.com/pavel-odintsov/fastnetmon/releases/tag/v1.2.6

    PR:             276516
    Reported by:    Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>
    Reviewed by:    farrokhi (maintainer, previous version)
    Tested by:      Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>
    Approved by:    portmgr (maintainer timeout, 2+ weeks)

 net-mgmt/fastnetmon/Makefile                       | 66 +++++++++-------------
 net-mgmt/fastnetmon/distinfo                       |  8 ++-
 net-mgmt/fastnetmon/files/fastnetmon.in            |  2 +-
 .../fastnetmon/files/patch-CMakeLists.txt (new)    | 30 ++++++++++
 net-mgmt/fastnetmon/files/patch-src_fastnetmon.cpp |  4 +-
 .../fastnetmon/files/patch-src_man_fastnetmon.8    |  4 +-
 .../patch-src_netmap__plugin_netmap__collector.cpp |  4 +-
 net-mgmt/fastnetmon/pkg-plist                      | 10 ++--
 8 files changed, 75 insertions(+), 53 deletions(-)