summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorslioch <slioch@eng-140.vyatta.com>2009-05-21 17:12:27 -0700
committerslioch <slioch@eng-140.vyatta.com>2009-05-21 17:12:27 -0700
commit6532ac36bd6b6590edbffc725d7d2fe75dab2c7d (patch)
tree48fadc7b732983f9abb6b882af58cafaca52edcf
parent81218208adb11e2a8e32b90ede20554cad23c45a (diff)
parent613b7e3b36684e92cb7765b03bb4706a6caed98b (diff)
downloadvyatta-cfg-6532ac36bd6b6590edbffc725d7d2fe75dab2c7d.tar.gz
vyatta-cfg-6532ac36bd6b6590edbffc725d7d2fe75dab2c7d.zip
Merge branch 'jenner' of http://git.vyatta.com/vyatta-cfg into jenner
-rw-r--r--debian/changelog31
-rwxr-xr-xlib/Vyatta/Interface.pm1
-rwxr-xr-xscripts/vyatta-cfg-cmd-wrapper2
-rwxr-xr-xscripts/vyatta-interfaces.pl16
-rwxr-xr-xscripts/vyatta-irqaffin63
-rw-r--r--templates/interfaces/ethernet/node.tag/disable/node.def7
-rw-r--r--templates/interfaces/ethernet/node.tag/vif/node.def16
7 files changed, 94 insertions, 42 deletions
diff --git a/debian/changelog b/debian/changelog
index 1c8429a..39a1ea4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,34 @@
+vyatta-cfg (0.14.83) unstable; urgency=low
+
+ * Add wireless device to table
+ * Allow creating vlan on disabled device
+ * Add script option to check if interface is up
+ * Only bring up VIF if real device is up
+
+ -- Stephen Hemminger <stephen.hemminger@vyatta.com> Thu, 21 May 2009 10:40:00 -0700
+
+vyatta-cfg (0.14.82) unstable; urgency=low
+
+ * Use the default_smp_affinity /proc file if it is available.
+
+ -- Bob Gilligan <gilligan@vyatta.com> Wed, 20 May 2009 16:41:25 -0700
+
+vyatta-cfg (0.14.81) unstable; urgency=low
+
+ [ slioch ]
+ * merge option added to load script. "load [configfile] --merge" adds
+ configuration to current
+ * root node support on load merge operation. additional work needed
+ for deeper merge path support
+ * now explicit root merge works up to first multinode with explicit
+ path
+ * notes on arbitrary root node loading in merge operations.
+
+ [ Bob Gilligan ]
+ * Bugfix 4427: Handle multiqueue NICs.
+
+ -- Bob Gilligan <gilligan@vyatta.com> Wed, 20 May 2009 16:21:53 -0700
+
vyatta-cfg (0.14.80) unstable; urgency=low
[ Stephen Hemminger ]
diff --git a/lib/Vyatta/Interface.pm b/lib/Vyatta/Interface.pm
index 50eacfa..d81497b 100755
--- a/lib/Vyatta/Interface.pm
+++ b/lib/Vyatta/Interface.pm
@@ -75,6 +75,7 @@ my %net_prefix = (
'wlm[\d]+' => { path => 'wireless-modem' },
'peth[\d]+' => { path => 'pseudo-ethernet',
vif => 'vif', },
+ 'wlan[\d]+' => { path => 'wireless', vif => 'vif' },
);
# get list of interface types
diff --git a/scripts/vyatta-cfg-cmd-wrapper b/scripts/vyatta-cfg-cmd-wrapper
index cf10fc5..d1b70d5 100755
--- a/scripts/vyatta-cfg-cmd-wrapper
+++ b/scripts/vyatta-cfg-cmd-wrapper
@@ -66,7 +66,7 @@ case "$1" in
rm -rf ${VYATTA_CONFIG_TMP}
rm -rf ${VYATTA_TEMP_CONFIG_DIR}
;;
- cleanup)
+ cleanup|discard)
sudo umount ${VYATTA_TEMP_CONFIG_DIR}
rm -rf $VYATTA_CHANGES_ONLY_DIR/* $VYATTA_CHANGES_ONLY_DIR/.modified
sudo mount -t $UNIONFS -o dirs=${VYATTA_CHANGES_ONLY_DIR}=rw:${VYATTA_ACTIVE_CONFIGURATION_DIR}=ro $UNIONFS ${VYATTA_TEMP_CONFIG_DIR}
diff --git a/scripts/vyatta-interfaces.pl b/scripts/vyatta-interfaces.pl
index d0d8fa1..3e5beaa 100755
--- a/scripts/vyatta-interfaces.pl
+++ b/scripts/vyatta-interfaces.pl
@@ -48,7 +48,8 @@ use warnings;
my $dhcp_daemon = '/sbin/dhclient';
my ($eth_update, $eth_delete, $addr, $dev, $mac, $mac_update, $op_dhclient);
-my ($check_name, $show_names, $intf_cli_path, $vif_name, $warn_name, $show_path);
+my ($check_name, $show_names, $intf_cli_path, $vif_name, $warn_name);
+my ($check_up, $show_path);
sub usage {
print "Usage: $0 --dev=<interface> --check=<type>\n";
@@ -58,6 +59,7 @@ sub usage {
print " $0 --dev=<interface> --eth-addr-delete=<aa:aa:aa:aa:aa:aa>\n";
print " $0 --dev=<interface> --valid-addr={<a.b.c.d>|dhcp}\n";
print " $0 --dev=<interface> --path\n";
+ print " $0 --dev=<interface> --isup\n";
print " $0 --show=<type>\n";
exit 1;
}
@@ -74,6 +76,7 @@ GetOptions("eth-addr-update=s" => \$eth_update,
"vif=s" => \$vif_name,
"warn" => \$warn_name,
"path" => \$show_path,
+ "isup" => \$check_up,
) or usage();
update_eth_addrs($eth_update, $dev) if ($eth_update);
@@ -86,6 +89,7 @@ is_valid_name($check_name, $dev) if ($check_name);
exists_name($dev) if ($warn_name);
show_interfaces($show_names) if ($show_names);
show_config_path($dev) if ($show_path);
+is_up($dev) if ($check_up);
exit 0;
sub is_ip_configured {
@@ -106,6 +110,16 @@ sub is_ip_duplicate {
return is_ip_configured($intf, $ip);
}
+sub is_up {
+ my $name = shift;
+ my $intf = new Vyatta::Interface($name);
+
+ die "Unknown interface type for $name" unless $intf;
+
+ exit 0 if ($intf->up());
+ exit 1;
+}
+
sub touch {
my $file = shift;
my $t = time;
diff --git a/scripts/vyatta-irqaffin b/scripts/vyatta-irqaffin
index 1959a30..1286130 100755
--- a/scripts/vyatta-irqaffin
+++ b/scripts/vyatta-irqaffin
@@ -21,14 +21,18 @@
# Provides sub-commands to:
# - Check the validity of an interface name and affinity mask value
-# - Set the affinity mask to the IRQ being used by an interface
-# - Reset the affinity mask of the IRQ being used by an interface to the
+# - Set the affinity mask to the IRQs being used by an interface
+# - Reset the affinity mask of the IRQs being used by an interface to the
# system default value of all-ones.
-# - Print the affinity mask of the IRQ being used by an interface
+# - Print the affinity mask of the IRQs being used by an interface
+#
+# If the NIC in question supports multiple IRQs, the "set" sub-command
+# sets all IRQs to the same mask. The "print" sub-command displays
+# the mask of each IRQ individually.
#
-# Max number of hex characters in an IRQ affinity mask. Support up to 16 CPUs.
-MAX_MASK=4
+# Max number of hex characters in an IRQ affinity mask. Support up to 64 CPUs.
+MAX_MASK=16
# Set up some global values...
numcpus=`grep -c -e "^processor" /proc/cpuinfo`
@@ -45,10 +49,10 @@ print_usage()
echo -e "\t$0 print <ifname>"
}
-get_irqnum()
+get_irqnums()
{
- irqnum=`cat /sys/class/net/$1/device/irq`
- if [ -z "$irqnum" ]; then
+ irqnums=`grep $1 /proc/interrupts | awk -F ': ' '{ print $1 }'`
+ if [ -z "$irqnums" ]; then
echo "Invalid interface name: $1"
return 1
fi
@@ -118,7 +122,7 @@ case "$1" in
exit 1
fi
- if ! get_irqnum $2 ; then
+ if ! get_irqnums $2 ; then
exit 1
fi
@@ -138,7 +142,7 @@ case "$1" in
exit 1
fi
- if ! get_irqnum $2 ; then
+ if ! get_irqnums $2 ; then
exit 1
fi
@@ -146,7 +150,9 @@ case "$1" in
exit 1
fi
- echo $mask > /proc/irq/$irqnum/smp_affinity
+ for irqnum in $irqnums ; do
+ echo $mask > /proc/irq/$irqnum/smp_affinity
+ done
if [ $? -ne 0 ]; then
echo "Couldn't assign smp_affinity. Exit status: $?"
@@ -159,15 +165,23 @@ case "$1" in
print_usage
exit 1
fi
- if ! get_irqnum $2 ; then
+ if ! get_irqnums $2 ; then
exit 1
fi
- echo $maxmaskhex > /proc/irq/$irqnum/smp_affinity
- if [ $? -ne 0 ]; then
- echo "Couldn't assign smp_affinity. Exit status: $?"
- exit 1
+ if [ -e /proc/irq/default_smp_affinity ]; then
+ defmask=`cat /proc/irq/default_smp_affinity`
+ else
+ defmask=$maxmaskhex
fi
+
+ for irqnum in $irqnums ; do
+ echo $defmask > /proc/irq/$irqnum/smp_affinity
+ if [ $? -ne 0 ]; then
+ echo "Couldn't assign smp_affinity for IRQ $irqnum. Exit status: $?"
+ exit 1
+ fi
+ done
;;
@@ -176,19 +190,20 @@ case "$1" in
print_usage
exit 1
fi
- if ! get_irqnum $2 ; then
+ if ! get_irqnums $2 ; then
exit 1
fi
- mask=`cat /proc/irq/$irqnum/smp_affinity`
+ for irqnum in $irqnums ; do
+ mask=`cat /proc/irq/$irqnum/smp_affinity`
- if [ -z $mask ]; then
- echo "Couldn't get smp_affinity for interface $2, irq $irqnum"
- exit 1
- fi
+ if [ -z $mask ]; then
+ echo "Couldn't get smp_affinity for interface $2, irq $irqnum"
+ exit 1
+ fi
- echo "Interface $2 is using IRQ: $irqnum"
- echo "SMP affinity mask for IRQ $irqnum is: $mask"
+ echo "Interface: $2 IRQ: $irqnum Mask: $mask"
+ done
;;
*)
diff --git a/templates/interfaces/ethernet/node.tag/disable/node.def b/templates/interfaces/ethernet/node.tag/disable/node.def
index 3d3ffef..ad03336 100644
--- a/templates/interfaces/ethernet/node.tag/disable/node.def
+++ b/templates/interfaces/ethernet/node.tag/disable/node.def
@@ -1,10 +1,5 @@
help: Set interface disabled
-create: vif=`/opt/vyatta/sbin/vyatta-interfaces.pl --vif=$VAR(../@) --show=all`
- if [ ! -z "$vif" ]; then
- echo "Can not disable interface " $VAR(../@) " with vif:" $vif
- exit 1
- fi
- /etc/netplug/linkdown.d/dhclient $VAR(../@)
+create: /etc/netplug/linkdown.d/dhclient $VAR(../@)
if ! sudo ip link set $VAR(../@) down 2>/dev/null; then
echo "Error disabling dev $VAR(../@)"
/etc/netplug/linkup.d/dhclient $VAR(../@)
diff --git a/templates/interfaces/ethernet/node.tag/vif/node.def b/templates/interfaces/ethernet/node.tag/vif/node.def
index bca6307..dabfa56 100644
--- a/templates/interfaces/ethernet/node.tag/vif/node.def
+++ b/templates/interfaces/ethernet/node.tag/vif/node.def
@@ -2,19 +2,15 @@ tag:
type: u32
help: Set Virtual Local Area Network (VLAN) ID
syntax:expression: $VAR(@) >= 0 && $VAR(@) <= 4094; "VLAN ID must be between 0 and 4094"
-create: read flags < /sys/class/net/$VAR(../@)/flags
- if [ $(( flags & 1 )) -eq 0 ]
+create: if ! sudo ip link add link $VAR(../@) name "$VAR(../@).$VAR(@)" type vlan id $VAR(@)
+ then echo "Error creating VLAN device $VAR(../@).$VAR(@)"
+ exit 1
+ fi
+ if /opt/vyatta/sbin/vyatta-interfaces.pl --dev=$VAR(../@) --isup
then
- echo "Can not create VLAN on disabled interface: " $VAR(../@)
- exit 1
+ sudo ip link set "$VAR(../@).$VAR(@)" up
fi
- sudo ip link add link $VAR(../@) name "$VAR(../@).$VAR(@)" type vlan id $VAR(@) || exit 1
- sudo ip link set "$VAR(../@).$VAR(@)" up
/opt/vyatta/sbin/vyatta-link-detect "$VAR(../@).$VAR(@)" on
delete: sudo ip link delete dev "$VAR(../@).$VAR(@)" type vlan id $VAR(@)
comp_help: possible completions:
<0-4094> Set VLAN ID
-
-
-
-