[openwrt/openwrt] realtek: rtl93xx: fix incorrect destination port selection

LEDE Commits lede-commits at lists.infradead.org
Sat Aug 23 15:02:09 PDT 2025


hauke pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/8c42e63a69f61ee9c295c05f00f6c1fba7b85a47

commit 8c42e63a69f61ee9c295c05f00f6c1fba7b85a47
Author: Issam Hamdi <ih at simonwunderlich.de>
AuthorDate: Fri Mar 28 10:39:44 2025 +0100

    realtek: rtl93xx: fix incorrect destination port selection
    
    When testing LLDP and STP, we observed that locally generated multicast
    packets (e.g. LLDP, STP) were not restricted to the designated output
    port(s). For example, when transmitting on `lan1`, the same packet was also
    forwarded to other ports such as `lan2`.
    
    Steps to reproduce:
    
    1. Configure lldpd to use `lan1` in UCI and restart the service
    2. Connect devices to `lan1` and `lan2`
    3. Observe that the device on `lan2` still receives LLDP packets
    
    The issue was caused by an incorrect `FWD_TYPE` setting in the TX CPU TAG,
    which failed to enforce the selected egress port(s).
    
    Fix this by updating the TX CPU TAG to set `FWD_TYPE` correctly, ensuring
    that locally generated packets are transmitted only on the intended
    port(s).
    
    Signed-off-by: Issam Hamdi <ih at simonwunderlich.de>
    Link: https://github.com/openwrt/openwrt/pull/19802
    Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 target/linux/realtek/files-6.12/drivers/net/ethernet/rtl838x_eth.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/target/linux/realtek/files-6.12/drivers/net/ethernet/rtl838x_eth.c b/target/linux/realtek/files-6.12/drivers/net/ethernet/rtl838x_eth.c
index ddfdabacb6..10e4c2d035 100644
--- a/target/linux/realtek/files-6.12/drivers/net/ethernet/rtl838x_eth.c
+++ b/target/linux/realtek/files-6.12/drivers/net/ethernet/rtl838x_eth.c
@@ -156,7 +156,8 @@ static void rtl839x_create_tx_header(struct p_hdr *h, unsigned int dest_port, in
 static void rtl930x_create_tx_header(struct p_hdr *h, unsigned int dest_port, int prio)
 {
 	h->cpu_tag[0] = 0x8000;  /* CPU tag marker */
-	h->cpu_tag[1] = h->cpu_tag[2] = 0;
+	h->cpu_tag[1] = 0x0200; /* Set FWD_TYPE to LOGICAL (2) */
+	h->cpu_tag[2] = 0;
 	h->cpu_tag[3] = 0;
 	h->cpu_tag[4] = 0;
 	h->cpu_tag[5] = 0;
@@ -171,7 +172,8 @@ static void rtl930x_create_tx_header(struct p_hdr *h, unsigned int dest_port, in
 static void rtl931x_create_tx_header(struct p_hdr *h, unsigned int dest_port, int prio)
 {
 	h->cpu_tag[0] = 0x8000;  /* CPU tag marker */
-	h->cpu_tag[1] = h->cpu_tag[2] = 0;
+	h->cpu_tag[1] = 0x0200; /* Set FWD_TYPE to LOGICAL (2) */
+	h->cpu_tag[2] = 0;
 	h->cpu_tag[3] = 0;
 	h->cpu_tag[4] = h->cpu_tag[5] = h->cpu_tag[6] = h->cpu_tag[7] = 0;
 	if (dest_port >= 32) {




More information about the lede-commits mailing list