From ed247481c162eb619764c8d206e2272909963a3d Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 6 Mar 2008 12:38:19 -0800 Subject: better syntax/semantic checking of qos-policy Add a bunch of checks. * Check policy configuration at commit time * Add check for duplicate names * Allow _ in policy name Bugfix: 2907 --- templates/qos-policy/fair-queue/node.def | 9 +++++---- templates/qos-policy/node.def | 1 + templates/qos-policy/traffic-shaper/node.def | 9 +++++---- 3 files changed, 11 insertions(+), 8 deletions(-) (limited to 'templates/qos-policy') diff --git a/templates/qos-policy/fair-queue/node.def b/templates/qos-policy/fair-queue/node.def index b45f93e..76969a2 100644 --- a/templates/qos-policy/fair-queue/node.def +++ b/templates/qos-policy/fair-queue/node.def @@ -1,7 +1,8 @@ tag: type: txt help: Configure fair queueing policy -syntax:expression: pattern $VAR(@) "^[[:alnum:]][-[:alnum:]]*$" - ; "invalid qos-policy name $VAR(@)" -update: /opt/vyatta/sbin/vyatta-qos.pl --update-policy $VAR(../@) $VAR(@) -delete: /opt/vyatta/sbin/vyatta-qos.pl --delete-policy $VAR(../@) $VAR(@) +syntax:expression: pattern $VAR(@) "^[[:alnum:]][-_[:alnum:]]*$" + ; "only alpha-numeric policy name allowed" +create: /opt/vyatta/sbin/vyatta-qos.pl --create-policy "$VAR(.)" "$VAR(@)" +delete: /opt/vyatta/sbin/vyatta-qos.pl --delete-policy "$VAR(@)" +update: /opt/vyatta/sbin/vyatta-qos.pl --update-policy "$VAR(.)" "$VAR(@)" diff --git a/templates/qos-policy/node.def b/templates/qos-policy/node.def index 1bd41ac..a810fcb 100644 --- a/templates/qos-policy/node.def +++ b/templates/qos-policy/node.def @@ -1 +1,2 @@ help: Qos policy type +begin: /opt/vyatta/sbin/vyatta-qos.pl --check diff --git a/templates/qos-policy/traffic-shaper/node.def b/templates/qos-policy/traffic-shaper/node.def index c9be692..e1cab0b 100644 --- a/templates/qos-policy/traffic-shaper/node.def +++ b/templates/qos-policy/traffic-shaper/node.def @@ -1,7 +1,8 @@ tag: type: txt help: Configure traffic shaping based policy -syntax:expression: pattern $VAR(@) "^[[:alnum:]][-[:alnum:]]*$" - ; "invalid qos-policy name $VAR(@)" -update:expression: "/opt/vyatta/sbin/vyatta-qos.pl --update-policy $VAR(../@) $VAR(@)" -delete:expression: "/opt/vyatta/sbin/vyatta-qos.pl --delete-policy $VAR(../@) $VAR(@)" +syntax:expression: pattern $VAR(@) "^[[:alnum:]][-_[:alnum:]]*$" + ; "only alpha-numeric policy name allowed" +create: /opt/vyatta/sbin/vyatta-qos.pl --create-policy "$VAR(.)" "$VAR(@)" +delete: /opt/vyatta/sbin/vyatta-qos.pl --delete-policy "$VAR(@)" +update: /opt/vyatta/sbin/vyatta-qos.pl --update-policy "$VAR(.)" "$VAR(@)" -- cgit v1.2.3