Introduction
A while back I bought an enterprise switch built on the Centec CTC7132 platform. It has 48 2.5Gbe copper ports, 4 SFP+ optical ports and two 40G QSFP ports. I also bought two 2.5Gbe SFP GPON ONT sticks. A hard requirement for these sticks is that the port speed must be locked to 2.5Gbe / 1Gbe, otherwise they won’t work. When I tried to change the speed in the WebUI, it told me to use the group-speed command. But the CLI’s group-speed has no way to set an interface to 2.5Gbe, so I dug deeper.
The CTC7132 Platform
The CTC7132 (TsingMa) is Centec’s sixth-generation core switching chip, aimed at cloud and edge computing. It integrates a dual-core ARM A53, supports port types such as QSGMII and USXGMII, and covers everything from 100M to 100G. The chip also integrates X-Engine™, which includes the OAM/BFD Engine, Telemetry Engine, Security Engine and Wireless Engine, delivering line-rate enhanced features and higher integration for multi-service edge access.
- The OAM/BFD Engine provides high-precision multi-entry OAM and BFD sessions with RFC2544 and TWAMP support, enabling IP RAN access solutions.
- The Telemetry Engine’s NetFlow support gives per-session service and packet-loss statistics plus min/max latency jitter analysis, feeding service and traffic optimisation.
- The Wireless Engine provides line-rate CAPWAP encapsulation/decapsulation and reassembly, supporting 1G/2.5G/5G multi-rate convergence and wired-wireless convergence.
As Centec’s sixth-generation chip the CTC7132 inherits a rich feature set including L2, L3, MPLS, VXLAN, MPLS SR and OAM/APS, with highlights around visibility, programmability, security and traffic control, and high-precision timing. It supports 100M/1G/2.5G/5G/10G/25G/40G/50G/100G port speeds. Its SerDes covers a wide range of port protocols: SGMII/QSGMII/USXGMII/XFI/SFI/XAUI/CAUI4/10G-KR/40G-KR4/100G-KR4/25G-KR/50G-KR2.
Quoted from https://www.centec.com/silicon/Ethernet-Switch-Silicon/CTC7132
In short, the silicon itself supports 2.5Gbe.
Goal
Since the limitation is very likely not on the CPU side, the research focuses on software: the low-level SDK and the CLI on top. Beyond that, I also wanted to understand why the vendor forces the four SFP+ ports into one group with a shared speed, and why 2.5Gbe can’t be selected.
Before You Read
This article assumes a working knowledge of Linux, Linux programming, reverse engineering and computer networking. Without it you may find it hard going; an AI can help you follow along.
Let’s Start
1. Firmware Analysis
Unpack the firmware with binwalk to get the full rootfs. Analysing it gives the following
| Item | Value |
|---|---|
| Kernel version | 4.9.62-tsingma (vendor LOCALVERSION) |
| Architecture | AArch64 (ARM64), SMP |
| Toolchain | Linaro GCC 6.3.1 (2017.02) |
| Build time | 2024-11-18 CST |
| Platform | Centec, CLDK v20.01 |
Our goal is to change the port speed to 2.5Gbe, so we need group-speed to accept 2.5Gbe. That makes group-speed the starting point. Search the whole tree for the string to see which binaries contain it.
nanami114@NanamiWork-PC:~/firmware/moondon_webImage_v3.0.17.20250718/_uImage_v3.0.15.7.bin.extracted/_53E8E4.extracted/cpio-root$ grep -rl --binary-files=text "group-speed" usr/ lib/ sbin/ bin/
usr/sbin/imi
usr/sbin/nsm
usr/bin/imish
lib/libimish.soMy earlier analysis established that imish and imi are user-space OEM shells that only pass command parameters down; neither implements the low-level SDK. So the binary to inspect is usr/sbin/nsm.
2. Analysing nsm
2.1 Analysing group-speed
Reverse it statically in IDA Pro and find every function referencing group-speed

group-speed string at 00b9a090 leads to sub_536744, so let’s analyse that.

sub_536744 is
Reverse it statically in IDA Pro. Find every function containing group-speed

group-speed at 00b9a090 leads to sub_536744, so let’s analyse that.

sub_536744 is
__int64 __fastcall sub_536744(__int64 a1, __int64 a2, const char **a3)
{
unsigned __int8 v6; // [xsp+33h] [xbp+33h] BYREF
int v7; // [xsp+34h] [xbp+34h] BYREF
int v8; // [xsp+38h] [xbp+38h]
char v9; // [xsp+3Fh] [xbp+3Fh]
__int64 v10; // [xsp+40h] [xbp+40h]
unsigned __int8 v11; // [xsp+4Fh] [xbp+4Fh]
v10 = *(_QWORD *)(a1 + 64);
v9 = 0;
v11 = 0;
v8 = 0;
if ( *(_WORD *)(v10 + 302) != 2 )
{
(*(void (__fastcall **)(_QWORD, const char *))(a1 + 16))(
*(_QWORD *)(a1 + 24),
"%% Can only set speed on physical interface\n");
return 1;
}
v8 = sub_50EB5C(v10, &v6, &v7);
if ( v8 )
{
(*(void (__fastcall **)(_QWORD, const char *))(a1 + 16))(*(_QWORD *)(a1 + 24), "%% Get port group id fail \n");
return 1;
}
if ( !v6 )
{
(*(void (**)(_QWORD, const char *, ...))(a1 + 16))(
*(_QWORD *)(a1 + 24),
"%% Unsupported CLI in present interface. Please refer to CLI \"speed %s\"\n",
*a3);
return 1;
}
if ( (((unsigned __int8)byte_B9B4E8 >> 7) & 1) != 0 )
{
if ( (unsigned int)sub_50F1B0(*(unsigned int *)(v10 + 80)) )
{
byte_B9B4E8 = 1;
}
else if ( (unsigned int)sub_50F184(*(unsigned int *)(v10 + 80)) )
{
byte_B9B4E8 = 2;
}
else if ( (unsigned int)sub_50F100(*(unsigned int *)(v10 + 80)) )
{
byte_B9B4E8 = 3;
}
}
sub_49ABCC(v10);
sub_49AC88(v10);
sub_49ACFC(v10);
v9 = (1 << (v6 - 1)) & byte_CAB190;
if ( !strncmp(*a3, "1000", 4u) )
{
if ( v7 && (v7 & 2) == 0 )
return sub_52C79C(a1, 4294967051LL);
if ( (unsigned int)sub_50F1B0(*(unsigned int *)(v10 + 80)) && v9 )
{
(*(void (__fastcall **)(_QWORD, const char *))(a1 + 16))(
*(_QWORD *)(a1 + 24),
"speed has already been 1G, no need to config \n");
return 20;
}
v11 = 1;
}
else if ( !strncmp(*a3, "10G", 3u) )
{
if ( v7 && (v7 & 4) == 0 )
return sub_52C79C(a1, 4294967051LL);
if ( (unsigned int)sub_50F184(*(unsigned int *)(v10 + 80)) && v9 )
{
(*(void (__fastcall **)(_QWORD, const char *))(a1 + 16))(
*(_QWORD *)(a1 + 24),
"speed has already been 10G, no need to config \n");
return 20;
}
v11 = 2;
}
else if ( !strncmp(*a3, "25G", 3u) )
{
if ( v7 && (v7 & 0x80) == 0 )
return sub_52C79C(a1, 4294967051LL);
if ( (unsigned int)sub_50F100(*(unsigned int *)(v10 + 80)) && v9 )
{
(*(void (__fastcall **)(_QWORD, const char *))(a1 + 16))(
*(_QWORD *)(a1 + 24),
"speed has already been 25G, no need to config \n");
return 20;
}
v11 = 3;
}
else if ( !strncmp(*a3, "default", 7u) )
{
if ( ((unsigned int)sub_50F1B0(*(unsigned int *)(v10 + 80)) && byte_B9B4E8 == 1
|| (unsigned int)sub_50F184(*(unsigned int *)(v10 + 80)) && byte_B9B4E8 == 2
|| (unsigned int)sub_50F100(*(unsigned int *)(v10 + 80)) && byte_B9B4E8 == 3)
&& v9 )
{
(*(void (__fastcall **)(_QWORD, const char *))(a1 + 16))(
*(_QWORD *)(a1 + 24),
"speed has already been default value, no need to config \n");
return 20;
}
v11 = byte_B9B4E8;
}
v8 = sub_510E9C(v10, v11, v6);
if ( v8 )
{
(*(void (__fastcall **)(_QWORD, const char *))(a1 + 16))(*(_QWORD *)(a1 + 24), "%% Set speed failed!\n");
return 1;
}
else
{
if ( !strncmp(*a3, "default", 7u) || v11 == (unsigned __int8)byte_B9B4E8 )
{
byte_CAB191 &= ~(unsigned __int8)(1 << (v6 - 1));
}
else
{
byte_CAB191 |= 1 << (v6 - 1);
dword_CAB194 &= ~(15 << (4 * (v6 - 1)));
dword_CAB194 |= v11 << (4 * (v6 - 1));
}
byte_CAB190 |= 1 << (v6 - 1);
return 0;
}
}It is clearly the group-speed handler, so we label it 0x536744.
The function contains several strncmp comparisons that clearly relate to speed
strncmp(*a3, "1000", 4u)
strncmp(*a3, "10G", 3u)
strncmp(*a3, "25G", 3u)
strncmp(*a3, "default", 7u)The values 1000, 10G, 25G and default map exactly onto group-speed’s four speed states
Switch(config-if)# group-speed ?
1000 Switch speed of all interface in group to 1G
10G Switch speed of all interface in group to 10G
25G Switch speed of all interface in group to 25G
default Switch speed of all interface in group to default valueWe can also see that all user input is handed to sub_510E9C, whose return value goes into v8 as the command result. So let’s dig into sub_510E9C
__int64 __fastcall sub_510E9C(__int64 a1, unsigned __int8 a2, unsigned __int8 a3)
{
if ( !a1 )
return 4294967287LL;
if ( *(_WORD *)(a1 + 302) != 2 )
return 4294967284LL;
if ( (unsigned int)sub_4FC03C(a1, a2, a3) )
return 0xFFFFFFFFLL;
return 0;
}That leads to sub_4FC03C, keep going
__int64 __fastcall sub_4FC03C(__int64 a1, unsigned __int8 a2, unsigned __int8 a3)
{
if ( *(_WORD *)(a1 + 302) == 2 )
return (unsigned int)sub_9C0DC4(*(unsigned int *)(a1 + 24), a2, a3);
else
return 128;
}That leads to sub_9C0DC4, keep going
__int64 __fastcall sub_9C0DC4(int a1, char a2, char a3)
{
int v4; // [xsp+28h] [xbp+28h] BYREF
char v5; // [xsp+2Ch] [xbp+2Ch]
char v6; // [xsp+2Dh] [xbp+2Dh]
v4 = a1;
v5 = a2;
v6 = a3;
return sub_9B4D70(929, &v4, 8, 0, 0, 0, 0);
}That leads to sub_9B4D70, keep going
__int64 __fastcall sub_9B4D70(
unsigned int a1,
const void *a2,
size_t a3,
__int64 a4,
__int64 a5,
__int64 a6,
__int64 a7)
{
int v8; // w0
_DWORD s[5]; // [xsp+58h] [xbp+58h] BYREF
int v14; // [xsp+6Ch] [xbp+6Ch]
__int64 v15; // [xsp+70h] [xbp+70h]
void *dest; // [xsp+78h] [xbp+78h]
dest = 0;
v15 = 0;
v14 = 0;
memset(s, 0, 0x10u);
if ( dword_E51FE0 )
{
if ( a1 <= 0x479 )
{
if ( !a3 || a2 )
{
if ( sock_shal >= 0 )
{
if ( qword_E4FF98 )
{
log_sys(158, 1, "hal socket not connect, send msg(%d) fail", a1);
return 0xFFFFFFFFLL;
}
else if ( a3 <= 0xFF4 )
{
if ( qword_E51FF0 && *(unsigned __int16 *)(qword_E51FF0 + 16) + a3 + 12 > 0x1000 )
sub_9B4B60();
v8 = dword_E4FF84++;
s[2] = v8;
s[1] = a3 + 12;
s[0] = a1;
v15 = sub_9B3F1C(&sock_shal, a3 + 12);
if ( v15 )
{
dest = (void *)(v15 + 18 + *(unsigned __int16 *)(v15 + 16));
memcpy(dest, s, 0xCu);
*(_WORD *)(v15 + 16) += 12;
dest = (char *)dest + 12;
memcpy(dest, a2, a3);
*(_WORD *)(v15 + 16) += a3;
if ( !dword_E51FA4 || a7 )
{
while ( qword_E51FE8 )
{
v14 = sub_9B4B60();
if ( v14 == -2 )
pal_delay(1000);
}
}
return 0;
}
else
{
log_sys(158, 1, "hal talk: no memory");
return 0xFFFFFFFFLL;
}
}
else
{
log_sys(158, 1, "hal talk: req_len is too longer");
return 0xFFFFFFFFLL;
}
}
else
{
return 0xFFFFFFFFLL;
}
}
else
{
log_sys(158, 3, "req == NULL, but req_len != 0");
return 0xFFFFFFFFLL;
}
}
else
{
log_sys(158, 3, "Msg type error, 0x%x", a1);
return 0;
}
}
else
{
log_sys(158, 1, "hal socket not init");
return 0xFFFFFFFFLL;
}
}Clearly sub_9B4D70 is the function that talks from the user CLI down to the board-level HAL.
Looking at the whole group-speed implementation, the command has no 2.5Gbe branch at all, and nothing underneath it can set 2.5Gbe either. So group-speed is a dead end for our purpose. The new direction is to work out when the speed command refuses to apply a speed and asks you to use group-speed instead.
2.2 Analysing speed
Find every function referencing speed

sub_534568 I found the error string printed when configuring speed, so that’s the function to focus on.
__int64 __fastcall sub_534568(__int64 a1, __int64 a2, const char **a3)
{
void (*v4)(__int64, const char *, ...); // x19
__int64 v5; // x20
const char *v6; // x0
void (*v7)(__int64, const char *, ...); // x19
__int64 v8; // x20
const char *v9; // x21
const char *v10; // x0
char dest[2]; // [xsp+50h] [xbp+50h] BYREF
__int64 v14; // [xsp+52h] [xbp+52h]
char v15; // [xsp+5Bh] [xbp+5Bh] BYREF
unsigned int v16; // [xsp+5Ch] [xbp+5Ch]
__int64 v17; // [xsp+60h] [xbp+60h]
__int64 v18; // [xsp+68h] [xbp+68h]
int v19; // [xsp+74h] [xbp+74h]
__int64 v20; // [xsp+78h] [xbp+78h]
unsigned int v21; // [xsp+84h] [xbp+84h]
char v22; // [xsp+8Bh] [xbp+8Bh]
unsigned int v23; // [xsp+8Ch] [xbp+8Ch]
v23 = 0;
v20 = *(_QWORD *)(a1 + 64);
v22 = 1;
v21 = 0;
if ( *(_WORD *)(v20 + 302) == 2 )
{
v15 = 0;
v19 = 0;
v19 = sub_50EB5C(v20, &v15, 0);
if ( !v19 )
{
if ( v15 )
{
*(_WORD *)dest = 0;
v14 = 0;
strcpy(dest, *a3);
(*(void (**)(_QWORD, const char *, ...))(a1 + 16))(
*(_QWORD *)(a1 + 24),
"%% Unsupported CLI in present interface. Please refer to CLI \"group-speed %s\"\n",
*a3);
return 1;
}
}
}
if ( *(int *)(v20 + 76) < 0 && !*(_DWORD *)(v20 + 84) )
{
(*(void (__fastcall **)(_QWORD, const char *))(a1 + 16))(
*(_QWORD *)(a1 + 24),
"%% Can not set speed with interface media type auto select\n");
return 1;
}
v18 = *(_QWORD *)(v20 + 448);
if ( v18 && *(_BYTE *)(v18 + 125) && *(_BYTE *)(v18 + 96) != 1 )
{
(*(void (__fastcall **)(_QWORD, const char *))(a1 + 16))(
*(_QWORD *)(a1 + 24),
"%% Cannot configure aggregator member\n");
return 1;
}
v17 = *(_QWORD *)(v20 + 448);
if ( v17 && *(_BYTE *)(v17 + 125) && *(_BYTE *)(v17 + 96) != 2 )
{
(*(void (__fastcall **)(_QWORD, const char *))(a1 + 16))(*(_QWORD *)(a1 + 24), "%% Cannot configure aggregator\n");
return 1;
}
if ( *(_WORD *)(v20 + 302) != 2 && *(_WORD *)(v20 + 302) != 9 )
{
v4 = *(void (**)(__int64, const char *, ...))(a1 + 16);
v5 = *(_QWORD *)(a1 + 24);
v6 = (const char *)sub_49EB94(*(unsigned __int16 *)(v20 + 302));
v4(v5, "%% Can't set speed on %s interface\n", v6);
return 1;
}
if ( !strncmp(*a3, "400G", 4u) )
{
v23 = 12;
}
else if ( !strncmp(*a3, "200G", 4u) )
{
v23 = 11;
}
else if ( !strncmp(*a3, "100G", 4u) )
{
v23 = 6;
}
else if ( !strncmp(*a3, "40G", 3u) )
{
v23 = 5;
}
else if ( !strncmp(*a3, "50G", 3u) )
{
v23 = 10;
}
else if ( !strncmp(*a3, "25G", 3u) )
{
v23 = 9;
}
else if ( !strncmp(*a3, "10G", 3u) )
{
v23 = 4;
}
else if ( !strncmp(*a3, "5G", 2u) )
{
v23 = 8;
}
else if ( !strncmp(*a3, "2G5", 3u) )
{
v23 = 7;
}
else if ( !strncmp(*a3, "1000", 4u) )
{
v23 = 3;
}
else if ( !strncmp(*a3, "100", 3u) )
{
v23 = 2;
}
else if ( !strncmp(*a3, "10", 2u) )
{
v23 = 1;
}
else
{
if ( strncmp(*a3, "auto", 4u) )
{
(*(void (**)(_QWORD, const char *, ...))(a1 + 16))(*(_QWORD *)(a1 + 24), "%% Invalid speed : %s\n", *a3);
return 1;
}
v23 = 0;
}
if ( v23 && *(_DWORD *)(v20 + 268) && *(_DWORD *)(v20 + 820) == 1 )
{
(*(void (__fastcall **)(_QWORD, const char *))(a1 + 16))(
*(_QWORD *)(a1 + 24),
"%% Please disable eee function first\n");
return 1;
}
else
{
if ( *(_WORD *)(v20 + 302) != 2
|| !(unsigned int)sub_50F024(*(unsigned int *)(v20 + 80))
&& !(unsigned int)sub_50F050(*(unsigned int *)(v20 + 80))
&& !(unsigned int)sub_50F07C(*(unsigned int *)(v20 + 80))
&& !(unsigned int)sub_50F100(*(unsigned int *)(v20 + 80))
&& !(unsigned int)sub_50F0D4(*(unsigned int *)(v20 + 80))
&& !(unsigned int)sub_50F0A8(*(unsigned int *)(v20 + 80))
&& !(unsigned int)sub_50F184(*(unsigned int *)(v20 + 80)) )
{
v22 = 0;
}
if ( v22 && (*(_WORD *)(v20 + 836) & 0x80) == 0 )
{
if ( v23 && v23 != 12 && v23 != 11 && v23 != 6 && v23 != 10 && v23 != 9 && v23 != 4 && v23 != 5 )
v21 = 20;
if ( (*(_WORD *)(v20 + 836) & 0x3F) == 2 )
{
if ( v23 == 12 )
v21 = 20;
if ( v23 == 11 )
v21 = 20;
if ( v23 == 6 )
v21 = 20;
if ( v23 == 10 )
v21 = 20;
}
if ( (*(_WORD *)(v20 + 836) & 0x3F) == 1 )
{
if ( v23 == 12 )
v21 = 20;
if ( v23 == 11 )
v21 = 20;
if ( v23 == 6
&& (unsigned int)sub_50F0D4(*(unsigned int *)(v20 + 80))
&& (unsigned int)sub_50F07C(*(unsigned int *)(v20 + 80)) )
{
v21 = 20;
}
if ( v23 == 10
&& (unsigned int)sub_50F0D4(*(unsigned int *)(v20 + 80))
&& (unsigned int)sub_50F100(*(unsigned int *)(v20 + 80)) )
{
v21 = 20;
}
if ( v23 == 5 || v23 == 4 )
v21 = 20;
}
if ( (*(_WORD *)(v20 + 836) & 0x3F) == 4 || (*(_WORD *)(v20 + 836) & 0x3F) == 8 )
{
if ( v23 == 5 || v23 == 9 || v23 == 4 )
v21 = 20;
if ( v23 == 10 )
{
if ( (unsigned int)sub_50F0D4(*(unsigned int *)(v20 + 80))
&& (unsigned int)sub_50F07C(*(unsigned int *)(v20 + 80)) )
{
v21 = 20;
}
if ( (unsigned int)sub_50F0D4(*(unsigned int *)(v20 + 80))
&& !(unsigned int)sub_50F100(*(unsigned int *)(v20 + 80))
&& !(unsigned int)sub_50F07C(*(unsigned int *)(v20 + 80)) )
{
v21 = 20;
}
}
if ( v23 == 6 )
{
if ( (unsigned int)sub_50F07C(*(unsigned int *)(v20 + 80))
&& (unsigned int)sub_50F050(*(unsigned int *)(v20 + 80)) )
{
v21 = 20;
}
if ( (unsigned int)sub_50F0A8(*(unsigned int *)(v20 + 80))
&& (unsigned int)sub_50F07C(*(unsigned int *)(v20 + 80))
&& !(unsigned int)sub_50F050(*(unsigned int *)(v20 + 80)) )
{
v21 = 20;
}
}
}
if ( (*(_WORD *)(v20 + 836) & 0x3F) == 0 )
{
if ( v23 == 11 || v23 == 12 )
v21 = 20;
if ( v23 == 6
&& (unsigned int)sub_50F0D4(*(unsigned int *)(v20 + 80))
&& (unsigned int)sub_50F07C(*(unsigned int *)(v20 + 80)) )
{
v21 = 20;
}
if ( v23 == 10
&& (unsigned int)sub_50F0D4(*(unsigned int *)(v20 + 80))
&& (unsigned int)sub_50F100(*(unsigned int *)(v20 + 80)) )
{
v21 = 20;
}
}
}
if ( v23 == 8 && (*(_BYTE *)(v20 + 249) || *(_BYTE *)(v20 + 248)) )
{
(*(void (__fastcall **)(_QWORD, const char *))(a1 + 16))(
*(_QWORD *)(a1 + 24),
"%% Please disable flowcontrol send and receive function first\n");
return 1;
}
else
{
v16 = sub_510A48(*(unsigned int *)(*(_QWORD *)(a1 + 136) + 16LL), v20, v23);
if ( !v16 )
*(_BYTE *)(v20 + 401) |= 4u;
if ( (unsigned int)sub_52C79C(a1, v16) )
{
return 1;
}
else
{
v7 = *(void (**)(__int64, const char *, ...))(a1 + 16);
v8 = *(_QWORD *)(a1 + 24);
v9 = (const char *)sub_49FF90(*(unsigned __int16 *)(v20 + 836));
v10 = (const char *)sub_49ED5C(*(unsigned int *)(v20 + 68));
v7(
v8,
"%% Warning: FEC %s can be configured but not in effect on %s port\n"
"%% Please use show interface cmd to confirm FEC status details\n",
v9,
v10);
return v21;
}
}
}
}The function covers several speed command modes (auto, 10, 100, 1000, 10G, 40G, 100G), along with the key user-facing error %% Unsupported CLI in present interface. Please refer to CLI \"group-speed %s\"\n. Let’s locate the error site and analyse the code.
if ( *(_WORD *)(v20 + 302) == 2 )
{
v15 = 0;
v19 = 0;
v19 = sub_50EB5C(v20, &v15, 0);
if ( !v19 )
{
if ( v15 )
{
*(_WORD *)dest = 0;
v14 = 0;
strcpy(dest, *a3);
(*(void (**)(_QWORD, const char *, ...))(a1 + 16))(
*(_QWORD *)(a1 + 24),
"%% Unsupported CLI in present interface. Please refer to CLI \"group-speed %s\"\n",
*a3);
return 1;
}
}
}The code shows that the check only fires when sub_50EB5C returns non-zero. Let’s look at its assembly to go further
.text:00000000005367AC
.text:00000000005367AC loc_5367AC ; CODE XREF: sub_536744+38↑j
.text:00000000005367AC ADD X1, X29, #0x50+var_1C
.text:00000000005367B0 ADD X0, X29, #0x50+var_1D
.text:00000000005367B4 MOV X2, X1
.text:00000000005367B8 MOV X1, X0
.text:00000000005367BC LDR X0, [X29,#0x50+var_10]
.text:00000000005367C0 BL sub_50EB5C
.text:00000000005367C4 STR W0, [X29,#0x50+var_18]
.text:00000000005367C8 LDR W0, [X29,#0x50+var_18]
.text:00000000005367CC CMP W0, #0
.text:00000000005367D0 B.EQ loc_536800
.text:00000000005367D4 LDR X0, [X29,#0x50+var_28]
.text:00000000005367D8 LDR X2, [X0,#0x10]
.text:00000000005367DC LDR X0, [X29,#0x50+var_28]
.text:00000000005367E0 LDR X3, [X0,#0x18]
.text:00000000005367E4 ADRL X0, aGetPortGroupId ; "%% Get port group id fail \n"
.text:00000000005367EC MOV X1, X0
.text:00000000005367F0 MOV X0, X3
.text:00000000005367F4 BLR X2
.text:00000000005367F8 MOV W0, #1
.text:00000000005367FC B loc_536DCCHere the function calls sub_50EB5C and reads its return value: when it is 0, execution continues at loc_536800; when it is non-zero, it prints %% Get port group id fail \n. So sub_50EB5C is exactly the user-side get port group id.
The conclusion: when speed sees a non-zero group-id, it warns and tells the user to set the rate with group-speed.
3. Working Out the Checks
Now that we know speed checks the group-id, that’s where to attack: we need to work out how to get speed past the group-id check and issue the command straight to the board.
The analysis above shows sub_536744 handles group-speed. We’re after speed, so another function must print Unsupported CLI in present interface. A global search finds exactly one besides sub_536744: sub_534568.

if ( *(_WORD *)(v20 + 302) == 2 )
{
v15 = 0;
v19 = 0;
v19 = sub_50EB5C(v20, &v15, 0);
if ( !v19 )
{
if ( v15 )
{
*(_WORD *)dest = 0;
v14 = 0;
strcpy(dest, *a3);
(*(void (**)(_QWORD, const char *, ...))(a1 + 16))(
*(_QWORD *)(a1 + 24),
"%% Unsupported CLI in present interface. Please refer to CLI \"group-speed %s\"\n",
*a3);
return 1;
}
}
}3. Working Out the Checks
Now that we know the speed command checks the group-id, that’s where to attack. Let’s work out how to make speed bypass the group-id check.
From the analysis above we know sub_536744 handles the group-speed command. We’re after speed, so there must be another function that prints Unsupported CLI in present interface. A global search turns up sub_534568. Let’s analyse it.
From that function we learn that the error fires when v15 is non-zero. The function that sets v15 is sub_50EB5C, the get port group id helper mentioned above. So let’s look at the assembly to see which address calls it.
.text:00000000005345AC B.NE loc_534644
.text:00000000005345B0 STRB WZR, [X29,#0x90+var_35]
.text:00000000005345B4 STR WZR, [X29,#0x90+var_1C]
.text:00000000005345B8 ADD X0, X29, #0x90+var_35
.text:00000000005345BC MOV X2, #0
.text:00000000005345C0 MOV X1, X0
.text:00000000005345C4 LDR X0, [X29,#0x90+var_18]
.text:00000000005345C8 BL sub_50EB5C
.text:00000000005345CC STR W0, [X29,#0x90+var_1C]
.text:00000000005345D0 LDR W0, [X29,#0x90+var_1C]
.text:00000000005345D4 CMP W0, #0
.text:00000000005345D8 B.NE loc_534644
.text:00000000005345DC LDRB W0, [X29,#0x90+var_35]
.text:00000000005345E0 CMP W0, #0
.text:00000000005345E4 B.EQ loc_534644
.text:00000000005345E8 ADRL X0, word_AAD088
.text:00000000005345F0 LDRH W0, [X0]
.text:00000000005345F4 STRH W0, [X29,#0x90+dest]
.text:00000000005345F8 STUR XZR, [X29,#0x90+var_3E]
.text:00000000005345FC LDR X0, [X29,#0x90+var_58]
.text:0000000000534600 LDR X1, [X0] ; src
.text:0000000000534604 ADD X0, X29, #0x90+dest ; dest
.text:0000000000534608 BL .strcpy
.text:000000000053460C LDR X0, [X29,#0x90+var_48]
.text:0000000000534610 LDR X3, [X0,#0x10]
.text:0000000000534614 LDR X0, [X29,#0x90+var_48]
.text:0000000000534618 LDR X4, [X0,#0x18]
.text:000000000053461C LDR X0, [X29,#0x90+var_58]
.text:0000000000534620 LDR X1, [X0]
.text:0000000000534624 ADRL X0, aUnsupportedCli ; "%% Unsupported CLI in present interface"...
.text:000000000053462C MOV X2, X1
.text:0000000000534630 MOV X1, X0
.text:0000000000534634 MOV X0, X4
.text:0000000000534638 BLR X3
.text:000000000053463C MOV W0, #1
.text:0000000000534640 B loc_53504CThe assembly shows the call at 0x5345C8. Reading the context:
.text:00000000005345C4 LDR X0, [X29,#0x90+var_18]is ifentrysub_50EB5Cfetches thegroup-id.text:00000000005345CC STR W0, [X29,#0x90+var_1C]stores the return value.text:00000000005345D8 B.NE loc_534644on lookup failure, continue as an ungrouped interface.text:00000000005345DC LDRB W0, [X29,#0x90+var_35]loads the earlier return value.text:00000000005345E4 B.EQ loc_534644whengroup==0, jump to the normal speed-setting path. Looking at the assembly, the function is called at0x5345C8. Reading the surrounding context:.text:00000000005345C4 LDR X0, [X29,#0x90+var_18]is ifentrysub_50EB5Cfetches thegroup-id.text:00000000005345CC STR W0, [X29,#0x90+var_1C]stores the return value.text:00000000005345D8 B.NE loc_534644if the lookup fails, carry on as an ungrouped interface.text:00000000005345DC LDRB W0, [X29,#0x90+var_35]loads the earlier return value.text:00000000005345E4 B.EQ loc_534644whengroup==0, jump to the normal speed-setting path.
That is now clear: 0x5345E4 is the instruction that lets the speed be applied normally when group-id is 0. So here’s the experiment: turn that B.EQ into an unconditional B, so the normal speed-setting path always runs.
4. First Patch
With the approach in hand, let’s write an in-memory patch script and run it on the device.
Note: this device’s Linux root shell has already been claimed; it has been reported to the vendor and a CVE ID requested. Technical details stay private until the vendor ships a fix.
The device has Python 2.7, so the memory patch is written in Python.
GPATCH = 0x5345e4
wr(ABIL, struct.pack('<I', cur | 0x20)) # add 0x20 to the capability bitmap
wr(GPATCH, binascii.unhexlify('18000014')) # b.eq -> bAfter applying the memory patch I tried the speed command. It no longer asked me to use group-speed, but a new error appeared: % Can not set speed with interface media type auto select.
5. Locating the First Patch’s Error Site
The string for that error is at 0x534674
.text:0000000000534674 ADRL X0, aCanNotSetSpeed ; "%% Can not set speed with interface med"...Here is the surrounding assembly
.text:0000000000534644 loc_534644 ; CODE XREF: sub_534568+44↑j
.text:0000000000534644 ; sub_534568+70↑j ...
.text:0000000000534644 LDR X0, [X29,#0x90+var_18]
.text:0000000000534648 LDR W0, [X0,#0x4C]
.text:000000000053464C CMP W0, #0
.text:0000000000534650 B.GE loc_534690
.text:0000000000534654 LDR X0, [X29,#0x90+var_18]
.text:0000000000534658 LDR W0, [X0,#0x54]
.text:000000000053465C CMP W0, #0
.text:0000000000534660 B.NE loc_534690
.text:0000000000534664 LDR X0, [X29,#0x90+var_48]
.text:0000000000534668 LDR X2, [X0,#0x10]
.text:000000000053466C LDR X0, [X29,#0x90+var_48]
.text:0000000000534670 LDR X3, [X0,#0x18]
.text:0000000000534674 ADRL X0, aCanNotSetSpeed ; "%% Can not set speed with interface med"...
.text:000000000053467C MOV X1, X0
.text:0000000000534680 MOV X0, X3
.text:0000000000534684 BLR X2
.text:0000000000534688 MOV W0, #1
.text:000000000053468C B loc_53504CSo the error triggers when [ifentry+0x4c] < 0 && [ifentry+0x54] == 0. Reading those fields per port shows what the vendor did
| Port | [+0x4c] | [+0x54] | Result |
|---|---|---|---|
| Copper / QSFP | positive | 0 | passes |
| SFP+ 51~54 | negative | 0 | errors |
In other words, when media-type is copper or QSFP the check passes. The vendor CLI has commands to change media-type directly, so I tried changing it.
6. First Setback
After applying the speed, I plugged a device in and waited, but it never negotiated 2.5Gbe. Re-issuing the command produced a new error: % Unsupported port speed abort.
Data patching is unreliable; the code itself has to change.
7. Changing the Code
From the steps above it became clear the real capability limit lives in the HAL layer, and nsm is only the messaging middleware.
After some digging I found the media-type gate at 0x50f920. The surrounding assembly is
.text:000000000050F750 ADD X0, X29, #0x30+var_10
.text:000000000050F754 MOV X1, X0
.text:000000000050F758 LDR X0, [X29,#0x30+var_18]
.text:000000000050F75C BL sub_50EAAC
.text:000000000050F760 LDR W0, [X29,#0x30+var_10]
.text:000000000050F764 AND W0, W0, #0x1FFF
.text:000000000050F768 STR W0, [X29,#0x30+var_4]
.text:000000000050F76C LDR W0, [X29,#0x30+var_8]
.text:000000000050F770 AND W0, W0, #0xFFFFFF
.text:000000000050F774 STR W0, [X29,#0x30+var_C]
...
.text:000000000050F910 loc_50F910 ; CODE XREF: sub_50F728+1D4↑j
.text:000000000050F910 LDR W0, [X29,#0x30+var_1C]
.text:000000000050F914 CMP W0, #7
.text:000000000050F918 B.NE loc_50F92C
.text:000000000050F91C LDR W0, [X29,#0x30+var_C]
.text:000000000050F920 AND W0, W0, #0x20 ; ' '
.text:000000000050F924 CMP W0, #0
.text:000000000050F928 B.NE loc_50F970Walking through the logic:
.text:000000000050F758 LDR X0, [X29,#0x30+var_18]- ifentry.text:000000000050F75C BL sub_50EAAC- computes the port type.text:000000000050F768 STR W0, [X29,#0x30+var_4]-*type.text:000000000050F76C LDR W0, [X29,#0x30+var_8]- ifentry + 0x50.text:000000000050F774 STR W0, [X29,#0x30+var_C]- ability bitmap Next, find where the capability bitmap comes from
.text:000000000050E3BC AND W0, W0, #0x1FFF
.text:000000000050E3C0 CMP W0, #0x63 ; switch 100 cases
.text:000000000050E3C4 B.HI def_50E3DC ; jumptable 000000000050E3DC default case, case 54
.text:000000000050E3C8 ADRL X1, jpt_50E3DC
.text:000000000050E3D0 LDR W0, [X1,W0,UXTW#2]
.text:000000000050E3D4 ADR X1, loc_50E3E0 ; jumptable 000000000050E3DC case 0
.text:000000000050E3D8 ADD X0, X1, W0,SXTW#2
.text:000000000050E3DC BR X0 ; switch jump50e3fc: ... 50e404: bl strncmp ; vs 0xaa3d48 = 'agg' (len 3) → returns 20
50e430: ... bl strncmp ; vs 0xaa3d50 = 'vlan' (len 4) → returns 21
50e45c: ... bl strncmp ; vs 0xaa3d58 = 'tunnel'(len 6) → returns 22
50e488: ... bl strncmp ; vs 0xaa3d60 = 'loopback'(len 8) → returns 23
50e4b4: ... bl strncmp ; vs 0xaa3d70 = 'seth' → returns ...So type is a category code derived from the interface name (agg/vlan/tunnel/loopback/seth*/eth*……)**.
The capability bitmap works out as follows
| Branch | Allowed speed codes | Notes |
|---|---|---|
| type==1 | {0,1,2,3} | rejects 3 (1G) when [if+0x10c]!=0, returning -246 |
| type==3 | {0,1,2} | |
| type==45 | {0,2,3,7,8} | rejects 3/7/8 when [if+0x10c]!=0; then checks the capability bits |
| type==43 (0x2b) | {0,2,3,4,7,8} | rejects 3/7/8/4 when [if+0x10c]!=0; then checks the capability bits |
| Everything else | 5/6/4/3/2/10/9/7/11/12 …… | checks the capability bits against the full speed set |
So the speed code table is: 0=auto 1=10M 2=100M 3=1G 4=10G 5=40G 6=100G 7=2.5G 8=5G 9=25G 10=50G 11=200G 12=400G So we need to patch the validator:
| Address | Original | Patched |
|---|---|---|
nsm VA 0x50f728 | fd 7b bd a9 (stp x29,x30,[sp,#-48]!) | 00 00 80 52 c0 03 5f d6 (mov w0,#0; ret) |
8. Second Patch
The patch is written in Python
8. Second Patch
The patch is written in Python
import sys, binascii
pid = int(sys.argv[1]); act = sys.argv[2]
BK = '/tmp/mpatch_bk.txt'
# (label, nsm VA, original bytes hex, new bytes hex) -- lengths may be 4 or 8 bytes
EDITS = [
# 0x50f728 = port-speed ability validator: "stp x29,x30,[sp,#-48]!" -> "mov w0,#0; ret"
('valid_entry', 0x50f728, 'fd7bbda9', '00008052c0035fd6'),
]
def rd(off, n):
f = open('/proc/%d/mem' % pid, 'rb'); f.seek(off); return f.read(n)
def wr(off, data):
f = open('/proc/%d/mem' % pid, 'r+b'); f.seek(off); f.write(data); f.flush()
def hx(b):
return binascii.hexlify(b)
if act == 'read':
for (lab, a, o, n) in EDITS:
print("%-14s @0x%x now=%s" % (lab, a, hx(rd(a, len(o) // 2))))
sys.exit(0)
if act == 'patch':
lines = []
for (lab, a, o, n) in EDITS:
cur = hx(rd(a, len(o) // 2))
lines.append("%s %x %s" % (lab, a, cur))
if cur == o:
wr(a, binascii.unhexlify(n))
else:
print("WARN %s current=%s expected=%s" % (lab, cur, o))
open(BK, 'w').write("\n".join(lines) + "\n")
for (lab, a, o, n) in EDITS:
print("%-14s @0x%x -> %s" % (lab, a, hx(rd(a, len(o) // 2))))
if act == 'restore':
for line in open(BK):
wr(a, binascii.unhexlify(n))
else:
print("WARN %s current=%s expected=%s" % (lab, cur, o))
open(BK, 'w').write("\n".join(lines) + "\n")
for (lab, a, o, n) in EDITS:
print("%-14s @0x%x -> %s" % (lab, a, hx(rd(a, len(o) // 2))))
if act == 'restore':
for line in open(BK):
lab, a, cur = line.split()
wr(int(a, 16), binascii.unhexlify(cur))
print("restored %s @%s -> %s" % (lab, a, hx(rd(int(a, 16), len(cur) // 2))))Apply the patch on the device, then push the speed again.
Switch(config-if)# speed 2G5
Switch# show running-config interface eth-0-51
interface eth-0-51
speed 2G5
Switch# show interface eth-0-51
Interface current state: UP
Bandwidth 2500000 kbits
Speed - 2.5Gb/s , Duplex - FullThe port speed is now applied as 2.5Gbe, and the connected device did not renegotiate after testing. That completes the patch.

9. Persistence
This switch’s rootfs is ramfs, so the patch can’t be made persistent. The flash, however, is mounted as ext4. So we can keep a patch script on the device and re-apply it manually after a reboot. A switch like this almost never reboots unless power is lost, so that’s workable for now; a truly persistent approach can come later. Here is the complete patch
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
import os
import sys
import glob
import time
TARGET = '/usr/sbin/nsm' # target process
WAIT_SECS = 30 # seconds to wait for nsm to come up
# (label, runtime address == in-file VA (nsm is non-PIE), original bytes, patched bytes)
# Note: byte strings are little-endian (the actual byte order of ARM64 instructions in memory)
EDITS = [
('group_check ', 0x5345e4, '00030054', '18000014'),
('ability_validator', 0x50f728, 'fd7bbda9fd030091', '00008052c0035fd6'),
]
PATCHDIR = os.path.dirname(os.path.abspath(__file__))
BACKUP = os.path.join(PATCHDIR, 'patch-sfp+.bak')
def find_pid():
"""Find nsm's pid via /proc/<pid>/exe (does not depend on pidof being available)."""
for p in glob.glob('/proc/[0-9]*/exe'):
try:
if os.readlink(p) == TARGET:
return int(p.split('/')[2])
except OSError:
pass
return None
def wait_pid():
for _ in range(WAIT_SECS):
pid = find_pid()
if pid is not None:
return pid
time.sleep(1)
return None
def hx(b):
return ''.join('%02x' % ord(c) for c in b)
def mem_rd(fd, off, n):
os.lseek(fd, off, os.SEEK_SET)
return os.read(fd, n)
def mem_wr(fd, off, data):
os.lseek(fd, off, os.SEEK_SET)
return os.write(fd, data)
def do_status(fd):
rc = 0
for (lab, addr, orig, patched) in EDITS:
n = len(orig) // 2
cur = hx(mem_rd(fd, addr, n))
if cur == patched:
state = 'PATCHED'
elif cur == orig:
state = 'original'
else:
state = 'UNKNOWN'
rc = 2
print(" %s @0x%06x = %-20s [%s]" % (lab, addr, cur, state))
return rc
def do_restore(fd):
if not os.path.exists(BACKUP):
print("ERROR: backup %s not found, cannot restore" % BACKUP)
return 1
for line in open(BACKUP):
lab, addr, orig = line.split()
mem_wr(fd, int(addr, 16), orig.decode('hex'))
print(" restored %s @0x%s -> %s" % (lab, addr, hx(mem_rd(fd, int(addr, 16), len(orig) // 2))))
return 0
def do_patch(fd):
rc = 0
bk = []
for (lab, addr, orig, patched) in EDITS:
n = len(orig) // 2
cur = hx(mem_rd(fd, addr, n))
bk.append("%s %x %s\n" % (lab.strip(), addr, orig)) # always record original bytes in the backup
if cur == patched:
print(" SKIP %s @0x%06x already patched" % (lab, addr))
elif cur == orig:
mem_wr(fd, addr, patched.decode('hex'))
print(" PATCH %s @0x%06x %s -> %s" % (lab, addr, cur, hx(mem_rd(fd, addr, n))))
else:
print(" WARN %s @0x%06x unexpected content %s (expected %s), skipped" % (lab, addr, cur, orig))
rc = 2
try:
f = open(BACKUP, 'w')
f.writelines(bk)
f.close()
print(" backup written to %s" % BACKUP)
except IOError, e:
print(" WARN failed to write backup: %s" % e)
return rc
def main():
mode = 'patch'
if '--restore' in sys.argv:
mode = 'restore'
elif '--status' in sys.argv:
mode = 'status'
print("=== patch-sfp+.py mode=%s ===" % mode)
pid = wait_pid()
if pid is None:
print("ERROR: nsm process not found after %ds (%s)" % (WAIT_SECS, TARGET))
return 1
print(" nsm pid = %d" % pid)
fd = os.open('/proc/%d/mem' % pid, os.O_RDWR)
try:
if mode == 'status':
rc = do_status(fd)
elif mode == 'restore':
rc = do_restore(fd)
else:
rc = do_patch(fd)
finally:
os.close(fd)
if rc == 0:
print("=== DONE ===")
else:
print("=== DONE (rc=%d, check any WARN above) ===" % rc)
return rc
if __name__ == '__main__':
sys.exit(main())10. Back to the Opening Questions
10.1 Why Did the Vendor Bind These Four Ports into One Group?
The chip has the concept of PLL domains (CMU) (sys_tsingma_datapath_12g_is_pll_equal, sys_tsingma_datapath_28g_is_pll_equal, _sys_tsingma_datapath_12g_load_cmu_val).
But the ports on my unit are SFP+, not SFP28, so 25G/50G rates aren’t supported and the 28G clock case never arises. Binding the ports together is the vendor’s choice.
10.2 Why Did group-speed Never Implement 2.5Gbe?
After all this analysis I still can’t give a definitive answer, but some likely vendor intent did emerge along the way.
- Product positioning: SFP+ is an uplink, and 2.5G belongs on the access side The unit is 48×2.5G copper + 4×10G + 2×40G:
- 2.5Gbe is the access-side capability, provided by the PHYs behind the 48 copper ports;
- SFP+ is for uplinks and cascading, where the target rates are 1G/10G.
Given that split, running 2.5Gbe on an uplink isn’t a scenario in the product design, so there was never a reason to build it into the uplink-only
group-speed.
- 2.5Gbe is not a standard rate on SFP+ SFP+ MSA defines 1G and 10G. Running 2.5G over SFP+ is non-standard and very few modules support it. Offering a non-standard rate on uplink ports would mean extra module compatibility validation, unknown DDM/CDR behaviour, and after-sales support cost.
- Code structure: shared table vs specialised logic This is the most direct engineering explanation:
- per-port
speedis a code path shared across the whole product line, and its token table has to cover every port type of every SKU (10M……400G), so 2G5 is naturally in there; group-speedis specialised logic for uplink port groups, and the vendor only enumerated the rates that scenario actually uses (default|1000|10G|25G).
- The vendor probably turned it off on purpose, rather than forgetting
This is the strongest clue: the
speed-mode (1-10G | 2G5-10G | 1-25G | 10-25G)command already handles 2G5-10G end to end, including writingEEPROM/sysenvand taking effect after a reboot, andshow speed-…reports it. So the capability exists and the switch is deliberately welded shut. That looks less like an omission and more like built, then segmented by board type, or disabled for a customer configuration.
Conclusion
I’m not a professional, so please point out any mistakes or omissions! Thanks for reading.
If you enjoyed this, leave a comment~