From ca2dffa22b3bff6447645adee4bfb35657a5ac75 Mon Sep 17 00:00:00 2001 From: Ram Hegde Date: Thu, 16 Jul 2026 13:25:38 +0530 Subject: [PATCH] STP: Fix: Build and docker updates to bring up the STP service Did the following changes for docker-stp * Updated the apt-get path to install nftables instead of ebtables since the functionality needed from ebtables in STP docker is not supported anymore * Updated the supervisord.conf to the current format. Did the following build changes * Updated init_cfg.json.j2 to disable STP feature on start when the build includes this feature * Updated stp.service.j2 to use config-setup.service instead of currently unsupported updategraph.service * Added entries for STP in copp_cfg.j2 to punt the packet to control plane. Signed-off-by: Ram Hegde --- dockers/docker-stp/Dockerfile.j2 | 4 ++-- dockers/docker-stp/supervisord.conf | 24 ++++++++++++++++-------- files/build_templates/init_cfg.json.j2 | 1 + files/build_templates/stp.service.j2 | 4 ++-- files/image_config/copp/copp_cfg.j2 | 4 ++++ 5 files changed, 25 insertions(+), 12 deletions(-) diff --git a/dockers/docker-stp/Dockerfile.j2 b/dockers/docker-stp/Dockerfile.j2 index c8e6254bf2c..e3b3b297423 100644 --- a/dockers/docker-stp/Dockerfile.j2 +++ b/dockers/docker-stp/Dockerfile.j2 @@ -15,8 +15,8 @@ RUN apt-get update && \ libdaemon0 \ libjansson4 \ libpython3.11 \ - libjemalloc2 \ - ebtables + libjemalloc2 \ + nftables {% if docker_stp_debs.strip() -%} # Copy locally-built Debian package dependencies diff --git a/dockers/docker-stp/supervisord.conf b/dockers/docker-stp/supervisord.conf index 3320c11b4f4..f43e1cafb1d 100644 --- a/dockers/docker-stp/supervisord.conf +++ b/dockers/docker-stp/supervisord.conf @@ -8,29 +8,37 @@ command=/usr/bin/start.sh priority=1 autostart=true autorestart=false -stdout_logfile=syslog -stderr_logfile=syslog +stdout_logfile=NONE +stdout_syslog=true +stderr_logfile=NONE +stderr_syslog=true [program:rsyslogd] command=/usr/sbin/rsyslogd -n priority=2 autostart=false autorestart=false -stdout_logfile=syslog -stderr_logfile=syslog +stdout_logfile=NONE +stdout_syslog=true +stderr_logfile=NONE +stderr_syslog=true [program:stpd] command=/usr/bin/stpd priority=3 autostart=false autorestart=false -stdout_logfile=syslog -stderr_logfile=syslog +stdout_logfile=NONE +stdout_syslog=true +stderr_logfile=NONE +stderr_syslog=true [program:stpmgrd] command=/usr/bin/stpmgrd priority=3 autostart=false autorestart=false -stdout_logfile=syslog -stderr_logfile=syslog +stdout_logfile=NONE +stdout_syslog=true +stderr_logfile=NONE +stderr_syslog=true diff --git a/files/build_templates/init_cfg.json.j2 b/files/build_templates/init_cfg.json.j2 index b804d930280..b6348bbbed6 100644 --- a/files/build_templates/init_cfg.json.j2 +++ b/files/build_templates/init_cfg.json.j2 @@ -91,6 +91,7 @@ {%- if include_dhcp_server == "y" %}{% do features.append(("dhcp_server", "disabled", false, "enabled")) %}{% endif %} {%- if sonic_asic_platform == "vs" %}{% do features.append(("gbsyncd", "enabled", false, "enabled")) %}{% endif %} {%- if include_iccpd == "y" %}{% do features.append(("iccpd", "disabled", false, "enabled")) %}{% endif %} +{%- if include_stp == "y" %}{% do features.append(("stp", "disabled", false, "enabled")) %}{% endif %} {%- if include_mgmt_framework == "y" %}{% do features.append(("mgmt-framework", "enabled", true, "enabled")) %}{% endif %} {%- if include_mux == "y" %}{% do features.append(("mux", "{% if 'subtype' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['subtype'] == 'DualToR' %}enabled{% else %}always_disabled{% endif %}", false, "enabled")) %}{% endif %} {%- if include_nat == "y" %}{% do features.append(("nat", "disabled", false, "enabled")) %}{% endif %} diff --git a/files/build_templates/stp.service.j2 b/files/build_templates/stp.service.j2 index 3cd5ac23d64..1bb586be26d 100644 --- a/files/build_templates/stp.service.j2 +++ b/files/build_templates/stp.service.j2 @@ -1,7 +1,7 @@ [Unit] Description=STP container -Requires=updategraph.service swss.service -After=updategraph.service swss.service syncd.service +Requires=config-setup.service swss.service +After=config-setup.service swss.service syncd.service Before=ntp-config.service BindsTo=sonic.target After=sonic.target diff --git a/files/image_config/copp/copp_cfg.j2 b/files/image_config/copp/copp_cfg.j2 index fc2002cffd3..27bc90bc9a1 100755 --- a/files/image_config/copp/copp_cfg.j2 +++ b/files/image_config/copp/copp_cfg.j2 @@ -106,6 +106,10 @@ "trap_ids": "lldp", "trap_group": "queue4_group3" }, + "stp": { + "trap_ids": "stp,pvrst", + "trap_group": "queue4_group3" + }, "dhcp_relay": { "trap_ids": "dhcp,dhcpv6", "trap_group": "queue4_group3"