diff options
author | Stig Thormodsrud <stig@vyatta.com> | 2009-03-12 17:32:16 -0700 |
---|---|---|
committer | Stig Thormodsrud <stig@vyatta.com> | 2009-03-12 17:32:16 -0700 |
commit | d47c3861fd89e7d0e9af02f2f649e29526d41781 (patch) | |
tree | 40418acf708edfca612357f998059509217812f1 | |
parent | 7471b6fe77e8e3272f442af27e9204eda478257b (diff) | |
parent | 4cce3bd5cf88ac8b4e0dd2f330689d2379a76ee6 (diff) | |
download | vyatta-cfg-d47c3861fd89e7d0e9af02f2f649e29526d41781.tar.gz vyatta-cfg-d47c3861fd89e7d0e9af02f2f649e29526d41781.zip |
Merge branch 'jenner' of http://git.vyatta.com/vyatta-cfg into jenner
-rw-r--r-- | debian/changelog | 15 | ||||
-rw-r--r-- | src/cli_val.h | 6 | ||||
-rw-r--r-- | src/commit2.c | 8 | ||||
-rw-r--r-- | src/common/unionfs.c | 15 | ||||
-rw-r--r-- | templates/interfaces/ethernet/node.tag/disable/node.def | 7 | ||||
-rw-r--r-- | templates/interfaces/ethernet/node.tag/vif/node.def | 12 | ||||
-rw-r--r-- | templates/interfaces/loopback/node.def | 2 |
7 files changed, 45 insertions, 20 deletions
diff --git a/debian/changelog b/debian/changelog index eabcbb7..8506c4d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,16 @@ +vyatta-cfg (0.14.42) unstable; urgency=low + + * Disable creating vlan on disabled interface + * fix email in changelog + * Block disabling interface with VIF + * Fix warnings from redefining TRUE + * Fix compiler warnings in commit2 + * Fix compiler warnings in unionfs + * Fix vif delete + * Fix argument to show-interfaces to find vif + + -- Stephen Hemminger <stephen.hemminger@vyatta.com> Wed, 11 Mar 2009 21:35:45 -0700 + vyatta-cfg (0.14.41) unstable; urgency=low [ slioch ] @@ -283,7 +296,7 @@ vyatta-cfg (0.14.13) unstable; urgency=low * Add new option for checking name validity * Remove script for vyatta-cfg-reload - -- Stephen Hemminger <shemminger@debian> Wed, 11 Feb 2009 21:54:57 -0800 + -- Stephen Hemminger <shemminger@vyatta.com> Wed, 11 Feb 2009 21:54:57 -0800 vyatta-cfg (0.14.12) unstable; urgency=low diff --git a/src/cli_val.h b/src/cli_val.h index a753c92..e8fbe83 100644 --- a/src/cli_val.h +++ b/src/cli_val.h @@ -4,8 +4,12 @@ #define BITWISE 0 /* no partial commit */ #define boolean int -#define TRUE 1 +#ifndef FALSE #define FALSE 0 +#endif +#ifndef TRUE +#define TRUE (!FALSE) +#endif /* allocation unit for vals in valstruct */ #define MULTI_ALLOC 5 /* we have room if cnt%MULTI_ALLOC != 0 */ diff --git a/src/commit2.c b/src/commit2.c index e6b63fa..bf5957d 100644 --- a/src/commit2.c +++ b/src/commit2.c @@ -2,16 +2,18 @@ #include <stdlib.h> #include <unistd.h> #include <syslog.h> +#include <string.h> #include <sys/time.h> #include <glib-2.0/glib.h> #include "common/common.h" +#include "cli_path_utils.h" boolean g_debug = FALSE; boolean g_display_error_node = FALSE; boolean g_coverage = FALSE; boolean g_dump_trans = FALSE; -int ActionOrder[top_act] = { +const int ActionOrder[top_act] = { 4, 5, 6, @@ -24,7 +26,7 @@ int ActionOrder[top_act] = { -char* ActionNames[top_act] = { +const char* ActionNames[top_act] = { "delete", //0 "create", //1 "activate", //2 @@ -81,7 +83,7 @@ also, the algorithm for collapsing the tree into a transaction list is: * **/ void -usage() +usage(void) { printf("commit2\n"); printf("\t-d\t\tdebug mode\n"); diff --git a/src/common/unionfs.c b/src/common/unionfs.c index 7c29ad1..5e90c0c 100644 --- a/src/common/unionfs.c +++ b/src/common/unionfs.c @@ -43,6 +43,9 @@ copy_func(GNode *node, gpointer data); static gboolean delete_func(GNode *node, gpointer data); +static void +piecewise_copy(GNode *root_node, boolean test_mode); + /** * * @@ -528,14 +531,6 @@ common_commit_copy_to_live_config(GNode *node, boolean test_mode) static const char format1[]="cp -r -f %s/* %s"; /*mdirp, tmpp*/ static const char format2[]="sudo umount %s"; //mdirp - - static const char format4[]="rm -rf %s/{.*,*} >&/dev/null ; /bin/true"; /*cdirp*/ - - //walk up tree until diverge or skip - static const char format6[]="cp -rf %s/* -t %s";/*tmpp, adirp*/ - - static const char format7[]="rm -fr %s >&/dev/null ; /bin/true"; /*tmpp*/ - static const char format8[]="sudo mount -t unionfs -o dirs=%s=rw:%s=ro unionfs %s"; //cdirp, adirp, mdirp set_echo(TRUE); @@ -991,7 +986,7 @@ struct SrcDst { /** * **/ -void +static void piecewise_copy(GNode *root_node, boolean test_mode) { struct SrcDst sd; @@ -1046,7 +1041,7 @@ copy_func(GNode *node, gpointer data) //this is for the case where it is set by default, then unset at the node--i.e. no longer a default value. if (((struct VyattaNode*)(node->data))->_config._multi == FALSE) { //only for leaf char *parent_path = ((struct VyattaNode*)(node->parent->data))->_data._path; - sprintf(command,clear_def,sd->_dst,parent_path,sd->_dst,parent_path); + sprintf(command,clear_def,sd->_dst,parent_path); if (g_debug) { printf("%s\n",command); fflush(NULL); diff --git a/templates/interfaces/ethernet/node.tag/disable/node.def b/templates/interfaces/ethernet/node.tag/disable/node.def index 90dd582..3d3ffef 100644 --- a/templates/interfaces/ethernet/node.tag/disable/node.def +++ b/templates/interfaces/ethernet/node.tag/disable/node.def @@ -1,5 +1,10 @@ help: Set interface disabled -update: /etc/netplug/linkdown.d/dhclient $VAR(../@) +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(../@) 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 e496a7c..bca6307 100644 --- a/templates/interfaces/ethernet/node.tag/vif/node.def +++ b/templates/interfaces/ethernet/node.tag/vif/node.def @@ -2,10 +2,16 @@ 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: sudo ip link add link $VAR(../@) name "$VAR(../@).$VAR(@)" type vlan id $VAR(@) - sudo ip link set "$VAR(../@).$VAR(@)" up +create: read flags < /sys/class/net/$VAR(../@)/flags + if [ $(( flags & 1 )) -eq 0 ] + then + echo "Can not create VLAN on disabled interface: " $VAR(../@) + exit 1 + 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 "$VAR(../@).$VAR(@)" type vlan id $VAR(@) +delete: sudo ip link delete dev "$VAR(../@).$VAR(@)" type vlan id $VAR(@) comp_help: possible completions: <0-4094> Set VLAN ID diff --git a/templates/interfaces/loopback/node.def b/templates/interfaces/loopback/node.def index 690dc39..7351a8e 100644 --- a/templates/interfaces/loopback/node.def +++ b/templates/interfaces/loopback/node.def @@ -4,4 +4,4 @@ help: Set loopback interface syntax:expression: exec \ "/opt/vyatta/sbin/vyatta-interfaces.pl --dev=$VAR(@) --check=loopback" allowed: /opt/vyatta/sbin/vyatta-interfaces.pl --show=loopback -update: sudo ip link set $VAR(@) up +create: sudo ip link set $VAR(@) up |