Skip to content

Commit

Permalink
bookworm container upgrade for lldp, net-snmp (#18150)
Browse files Browse the repository at this point in the history
* bookworm container upgrade for lldp, net-snmp
* Add patch 0001-SNMP-Stop-spamming-logs-with-statfs-permission-denie.patch

Co-authored-by: Kalimuthu Velappan <[email protected]>
  • Loading branch information
mohan-selvaraj and Kalimuthu-Velappan authored Apr 22, 2024
1 parent e95994f commit df499b6
Show file tree
Hide file tree
Showing 12 changed files with 153 additions and 23 deletions.
2 changes: 1 addition & 1 deletion dockers/docker-lldp/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %}
FROM docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}}
FROM docker-config-engine-bookworm-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}}

ARG docker_container_name
ARG image_version
Expand Down
2 changes: 1 addition & 1 deletion dockers/docker-snmp/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python3_wheels, copy_files %}
FROM docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}}
FROM docker-config-engine-bookworm-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}}

ARG docker_container_name
ARG image_version
Expand Down
16 changes: 8 additions & 8 deletions dockers/docker-snmp/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ command=/usr/sbin/rsyslogd -n -iNONE
priority=1
autostart=false
autorestart=unexpected
stdout_logfile=syslog
stderr_logfile=syslog
stdout_syslog=true
stderr_syslog=true
dependent_startup=true

[program:start]
Expand All @@ -34,8 +34,8 @@ priority=1
autostart=true
autorestart=false
startsecs=0
stdout_logfile=syslog
stderr_logfile=syslog
stdout_syslog=true
stderr_syslog=true
dependent_startup=true
dependent_startup_wait_for=rsyslogd:running

Expand All @@ -44,8 +44,8 @@ command=/usr/sbin/snmpd -f -LS0-2d -u Debian-snmp -g Debian-snmp -I -smux,mteTri
priority=3
autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
stdout_syslog=true
stderr_syslog=true
dependent_startup=true
dependent_startup_wait_for=start:exited

Expand All @@ -54,7 +54,7 @@ command=/usr/bin/env python3 -m sonic_ax_impl
priority=4
autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
stdout_syslog=true
stderr_syslog=true
dependent_startup=true
dependent_startup_wait_for=snmpd:running
10 changes: 5 additions & 5 deletions rules/docker-lldp.mk
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ $(DOCKER_LLDP)_PATH = $(DOCKERS_PATH)/docker-lldp

$(DOCKER_LLDP)_DEPENDS += $(LLDPD) $(LIBSWSSCOMMON) $(PYTHON3_SWSSCOMMON)

$(DOCKER_LLDP)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_DEPENDS)
$(DOCKER_LLDP)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BOOKWORM)_DBG_DEPENDS)
$(DOCKER_LLDP)_DBG_DEPENDS += $(LLDPD_DBG) $(LIBSWSSCOMMON_DBG)

$(DOCKER_LLDP)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_IMAGE_PACKAGES)
$(DOCKER_LLDP)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BOOKWORM)_DBG_IMAGE_PACKAGES)

$(DOCKER_LLDP)_PYTHON_WHEELS += $(DBSYNCD_PY3)
$(DOCKER_LLDP)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BULLSEYE)
$(DOCKER_LLDP)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BOOKWORM)

$(DOCKER_LLDP)_VERSION = 1.0.0
$(DOCKER_LLDP)_PACKAGE_NAME = lldp
Expand All @@ -36,5 +36,5 @@ $(DOCKER_LLDP)_BASE_IMAGE_FILES += lldpctl:/usr/bin/lldpctl
$(DOCKER_LLDP)_BASE_IMAGE_FILES += lldpcli:/usr/bin/lldpcli
$(DOCKER_LLDP)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT)

SONIC_BULLSEYE_DOCKERS += $(DOCKER_LLDP)
SONIC_BULLSEYE_DBG_DOCKERS += $(DOCKER_LLDP_DBG)
SONIC_BOOKWORM_DOCKERS += $(DOCKER_LLDP)
SONIC_BOOKWORM_DBG_DOCKERS += $(DOCKER_LLDP_DBG)
10 changes: 5 additions & 5 deletions rules/docker-snmp.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ $(DOCKER_SNMP)_PATH = $(DOCKERS_PATH)/docker-snmp
## TODO: remove LIBPY3_DEV if we can get pip3 directly
$(DOCKER_SNMP)_DEPENDS += $(SNMP) $(SNMPD)

$(DOCKER_SNMP)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_DEPENDS)
$(DOCKER_SNMP)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BOOKWORM)_DBG_DEPENDS)
$(DOCKER_SNMP)_DBG_DEPENDS += $(SNMP_DBG) $(SNMPD_DBG) $(LIBSNMP_DBG)
$(DOCKER_SNMP)_DBG_DEPENDS += $(LIBSWSSCOMMON) $(PYTHON3_SWSSCOMMON)

$(DOCKER_SNMP)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_IMAGE_PACKAGES)
$(DOCKER_SNMP)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BOOKWORM)_DBG_IMAGE_PACKAGES)

$(DOCKER_SNMP)_PYTHON_WHEELS += $(SONIC_PY_COMMON_PY3) $(SONIC_PLATFORM_COMMON_PY3) $(ASYNCSNMP_PY3)
$(DOCKER_SNMP)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BULLSEYE)
$(DOCKER_SNMP)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BOOKWORM)

$(DOCKER_SNMP)_VERSION = 1.0.0
$(DOCKER_SNMP)_PACKAGE_NAME = snmp
Expand All @@ -34,5 +34,5 @@ $(DOCKER_SNMP)_RUN_OPT += -v /etc/timezone:/etc/timezone:ro
$(DOCKER_SNMP)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT)
$(DOCKER_SNMP)_BASE_IMAGE_FILES += monit_snmp:/etc/monit/conf.d

SONIC_BULLSEYE_DOCKERS += $(DOCKER_SNMP)
SONIC_BULLSEYE_DBG_DOCKERS += $(DOCKER_SNMP_DBG)
SONIC_BOOKWORM_DOCKERS += $(DOCKER_SNMP)
SONIC_BOOKWORM_DBG_DOCKERS += $(DOCKER_SNMP_DBG)
13 changes: 10 additions & 3 deletions rules/snmpd.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# snmpd package

ifeq ($(BLDENV),bullseye)
ifeq ($(BLDENV),bookworm)
SNMPD_VERSION = 5.9.3+dfsg
SNMPD_VERSION_FULL = $(SNMPD_VERSION)-2
else ifeq ($(BLDENV),bullseye)
SNMPD_VERSION = 5.9+dfsg
SNMPD_VERSION_FULL = $(SNMPD_VERSION)-4+deb11u1
else
Expand Down Expand Up @@ -37,15 +40,19 @@ $(eval $(call add_derived_package,$(LIBSNMP_BASE),$(SNMP_DBG)))
SNMPD_DBG = snmpd-dbgsym_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb
$(eval $(call add_derived_package,$(LIBSNMP_BASE),$(SNMPD_DBG)))

ifeq ($(BLDENV),bullseye)
ifeq ($(BLDENV),bookworm)
LIBSNMP = libsnmp40_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb
else ifeq ($(BLDENV),bullseye)
LIBSNMP = libsnmp40_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb
else
LIBSNMP = libsnmp30_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb
endif
$(LIBSNMP)_RDEPENDS += $(LIBSNMP_BASE)
$(eval $(call add_derived_package,$(LIBSNMP_BASE),$(LIBSNMP)))

ifeq ($(BLDENV),bullseye)
ifeq ($(BLDENV),bookworm)
LIBSNMP_DBG = libsnmp40-dbgsym_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb
else ifeq ($(BLDENV),bullseye)
LIBSNMP_DBG = libsnmp40-dbgsym_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb
else
LIBSNMP_DBG = libsnmp30-dbg_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
From 8bb8849524aba2124be3279a5197ad5fbfe166b2 Mon Sep 17 00:00:00 2001
From: pavel-shirshov <[email protected]>
Date: Mon, 27 Aug 2018 16:50:16 +0800
Subject: [PATCH] [SNMP] Stop spamming logs with statfs permission denied log

---
agent/mibgroup/hardware/fsys/fsys_mntctl.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/agent/mibgroup/hardware/fsys/fsys_mntctl.c b/agent/mibgroup/hardware/fsys/fsys_mntctl.c
index 782c8ed..7819fe4 100644
--- a/agent/mibgroup/hardware/fsys/fsys_mntctl.c
+++ b/agent/mibgroup/hardware/fsys/fsys_mntctl.c
@@ -167,8 +167,6 @@ netsnmp_fsys_arch_load( void )
continue;

if ( statfs( entry->path, &stat_buf ) < 0 ) {
- snprintf( tmpbuf, sizeof(tmpbuf), "Cannot statfs %s", entry->path );
- snmp_log_perror( tmpbuf );
continue;
}
entry->units = stat_buf.f_bsize;
--
2.18.0

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
From bd7d6d79217da6b5a2eb3a3ee1d409c175a61e41 Mon Sep 17 00:00:00 2001
From: Qi Luo <[email protected]>
Date: Fri, 20 Sep 2019 00:42:19 +0000
Subject: [PATCH] Enable macro DEB_BUILD_ARCH_OS in order to build ipv6 feature

---
debian/rules | 2 ++
1 file changed, 2 insertions(+)

diff --git a/debian/rules b/debian/rules
index 34d8509..496be59 100755
--- a/debian/rules
+++ b/debian/rules
@@ -4,6 +4,8 @@
export DEB_BUILD_MAINT_OPTIONS := hardening=+all
include /usr/share/dpkg/architecture.mk
include /usr/share/dpkg/buildtools.mk
+DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
+DEB_BUILD_ARCH_OS ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH_OS)

LIB_VERSION = 40

--
2.18.0

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
From 0d3e33ff197d1d15c0036b69cca5198e54781efe Mon Sep 17 00:00:00 2001
From: Bart Van Assche <[email protected]>
Date: Sun, 24 Jul 2022 16:45:05 -0700
Subject: [PATCH] agent/Makefile.in: Unbreak the --enable-minimalist build

Build the features rules in the mibgroup directory before building the
features rules in the helpers directory.

Fixes: 51128ad09507 ("agent/Makefile.in: Build the MIB module code once")
Fixes: https://github.com/net-snmp/net-snmp/issues/438
---
agent/Makefile.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/agent/Makefile.in b/agent/Makefile.in
index 047d880..44f8818 100644
--- a/agent/Makefile.in
+++ b/agent/Makefile.in
@@ -16,7 +16,7 @@ mysubdir=agent
# what to install
#
SUBDIRS=helpers
-FTSUBDIRS=helpers
+FTSUBDIRS=mibgroup helpers

INSTALLSBINPROGS= @SNMPD@
INSTALLLIBS = libnetsnmpagent.$(LIB_EXTENSION)$(LIB_VERSION)
--
2.18.0

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
diff --git a/debian/rules b/debian/rules
index 496be59..939e1a4 100755
--- a/debian/rules
+++ b/debian/rules
@@ -37,10 +37,6 @@ endif
%:
dh $@

-# The net-snmp Makefiles cannot handle parallel builds
-override_dh_auto_build:
- dh_auto_build --no-parallel
-
override_dh_auto_configure:
dh_auto_configure -- --prefix=/usr --sysconfdir=/etc --mandir=/usr/share/man \
--with-persistent-directory=/var/lib/snmp \
--
2.18.0

20 changes: 20 additions & 0 deletions src/snmpd/patch-5.9.3+dfsg/cross-compile-changes.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
diff --git a/debian/rules b/debian/rules
index 939e1a4..efd323e 100755
--- a/debian/rules
+++ b/debian/rules
@@ -7,6 +7,12 @@ include /usr/share/dpkg/buildtools.mk
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
DEB_BUILD_ARCH_OS ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH_OS)

+DEB_BUILD_MULTIARCH ?= $(shell dpkg-architecture -qDEB_BUILD_MULTIARCH)
+
+ifneq ($(DEB_BUILD_MULTIARCH),$(DEB_HOST_MULTIARCH))
+export PERL5OPT := -I/usr/lib/$(DEB_HOST_MULTIARCH)/perl/cross-config
+endif
+
LIB_VERSION = 40

MIB_MODULES = smux ucd-snmp/dlmod mibII/mta_sendmail disman/event-mib
--
2.18.0

5 changes: 5 additions & 0 deletions src/snmpd/patch-5.9.3+dfsg/series
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
0001-SNMP-Stop-spamming-logs-with-statfs-permission-denie.patch
0008-Enable-macro-DEB_BUILD_ARCH_OS-in-order-to-build-ipv.patch
0012-agent-Makefile.in-Unbreak-the-enable-minimalist-buil.patch
0013-enable-parallel-build-for-net-snmp.patch
cross-compile-changes.patch

0 comments on commit df499b6

Please sign in to comment.