Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ensure pppoe iface name has a max of 5 chars #378

Merged
merged 2 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion public/i18n/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,8 @@
"create_bond": "Create bond",
"configure_bond": "Configure bond",
"configure_bond_name": "Configure bond {name}",
"clients_network": "Clients network"
"clients_network": "Clients network",
"pppoe_name_too_long_need_reconfiguration": "PPPoE interface names are limited to {num} characters. You can remove the configuration from this device, then reconfigure it with a shorter interface name."
},
"multi_wan": {
"title": "MultiWAN",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,9 @@ function validate() {
if (logicalIfaceType.value == 'bond') {
maxLen = 10
}
if (protocol.value == 'pppoe') {
maxLen = 5
}
let { valid, errMessage, i18Params } = validateUciName(interfaceName.value, maxLen)
if (!valid) {
error.value.interfaceName = t(errMessage as string, i18Params as any)
Expand All @@ -665,6 +668,20 @@ function validate() {
focusElement(interfaceNameRef)
}
}
} else {
// editing an already configured device
if (protocol.value == 'pppoe' && interfaceName.value.length > 5) {
error.value.interfaceName = t(
'standalone.interfaces_and_devices.pppoe_name_too_long_need_reconfiguration',
{
num: 5
}
)
if (isValidationOk) {
isValidationOk = false
focusElement(interfaceNameRef)
}
}
}

if (isConfiguringFromScratch.value) {
Expand Down