WeHack BBS
螃蟹rtl8372 SFP+x2 + 2.5G x4交换机强刷固件的失败尝试 - 可打印的版本

+- WeHack BBS (https://bbs.wehack.space)
+-- 版块: 计算机技术 (https://bbs.wehack.space/forum-5.html)
+--- 版块: 硬件设备讨论区 (https://bbs.wehack.space/forum-15.html)
+--- 主题: 螃蟹rtl8372 SFP+x2 + 2.5G x4交换机强刷固件的失败尝试 (/thread-383.html)



螃蟹rtl8372 SFP+x2 + 2.5G x4交换机强刷固件的失败尝试 - shangyatsen - 04-27-2024

近一年不少小厂出了这类2.5G交换机,管理型价格也打到200块上下。
去年买了一个海思视讯的简单网管型,当时还给厂家测出最右侧SFP+接上后web无法访问的bug,最后拆开焊下一个电阻解决 Big Grin,属于免费QA了。
   
   
今年又买了个诺可信的非网管型,叠加优惠之后130块。这个交换机的做工用料明显差些,但电源接口和网络接口同向,能节省一些空间。
   
   
非网管型spi flash为1MB,网管型使用了2MB。非网管型更换为2M后刷入网管机器的固件,发现会循环重启,uart输出如下
代码:
===============  Init PSE Starts for Hasivo===============
===============  Init PSE Ends for Hasivo===================
===============  Begin to detect the pse chips for Hasivo==
===============  ChipID:0 POE_MSG_GET_DEV_ALIVE pse = 0======
===============  ChipID:0 POE_MSG_GET_PORT_ENABLE pse = 0======
===============  Detection result is 0  ===============



===========================Config Area pre-check Starts.=====================.
Pre-Check the config size structure is equal or not.
(sizeof(configCache)) a8e.
(FLSH_ADDR_END-FLSH_CONFIG_ADDR_START) a8e.
(FLSH_CONFIG_ADDR_START) 1fe000.
(FLSH_ADDR_END) 1fea8e.
It seems no risk!..................
==============================Config Area pre-check ends.===================.



SalFlshCopyFlshToCache()
sal_sys_config_restore()
Restore dhcp state is: 0

Restore ip is: 192.168.0.1

...OK
sal_mirror_config_restore()...OK
sal_qos_config_restore()...OK
sal_vlan_config_restore()...OK
sal_rate_config_restore()...OK
sal_trunk_config_restore()...OK
sal_l2_config_restore()...OK
sal_loop_config_restore()...OK
sal_eee_config_restore()...OK
sal_stp_config_restore()...OK
sal_igmp_config_restore()...OK
sal_sntp_config_restore()...OK
sal_dhcp_snooping_config_restore()...OK
sal_port_config_restore()...OK
sal_poe_config_restore()...OK



#############According to the flash setting to set the WEB/DUMB mode

#############Read the web/dumb mode.....!!!###

#############web_dumb_cfg.vld_flag=-1, web_dumb_cfg.mode=-1
#############Begin to set the web mode


POEDOG ON

// 到这里就重启了

后面其他大佬指点说固件绑定了flash id,校验失败就会重启。将两个交换机的flash互换之后果然没有直接重启了,但因为电路设计不同,固件完成初始化后会打印reset按钮按下3s,然后重启。
经过简单测量,发现诺可信的上联vlan开关连接到了flash旁边的一个20pin单片机上 Huh,看上去没有利用rtl8372的8051,感觉有点多此一举。拆掉这个20pin后仍然会3s重启。

rtl交换机芯片内置了8051单片机,能够访问asic的所有寄存器,也有内部nic连接,网管型固件的web服务就是跑在这个8051上。尝试使用ghidra和at51逆向固件,目前还没有找到校验flash id的代码位置。固件使用了code banking,感觉逆向十分困难。 Smile
附件是海思视讯的flash dump,固件版本为v1.9。

交换机内置8051核的一些描述,来自rtl8367n
   


RE: 螃蟹rtl8372 SFP+x2 + 2.5G x4交换机强刷固件的失败尝试 - libc0607 - 05-07-2024

楼主可否顺便提供一下 提取附件固件的 Flash 的 UID?有点好奇