Artyom A Anikeev

addbr and addipcmd done

Showing 1 changed file with 37 additions and 8 deletions
... ... @@ -27,7 +27,7 @@ newconfig_open() {
newconfig_write() {
LINE="$1"; shift;
[[ $NEWCONFIG -eq 0 ]] && return
[[ "$NEWCONFIG" -eq 0 ]] && return
echo "$LINE" >> "$NEWCONFIG_TMPPATH"
}
... ... @@ -108,7 +108,7 @@ CMD="$1"; shift;
NEWCONFIG=0
case "$CMD" in
add1qif)
add1qif) #allow to add slave interface in bonding
NEWCONFIG=1 # we need to update the config after the command
NEW_D1Q_IFACE="$1"; shift
... ... @@ -139,7 +139,7 @@ case "$CMD" in
eval "${SLAVES_VARIABLE}[\${#${SLAVES_VARIABLE}}]=\"$NEW_SLAVE\""
;;
addbrif)
addbrif) #allow to add bridge/vlan in bonding
NEWCONFIG=1 # we need to update the config after the command
NEW_D1Q_IFACE="$1"; shift
... ... @@ -176,7 +176,7 @@ case "$CMD" in
fi
done
VLAN_N_BRIDGE_VARIABLE="${D1Q_IFACE}_VLAN_N_BRIDGES"
VLAN_N_BRIDGE_VARIABLE="${NEW_D1Q_IFACE}_VLAN_N_BRIDGES"
VLAN_N_BRIDGE_VARIABLE="${VLAN_N_BRIDGE_VARIABLE//[.]/_}"
eval "${VLAN_N_BRIDGE_VARIABLE}[\${#${VLAN_N_BRIDGE_VARIABLE}}]=\"$NEW_VLAN_N_BRIDGE\""
... ... @@ -184,14 +184,43 @@ case "$CMD" in
#D1Q_IFACES[ ${#D1Q_IFACES}]
;;
addbrifstale)
addbr) #allow to add bridge without interfaces
NEWCONFIG=1 # we need to update the config after the command
NEW_D1Q_IFACE="$1"; shift
NEW_BRIDGE="$1"; shift
VLAN_N_BRIDGE_VARIABLE="${NEW_D1Q_IFACE}_VLAN_N_BRIDGES"
VLAN_N_BRIDGE_VARIABLE="${VLAN_N_BRIDGE_VARIABLE//[.]/_}"
eval "${VLAN_N_BRIDGE_VARIABLE}[\${#${VLAN_N_BRIDGE_VARIABLE}}]=\":${NEW_BRIDGE}\""
;;
addipcmd) #allow to add ip commnds for bridges/vlans
NEWCONFIG=1 # we need to update the config after the command
NEW_BRIDGE="$1"; shift
[[ -z $NEW_BRIDGE ]] && NEW_VLAN_N_BRIDGE="${NEW_VLAN_SUBVLAN}" || NEW_VLAN_N_BRIDGE="${NEW_VLAN_SUBVLAN}:${NEW_BRIDGE}"
NEW_IP_CMD="$@"
parse_vlan_subvlan_bridge "${NEW_VLAN_N_BRIDGE}"
if [[ "${BRNAME}" != "" ]]; then
# Getting commands for "ip"
IP_CMDS_VARIABLE="${BRNAME//[.]/_}_IP"
IP_CMDS_VARIABLE="${IP_CMDS_VARIABLE}"
eval "${IP_CMDS_VARIABLE}[\${#${IP_CMDS_VARIABLE}}]=\"$NEW_IP_CMD\""
fi
BRNAME="$1"; shift
SLAVE="$1"; shift
#ADDRMASK="$1"; shift
#GW="$1"; shift
# TODO: implement this
#bond0_SLAVES[ ${#bond0_SLAVES[@]} ]="eth2"
#bond0_SLAVES[ ${#bond0_SLAVES
#[@]} ]="eth2"
;;
fix)
#brctl addif bond0 eth2
... ...