Check VLAN interface name.
This commit is contained in:
parent
a41fb33433
commit
c6944765e8
@ -1080,6 +1080,18 @@ vlan_edit() {
|
|||||||
write_iface_option "$cachedir/$new" "VID" "$vid"
|
write_iface_option "$cachedir/$new" "VID" "$vid"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_vlan()
|
||||||
|
{
|
||||||
|
local name="$1"; shift
|
||||||
|
|
||||||
|
[ -n "$name" ] || return 1
|
||||||
|
|
||||||
|
if echo "$name" | grep -qs '^[[:alnum:]]$'; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
# ADD NEW VLAN FOR SELECTED INTERFACE
|
# ADD NEW VLAN FOR SELECTED INTERFACE
|
||||||
vlan_add_new() {
|
vlan_add_new() {
|
||||||
@ -1095,7 +1107,8 @@ vlan_add_new() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$name" ]; then
|
if ! check_vlan "$name"; then
|
||||||
|
write_error "`_ "Invalid VLAN name: $name"`"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user