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>
This commit is contained in:
Venkat Chimata 2025-12-08 16:10:10 +05:30 committed by John Crispin
parent 20f5fa0284
commit 352e94a133

View File

@ -37,7 +37,19 @@ function qdisc_del(iface) {
}
function ifb_dev(iface) {
return "i-" + iface;
let ifbname;
if ((index(iface, 'phy') != -1) && (index(iface, 'ap') != -1)) {
// For interfaces like phy6g-ap0, phy5g-ap0, phy2g-ap0
// we replace 'phy' with "p" to confine the ifb name length
// and replace 'ap' with 'a' to further shorten it.
ifbname = replace(iface, 'phy', 'p');
ifbname = replace(ifbname, 'ap', 'a');
} else {
ifbname = iface;
}
ifbname = "i-" + ifbname;
return ifbname;
}
function ifb_add(iface, ifbdev) {