diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2008-03-04 12:55:18 -0800 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2008-03-04 12:55:18 -0800 |
commit | 14c69a606f627187539796f0158dbf181a21dc00 (patch) | |
tree | 2316507aeaa62d40ed6bd04ccf45bc726f12c328 | |
parent | 6194a4338de8e612b925530265db0759a94814c4 (diff) | |
parent | 41e72b84ece50e0104e2e58c6452fc6012e2c8c3 (diff) | |
download | vyatta-cfg-14c69a606f627187539796f0158dbf181a21dc00.tar.gz vyatta-cfg-14c69a606f627187539796f0158dbf181a21dc00.zip |
Merge branch 'glendale' of suva.vyatta.com:/git/vyatta-cfg into glendale
-rw-r--r-- | debian/changelog | 18 | ||||
-rw-r--r-- | debian/control | 1 | ||||
-rw-r--r-- | debian/vyatta-cfg.postinst.in | 4 | ||||
-rw-r--r-- | etc/default/vyatta-cfg | 4 | ||||
-rwxr-xr-x | scripts/vyatta-config-loader.pl | 2 | ||||
-rw-r--r-- | scripts/vyatta-irqaffin | 47 | ||||
-rw-r--r-- | src/check_tmpl.c | 3 | ||||
-rw-r--r-- | src/cli_new.c | 3 | ||||
-rw-r--r-- | src/cli_val.l | 12 | ||||
-rw-r--r-- | templates/interfaces/ethernet/node.tag/smp_affinity/node.def | 2 |
10 files changed, 78 insertions, 18 deletions
diff --git a/debian/changelog b/debian/changelog index 01b2125..5f9affd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,21 @@ +vyatta-cfg (0.2) unstable; urgency=low + + vc4.0.0 + [ Mark O'Brien ] + + + [ An-Cheng Huang ] + * rewrite lexical analyzer to support simplified templates. + * add "official" support for "comp_help" and "allowed" in config + template + * allow non-indented line continuation + * skip spaces immediately after field names + * handle empty action + * * don't require backslash line-continuation in expressions. + * allow non-txt values in initial state (for default). + + -- An-Cheng Huang <mobrien@vyatta.com> Mon, 25 Feb 2008 17:38:45 -0800 + vyatta-cfg (0.1) unstable; urgency=low * Initial Release. diff --git a/debian/control b/debian/control index 1d04e20..c317ca4 100644 --- a/debian/control +++ b/debian/control @@ -13,6 +13,7 @@ Depends: bash (>= 3.1), procps (>= 1:3.2.7-3), vyatta-quagga | quagga, coreutils (>= 5.97-5.3), + bsdutils, vyatta-op, vyatta-config-migrate, dhcp3-client | vyatta-dhcp3-client diff --git a/debian/vyatta-cfg.postinst.in b/debian/vyatta-cfg.postinst.in index 556b1a9..074d57c 100644 --- a/debian/vyatta-cfg.postinst.in +++ b/debian/vyatta-cfg.postinst.in @@ -18,6 +18,6 @@ if [ "$sysconfdir" != "/etc" ]; then done fi -# add group for configure +# add group for configuration, if not already present: +grep '^vyattacfg:' /etc/group >/dev/null || addgroup --system vyattacfg - diff --git a/etc/default/vyatta-cfg b/etc/default/vyatta-cfg index dfb4006..ef02233 100644 --- a/etc/default/vyatta-cfg +++ b/etc/default/vyatta-cfg @@ -33,6 +33,10 @@ for g in "${groups[@]}"; do is_users=1 fi done +# root is also admin +if [ "$(id -u)" == 0 ]; then + is_admin=1 +fi # check level from high to low if [ $is_admin == 1 ]; then declare -x -r VYATTA_USER_LEVEL_DIR=${vyatta_sysconfdir}/shell/level/admin diff --git a/scripts/vyatta-config-loader.pl b/scripts/vyatta-config-loader.pl index 035d2af..370a669 100755 --- a/scripts/vyatta-config-loader.pl +++ b/scripts/vyatta-config-loader.pl @@ -9,7 +9,7 @@ use VyattaConfigLoad; umask 0002; if (!open(OLDOUT, ">&STDOUT") || !open(OLDERR, ">&STDERR") - || !open(STDOUT, ">/var/log/config-boot.log") + || !open(STDOUT, "|/usr/bin/logger -t config-loader -p local0.debug") || !open(STDERR, ">&STDOUT")) { print STDERR "Cannot dup STDOUT/STDERR: $!\n"; exit 1; diff --git a/scripts/vyatta-irqaffin b/scripts/vyatta-irqaffin index 1f63ebe..8be98b2 100644 --- a/scripts/vyatta-irqaffin +++ b/scripts/vyatta-irqaffin @@ -34,12 +34,15 @@ # - Print the affinity mask of the IRQ being used by an interface # -# The default "all-ones" IRQ affinity mask. Used in the "reset" sub-command. -DEFAULT_MASK=ffff - # Max number of hex characters in an IRQ affinity mask. Support up to 16 CPUs. MAX_MASK=4 +# Set up some global values... +numcpus=`grep -c -e "^processor" /proc/cpuinfo` +declare -i maxmask=(2**numcpus) +let maxmask=maxmask-1 +maxmaskhex=`printf "%x" ${maxmask}` + print_usage() { echo "Usage:" @@ -78,23 +81,17 @@ get_mask() return 1 fi + declare -i intmask=0x${mask} + # Make sure that mask holds at least one bit, and holds no more bits # than we have CPUs. - if [ ${mask} -eq 0 ]; then + if [ ${intmask} -eq 0 ]; then echo "Mask can not be 0." return 1 fi - numcpus=`grep -c -e "^processor" /proc/cpuinfo` - - declare -i maxmask=(2**numcpus) - let maxmask=maxmask-1 - - declare -i intmask=0x${mask} - if [ $intmask -gt $maxmask ]; then - maxmaskhex=`printf "%x" ${maxmask}` echo "Mask is too large. Maximum hexidecimal bitmask is: ${maxmaskhex}" return 1 fi @@ -102,6 +99,21 @@ get_mask() return 0 } + +# +# Don't waste our time with uniprocessor machines +# +check_uniproc() +{ + if [ $maxmask -eq 1 ]; then + echo "This machine has only 1 CPU." + echo "Can only set SMP affinity on multi-processor machines" + return 1; + fi + return 0 +} + + case "$1" in check) if [ $# -ne 3 ]; then @@ -109,6 +121,10 @@ case "$1" in exit 1 fi + if ! check_uniproc ; then + exit 1 + fi + if ! get_irqnum $2 ; then exit 1 fi @@ -124,6 +140,11 @@ case "$1" in print_usage exit 1 fi + + if ! check_uniproc ; then + exit 1 + fi + if ! get_irqnum $2 ; then exit 1 fi @@ -149,7 +170,7 @@ case "$1" in exit 1 fi - echo $DEFAULT_MASK > /proc/irq/$irqnum/smp_affinity + echo $maxmaskhex > /proc/irq/$irqnum/smp_affinity if [ $? -ne 0 ]; then echo "Couldn't assign smp_affinity. Exit status: $?" exit 1 diff --git a/src/check_tmpl.c b/src/check_tmpl.c index 8be1a7f..cbb9aa1 100644 --- a/src/check_tmpl.c +++ b/src/check_tmpl.c @@ -1,5 +1,8 @@ +#define _ISOC99_SOURCE #include <stdlib.h> #include <stdio.h> +#include <string.h> +#include <ctype.h> #include "cli_val.h" diff --git a/src/cli_new.c b/src/cli_new.c index 353babd..1ecbe83 100644 --- a/src/cli_new.c +++ b/src/cli_new.c @@ -745,11 +745,12 @@ int char2val(vtw_def *def, char *value, valstruct *valp) if (!token) return 0; if (token != EOL) { + fprintf(out_stream, "\"%s\" is not a valid value\n", value); print_msg("Badly formed value in %s\n", m_path.path + m_path.print_offset); if (token == VALUE) my_free(get_cli_value_ptr()->val); - return 0; + return -1; } } return 0; diff --git a/src/cli_val.l b/src/cli_val.l index 5856cea..c24a6dc 100644 --- a/src/cli_val.l +++ b/src/cli_val.l @@ -1,4 +1,7 @@ %{ +#define __USE_ISOC99 +#include <limits.h> + #include "cli_val.h" #include "cli_parse.h" #include "cli_objects.h" @@ -226,6 +229,15 @@ false { } [0-9]+ { + long long int cval = 0; + char *endp = NULL; + errno = 0; + cval = strtoll(yytext, &endp, 10); + if ((errno == ERANGE && (cval == LLONG_MAX || cval == LLONG_MIN)) + || (errno != 0 && cval == 0) + || (*endp != '\0') || (cval < 0) || (cval > UINT_MAX)) { + return SYNTAX_ERROR; + } make_val_value(INT_TYPE); return VALUE; } diff --git a/templates/interfaces/ethernet/node.tag/smp_affinity/node.def b/templates/interfaces/ethernet/node.tag/smp_affinity/node.def index edc78de..850d1c1 100644 --- a/templates/interfaces/ethernet/node.tag/smp_affinity/node.def +++ b/templates/interfaces/ethernet/node.tag/smp_affinity/node.def @@ -19,4 +19,4 @@ syntax:expression: exec "/opt/vyatta/sbin/vyatta-irqaffin check $VAR(../@) $VAR( create:expression: "sudo /opt/vyatta/sbin/vyatta-irqaffin set $VAR(../@) $VAR(@)"; "Error setting CPU affinity mask $VAR(@) on interface $VAR(../@)" -delete:expression: "sudo /opt/vyatta/sbin/vyatta-irqaffin reset (../@)"; "Error deleting CPU affinity mask on interface $VAR(../@)" +delete:expression: "sudo /opt/vyatta/sbin/vyatta-irqaffin reset $VAR(../@)"; "Error deleting CPU affinity mask on interface $VAR(../@)" |