Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net-snmp: refactor Makefile for optional variant with openssl and logging #25444

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Chris1189
Copy link

@Chris1189 Chris1189 commented Nov 25, 2024

Maintainer: @stintel
Compile tested: x86_64, Openwrt 24.10
Run tested: x86_64, Openwrt 24.10

Description:
Openssl is needed to implement encryption and authentification for SNMPv3.
As discussed in PR #25178 , I added a variant for net-snmp that compiles libnetsnmp
with libopenssl (for SNMPv3). The default compilation is with the former variant.

The features for SNMPv3 are added to snmpd.init file and the possibility
to log messages to syslog or a log file..

@Chris1189 Chris1189 marked this pull request as draft November 25, 2024 10:23
@Chris1189 Chris1189 force-pushed the pr/net-snmp branch 2 times, most recently from 063324f to 91c1e21 Compare November 25, 2024 10:45
@Chris1189 Chris1189 marked this pull request as ready for review November 25, 2024 10:46
@Chris1189 Chris1189 marked this pull request as draft November 25, 2024 11:02
@Chris1189 Chris1189 marked this pull request as ready for review November 28, 2024 07:51
@Chris1189 Chris1189 force-pushed the pr/net-snmp branch 2 times, most recently from 8bda243 to 9be48e9 Compare November 28, 2024 08:15
@Chris1189
Copy link
Author

@stintel : I updated the Makefile in a way that it is possible to compile snmp with or without openssl.
It also works for my purposes. Please review it when possible. Thank you!

@Chris1189 Chris1189 force-pushed the pr/net-snmp branch 4 times, most recently from d921a24 to da99ac5 Compare December 2, 2024 14:19
@Chris1189
Copy link
Author

Chris1189 commented Dec 3, 2024

@stintel : Did you find time to look into the changes?
(One check failed because i updated the comment to change to Openwrt 24.10)

@stintel
Copy link
Member

stintel commented Dec 3, 2024

@stintel : Did you find time to look into the changes?

Sorry, a bit busy with life. Might be a while. Without reviewing the code the following question comes to mind: can the user still do opkg install libnetsnmp?

@Chris1189
Copy link
Author

Chris1189 commented Dec 3, 2024

I understand that and I didn't have in mind to pressure you.
I checked and saw that it was not possible.
So i added PROVIDES:=libnetsnmpto both variants and now it is possible

@Chris1189
Copy link
Author

Hello @stintel ,
I think you might still be busy. May I ask you if you could suggest a different maintainer, who may see into the PR?
Only to get things going.

Copy link
Member

@stintel stintel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also please add example sections in net/net-snmp/files/snmpd.conf for both SNMPv3 and logging.

@stintel
Copy link
Member

stintel commented Feb 14, 2025

Build test on qoriq shows a bunch of conflicts. I ran make oldconfig and said yes to the -ssl variants. You should probably remove the old variants (libnetsnmp, snmp-utils, snmpd) and only keep the -ssl and -nossl variants. Have both variants provide the old package name. And make sure you cannot enable both the -ssl and -nossl variants at the same time.

Collected errors:
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmp.so.40
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmp.so.40.2.1
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmpagent.so.40
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmpagent.so.40.2.1
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmphelpers.so.40
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmphelpers.so.40.2.1
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmpmibs.so.40
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmpmibs.so.40.2.1
        But that file is already provided by package  * libnetsnmp
 * opkg_install_cmd: Cannot install package libnetsnmp-ssl.
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmp.so.40
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmp.so.40.2.1
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmpagent.so.40
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmpagent.so.40.2.1
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmphelpers.so.40
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmphelpers.so.40.2.1
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmpmibs.so.40
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmpmibs.so.40.2.1
        But that file is already provided by package  * libnetsnmp
 * opkg_install_cmd: Cannot install package snmp-utils-ssl.
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmp.so.40
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmp.so.40.2.1
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmpagent.so.40
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmpagent.so.40.2.1
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmphelpers.so.40
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmphelpers.so.40.2.1
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmpmibs.so.40
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmpmibs.so.40.2.1
        But that file is already provided by package  * libnetsnmp
 * opkg_install_cmd: Cannot install package snmpd-ssl.
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmp.so.40
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmp.so.40.2.1
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmpagent.so.40
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmpagent.so.40.2.1
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmphelpers.so.40
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmphelpers.so.40.2.1
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmpmibs.so.40
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmpmibs.so.40.2.1
        But that file is already provided by package  * libnetsnmp
 * opkg_install_cmd: Cannot install package snmptrapd-ssl.
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmp.so.40
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmp.so.40.2.1
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmpagent.so.40
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmpagent.so.40.2.1
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmphelpers.so.40
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmphelpers.so.40.2.1
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmpmibs.so.40
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmpmibs.so.40.2.1
        But that file is already provided by package  * libnetsnmp
 * opkg_install_cmd: Cannot install package libnetsnmp-ssl.
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmp.so.40
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmp.so.40.2.1
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmpagent.so.40
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmpagent.so.40.2.1
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmphelpers.so.40
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmphelpers.so.40.2.1
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmpmibs.so.40
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmpmibs.so.40.2.1
        But that file is already provided by package  * libnetsnmp
 * opkg_install_cmd: Cannot install package libnetsnmp-ssl.
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmp.so.40
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmp.so.40.2.1
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmpagent.so.40
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmpagent.so.40.2.1
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmphelpers.so.40
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmphelpers.so.40.2.1
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmpmibs.so.40
        But that file is already provided by package  * libnetsnmp
 * check_data_file_clashes: Package libnetsnmp-ssl wants to install file /home/stijn/Development/OpenWrt/openwrt/build_dir/target-powerpc64_e5500_musl/root-qoriq/usr/lib/libnetsnmpmibs.so.40.2.1
        But that file is already provided by package  * libnetsnmp

@Chris1189
Copy link
Author

Chris1189 commented Feb 17, 2025

Thank you for your review!
I resolved your requested changes and now it should be only possible to build one package of the two.
The old packages are now virtually provided by them.

EDIT: Also added v3 and logging options to snmpd.conf.

@Chris1189 Chris1189 force-pushed the pr/net-snmp branch 5 times, most recently from 6561ab5 to 95be69b Compare February 17, 2025 07:51
@Chris1189
Copy link
Author

@stintel : Are these changes what you had in mind?

@stintel
Copy link
Member

stintel commented Feb 22, 2025

The config examples should be in the commit that adds that specific config option. Also, I noticed you added meta packages net-snmp-ssl and net-snmp-nossl, these should go in a separate commit also. And finally, I'm now getting these errors during make oldconfig:

tmp/.config-package.in:56157:error: recursive dependency detected!
tmp/.config-package.in:56157:   symbol PACKAGE_libnetsnmp-ssl depends on PACKAGE_libnetsnmp-nossl
tmp/.config-package.in:56139:   symbol PACKAGE_libnetsnmp-nossl depends on PACKAGE_libnetsnmp-ssl
For a resolution refer to Documentation/kbuild/kconfig-language.rst
subsection "Kconfig recursive dependency limitations"

tmp/.config-package.in:113995:error: recursive dependency detected!
tmp/.config-package.in:113995:  symbol PACKAGE_net-snmp-nossl depends on PACKAGE_net-snmp-ssl
tmp/.config-package.in:114009:  symbol PACKAGE_net-snmp-ssl depends on PACKAGE_net-snmp-nossl
For a resolution refer to Documentation/kbuild/kconfig-language.rst
subsection "Kconfig recursive dependency limitations"

tmp/.config-package.in:115760:error: recursive dependency detected!
tmp/.config-package.in:115760:  symbol PACKAGE_snmp-utils-nossl depends on PACKAGE_snmp-utils-ssl
tmp/.config-package.in:115770:  symbol PACKAGE_snmp-utils-ssl depends on PACKAGE_snmp-utils-nossl
For a resolution refer to Documentation/kbuild/kconfig-language.rst
subsection "Kconfig recursive dependency limitations"

tmp/.config-package.in:115780:error: recursive dependency detected!
tmp/.config-package.in:115780:  symbol PACKAGE_snmpd-nossl depends on PACKAGE_snmpd-ssl
tmp/.config-package.in:115796:  symbol PACKAGE_snmpd-ssl depends on PACKAGE_snmpd-nossl
For a resolution refer to Documentation/kbuild/kconfig-language.rst
subsection "Kconfig recursive dependency limitations"

tmp/.config-package.in:115812:error: recursive dependency detected!
tmp/.config-package.in:115812:  symbol PACKAGE_snmptrapd-nossl depends on PACKAGE_snmptrapd-ssl
tmp/.config-package.in:115822:  symbol PACKAGE_snmptrapd-ssl depends on PACKAGE_snmptrapd-nossl
For a resolution refer to Documentation/kbuild/kconfig-language.rst
subsection "Kconfig recursive dependency limitations"

Following commits will introduce a new variant ssl that
provides ssl encryption possibility needed by SNMP V3.
So this commit tags the basic variant nossl and encapsulates
needed packages in the same logic.

Signed-off-by: Christian Korber <[email protected]>
Christian Korber added 2 commits February 24, 2025 12:40
This commit introduces the new ssl variant of net-snmp.
It also integrates a differentiation between the now two
variants and compiles them conditionally.

Signed-off-by: Christian Korber <[email protected]>
In this commit, the init script is adapted to enable SNMP V3 and
a default config is provided.

Signed-off-by: Christian Korber <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants