Skip to content

Conversation

IssamHamdi
Copy link
Contributor

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).

@github-actions github-actions bot added the target/realtek pull request/issue for realtek target label Aug 18, 2025
@ecsv

This comment was marked as resolved.

@howels
Copy link

howels commented Aug 18, 2025

@howels you most likely want to apply this too when doing your LLDP tests with #19571

In conjunction with the LLDP portions of #19571 this now fixes both the sent and received LLDP traffic, thanks!

Copy link
Contributor

@plappermaul plappermaul left a comment

Choose a reason for hiding this comment

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

Nice find

@@ -153,7 +153,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] = 0x0100; /* Set FWD_TYPE to PHYSICAL (1) */
Copy link
Contributor

Choose a reason for hiding this comment

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

I fear that this will not play well with trunks (if we ever get them in place). Please check if logical (2) works the same for now.

This comment was marked as resolved.

This comment was marked as resolved.

Copy link
Contributor

Choose a reason for hiding this comment

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

Btw. Sharadanand said that he has bonding + trunking working (afaik also with this patch applied). This has to be confirmed and double checked

This might be the case. The 1/2 difference I'm after is this:
image

Copy link

Choose a reason for hiding this comment

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

I'm not used to seeing LLDP undergo load-balancing when ports are trunked - doesn't LLDP still relate to the underlying physical port even if a trunk is created - that is the "link layer" in LLDP. LLDP has limited usefulness when troubleshooting LAG and MLAG installations if all you see if the trunk ID and not the underlying interface that is connected from the peer switch.
But maybe I am misunderstanding this, I am still going to build the change and test.

Copy link

Choose a reason for hiding this comment

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

Still working with 0x0200 instead of 0x0100 for cpu_tag[1] in these functions (testing on rtl930x device).

Copy link
Contributor

Choose a reason for hiding this comment

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

As tiny as this change is ... The CPU port handling is tricky (e.g. https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=a22d359fa56fe06ebd74f87eccacf56b3752da58). So we should be sure if we

  • can go for a one-config-fits-all-packets solution or
  • if we must create headers per packet individually

Tests will tell.

@@ -168,7 +169,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] = 0x0100; /* Set FWD_TYPE to PHYSICAL (1) */
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

@IssamHamdi IssamHamdi force-pushed the rtl93xx-port-selection-tx branch from 02a1f32 to 4c91e32 Compare August 18, 2025 17:19
@plappermaul
Copy link
Contributor

Final questions before approving this:

  • The change suggest, that we know to which port we send data. Before we used "normal routing" tables, What is the impact on normal traffic?
  • ecsv's comment was to much for me. Is the setting aligned with RTL83xx now?

@ecsv

This comment was marked as resolved.

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@simonwunderlich.de>
Link: openwrt#19802
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
@hauke hauke force-pushed the rtl93xx-port-selection-tx branch from 4c91e32 to 8c42e63 Compare August 23, 2025 22:01
@openwrt-bot openwrt-bot merged commit 8c42e63 into openwrt:main Aug 23, 2025
2 checks passed
igor-dyatlov pushed a commit to igor-dyatlov/openwrt that referenced this pull request Aug 26, 2025
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@simonwunderlich.de>
Link: openwrt#19802
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Vladdrako pushed a commit to Vladdrako/openwrt that referenced this pull request Aug 27, 2025
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@simonwunderlich.de>
Link: openwrt#19802
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Lienol pushed a commit to Lienol/openwrt that referenced this pull request Aug 27, 2025
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@simonwunderlich.de>
Link: openwrt/openwrt#19802
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
target/realtek pull request/issue for realtek target
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants