luci-mod-network: Add length restriction to wireless interface name
authorHannu Nyman <hannu.nyman@iki.fi>
Sat, 14 Jan 2023 08:40:43 +0000 (10:40 +0200)
committerHannu Nyman <hannu.nyman@iki.fi>
Sat, 14 Jan 2023 08:40:43 +0000 (10:40 +0200)
Based on issue #6101, add a maxlength of 15 chars to the wireless
interface's optional name field. Also validate it as uciname.

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js

index 420b381e2f71b986f4e44bf409a1d93880c1da8e..de3eacff237100c4a191bc7c5cf80a6b4a65889c 100644 (file)
@@ -1159,6 +1159,7 @@ return view.extend({
 
                                        o = ss.taboption('advanced', form.Value, 'ifname', _('Interface name'), _('Override default interface name'));
                                        o.optional = true;
+                                       o.datatype = 'and(uciname,maxlength(15))';
                                        o.placeholder = radioNet.getIfname();
                                        if (/^radio\d+\.network/.test(o.placeholder))
                                                o.placeholder = '';