From 79eb089b0d3463823f0a1fba1376842e3eb8aa47 Mon Sep 17 00:00:00 2001 From: Bob Gilligan Date: Tue, 26 Feb 2008 16:51:45 -0800 Subject: Bugfix: 2653 Only allow setting SMP affinity on multiprocessor machines. --- scripts/vyatta-irqaffin | 47 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 13 deletions(-) (limited to 'scripts') 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 -- cgit v1.2.3 From 4c75d7d54d28d1af48b9ae07fe0889c5386c7c44 Mon Sep 17 00:00:00 2001 From: An-Cheng Huang Date: Thu, 28 Feb 2008 17:32:15 -0800 Subject: fix for bug 2912: direct config loading output to syslog. --- debian/control | 1 + scripts/vyatta-config-loader.pl | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'scripts') 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/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; -- cgit v1.2.3