mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-09-02 15:02:51 +08:00
Do not insert the management VLAN tag into a CPU-tagged frame
tcpip_output() splices the 802.1Q tag in right behind the source address, which is exactly where the ASIC expects the RTL tag of a frame the CPU addressed to a port itself. The tag then ends up behind the VLAN tag, the ASIC does not find it, and the frame goes out flooded with the 0x8899 header still on it instead of being sent to the port that was asked for. Whether a frame is CPU-tagged is a property of the frame, so decide it here from the ether-type rather than having every sender of such a frame clear management_vlan around its tcpip_output() call. stp_cnf_send() did that, and no longer has to.
This commit is contained in:
@@ -28,7 +28,6 @@ __xdata uint8_t stp_fdb_i;
|
||||
extern __xdata struct uip_eth_addr uip_ethaddr;
|
||||
|
||||
extern __xdata uint8_t uip_buf[UIP_CONF_BUFFER_SIZE + 2];
|
||||
extern __xdata uint16_t management_vlan; /* owned by rtlplayground.c; suppressed per-frame for BPDUs */
|
||||
|
||||
extern __xdata uint8_t cmd_buffer[CMD_BUF_SIZE];
|
||||
extern __xdata uint8_t cmd_words_len;
|
||||
@@ -408,20 +407,8 @@ void stp_cnf_send(uint8_t port) __reentrant
|
||||
STP_O->fwd_delay = stp_fwddelay_s;
|
||||
STP_O->version1_length = 0; /* RST BPDU: no version-1 information */
|
||||
|
||||
/* BPDUs are link-local and must egress untagged: with a management VLAN
|
||||
* set, tcpip_output() splices an 802.1Q tag after the SA, shifting the
|
||||
* in-frame rtl_tag out of the position the ASIC parses - the CPU tag then
|
||||
* leaks onto the wire as 0x8899 and the BPDU is flooded, not sent.
|
||||
* Hardware-verified fix, same as lacp_send(). */
|
||||
{
|
||||
uint16_t saved_mgmt_vlan = management_vlan;
|
||||
management_vlan = 0;
|
||||
/* A legacy Config BPDU body is 35 bytes - without the trailing
|
||||
* version-1 length byte that only the RST BPDU (36 bytes) carries. */
|
||||
uip_len = stp_rstp ? sizeof(struct stp_pkt) : sizeof(struct stp_pkt) - 1;
|
||||
tcpip_output();
|
||||
management_vlan = saved_mgmt_vlan;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user