Skip to content

Commit abbffae

Browse files
author
Venkat Chimata
committed
ratelimit: generate shorter IFB names for phy-based interfaces
Interfaces like phy6g-ap0 can produce overly long IFB device names (e.g., i-phy6g-ap0), which may exceed kernel name-length limits, specifically in case of VLANs. This patch normalizes such interface names by replacing the phy prefix with p and shortening ap → a, producing more compact IFB device names (e.g., i-p2g-a0). Other interfaces continue using their original names. Signed-off-by: Venkat Chimata <venkat@nearhop.com>
1 parent 7d64152 commit abbffae

File tree

1 file changed

+12
-1
lines changed
  • feeds/ucentral/ratelimit/files/usr/bin

1 file changed

+12
-1
lines changed

feeds/ucentral/ratelimit/files/usr/bin/ratelimit

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,18 @@ function qdisc_del(iface) {
3737
}
3838

3939
function ifb_dev(iface) {
40-
return "i-" + iface;
40+
let ifbname;
41+
if (index(iface, 'phy') != -1) {
42+
// For interfaces like phy6g-ap0, phy5g-ap0, phy2g-ap0
43+
// we replace 'phy' with "p" to confine the ifb name length
44+
// and replace 'ap' with 'a' to further shorten it.
45+
ifbname = replace(iface, 'phy', 'p');
46+
ifbname = replace(ifbname, 'ap', 'a');
47+
} else {
48+
ifbname = iface;
49+
}
50+
ifbname = "i-" + ifbname;
51+
return ifbname;
4152
}
4253

4354
function ifb_add(iface, ifbdev) {

0 commit comments

Comments
 (0)