cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wid...@apache.org
Subject [15/59] [abbrv] Move the system vm to a separate maven project.
Date Wed, 25 Sep 2013 10:29:10 GMT
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6c261042/patches/systemvm/debian/config/etc/vpcdnsmasq.conf
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/etc/vpcdnsmasq.conf b/patches/systemvm/debian/config/etc/vpcdnsmasq.conf
deleted file mode 100644
index 3622d0e..0000000
--- a/patches/systemvm/debian/config/etc/vpcdnsmasq.conf
+++ /dev/null
@@ -1,462 +0,0 @@
-# Configuration file for dnsmasq.
-#
-# Format is one option per line, legal options are the same
-# as the long options legal on the command line. See
-# "/usr/sbin/dnsmasq --help" or "man 8 dnsmasq" for details.
-
-# The following two options make you a better netizen, since they
-# tell dnsmasq to filter out queries which the public DNS cannot
-# answer, and which load the servers (especially the root servers)
-# uneccessarily. If you have a dial-on-demand link they also stop
-# these requests from bringing up the link uneccessarily.
-
-# Never forward plain names (without a dot or domain part)
-domain-needed
-# Never forward addresses in the non-routed address spaces.
-bogus-priv
-
-
-# Uncomment this to filter useless windows-originated DNS requests
-# which can trigger dial-on-demand links needlessly.
-# Note that (amongst other things) this blocks all SRV requests,
-# so don't use it if you use eg Kerberos.
-# This option only affects forwarding, SRV records originating for
-# dnsmasq (via srv-host= lines) are not suppressed by it.
-#filterwin2k
-
-# Change this line if you want dns to get its upstream servers from
-# somewhere other that /etc/resolv.conf
-resolv-file=/etc/dnsmasq-resolv.conf
-
-# By  default,  dnsmasq  will  send queries to any of the upstream
-# servers it knows about and tries to favour servers to are  known
-# to  be  up.  Uncommenting this forces dnsmasq to try each query
-# with  each  server  strictly  in  the  order  they   appear   in
-# /etc/resolv.conf
-#strict-order
-
-# If you don't want dnsmasq to read /etc/resolv.conf or any other
-# file, getting its servers from this file instead (see below), then
-# uncomment this.
-#no-resolv
-
-# If you don't want dnsmasq to poll /etc/resolv.conf or other resolv
-# files for changes and re-read them then uncomment this.
-#no-poll
-
-# Add other name servers here, with domain specs if they are for
-# non-public domains.
-#server=/localnet/192.168.0.1
-
-# Example of routing PTR queries to nameservers: this will send all 
-# address->name queries for 192.168.3/24 to nameserver 10.1.2.3
-#server=/3.168.192.in-addr.arpa/10.1.2.3
-
-# Add local-only domains here, queries in these domains are answered
-# from /etc/hosts or DHCP only.
-local=/2.vmops-test.vmops.com/
-
-# Add domains which you want to force to an IP address here.
-# The example below send any host in doubleclick.net to a local
-# webserver.
-#address=/doubleclick.net/127.0.0.1
-
-# If you want dnsmasq to change uid and gid to something other
-# than the default, edit the following lines.
-#user=
-#group=
-
-# If you want dnsmasq to listen for DHCP and DNS requests only on
-# specified interfaces (and the loopback) give the name of the
-# interface (eg eth0) here.
-# Repeat the line for more than one interface.
-#interface=eth0
-
-# Or you can specify which interface _not_ to listen on
-except-interface=lo
-
-# Or which to listen on by address (remember to include 127.0.0.1 if
-# you use this.)
-#listen-address=
-# If you want dnsmasq to provide only DNS service on an interface,
-# configure it as shown above, and then use the following line to
-# disable DHCP on it.
-#no-dhcp-interface=eth1
-
-# On systems which support it, dnsmasq binds the wildcard address,
-# even when it is listening on only some interfaces. It then discards
-# requests that it shouldn't reply to. This has the advantage of
-# working even when interfaces come and go and change address. If you
-# want dnsmasq to really bind only the interfaces it is listening on,
-# uncomment this option. About the only time you may need this is when
-# running another nameserver on the same machine.
-bind-interfaces
-
-# If you don't want dnsmasq to read /etc/hosts, uncomment the
-# following line.
-#no-hosts
-# or if you want it to read another file, as well as /etc/hosts, use
-# this.
-#addn-hosts=/etc/banner_add_hosts
-
-# Set this (and domain: see below) if you want to have a domain
-# automatically added to simple names in a hosts-file.
-expand-hosts
-
-# Set the domain for dnsmasq. this is optional, but if it is set, it
-# does the following things.
-# 1) Allows DHCP hosts to have fully qualified domain names, as long
-#     as the domain part matches this setting.
-# 2) Sets the "domain" DHCP option thereby potentially setting the
-#    domain of all systems configured by DHCP
-# 3) Provides the domain part for "expand-hosts"
-#domain=2.vmops-test.vmops.com
-
-# Uncomment this to enable the integrated DHCP server, you need
-# to supply the range of addresses available for lease and optionally
-# a lease time. If you have more than one network, you will need to
-# repeat this for each network on which you want to supply DHCP
-# service.
-#dhcp-range=10.1.1.1,static
-#dhcp-range=10.0.0.1,10.255.255.255
-#dhcp-hostsfile=/etc/dhcphosts.txt
-
-# This is an example of a DHCP range where the netmask is given. This
-# is needed for networks we reach the dnsmasq DHCP server via a relay
-# agent. If you don't know what a DHCP relay agent is, you probably
-# don't need to worry about this.
-#dhcp-range=192.168.0.50,192.168.0.150,255.255.255.0,12h
-
-# This is an example of a DHCP range with a network-id, so that
-# some DHCP options may be set only for this network.
-#dhcp-range=red,192.168.0.50,192.168.0.150
-
-# Supply parameters for specified hosts using DHCP. There are lots
-# of valid alternatives, so we will give examples of each. Note that
-# IP addresses DO NOT have to be in the range given above, they just
-# need to be on the same network. The order of the parameters in these
-# do not matter, it's permissble to give name,adddress and MAC in any order
-
-# Always allocate the host with ethernet address 11:22:33:44:55:66
-# The IP address 192.168.0.60
-#dhcp-host=11:22:33:44:55:66,192.168.0.60
-
-# Always set the name of the host with hardware address
-# 11:22:33:44:55:66 to be "fred"
-#dhcp-host=11:22:33:44:55:66,fred
-
-# Always give the host with ethernet address 11:22:33:44:55:66
-# the name fred and IP address 192.168.0.60 and lease time 45 minutes
-#dhcp-host=11:22:33:44:55:66,fred,192.168.0.60,45m
-
-# Give the machine which says it's name is "bert" IP address
-# 192.168.0.70 and an infinite lease
-#dhcp-host=bert,192.168.0.70,infinite
-
-# Always give the host with client identifier 01:02:02:04
-# the IP address 192.168.0.60
-#dhcp-host=id:01:02:02:04,192.168.0.60
-
-# Always give the host with client identifier "marjorie"
-# the IP address 192.168.0.60
-#dhcp-host=id:marjorie,192.168.0.60
-
-# Enable the address given for "judge" in /etc/hosts
-# to be given to a machine presenting the name "judge" when
-# it asks for a DHCP lease.
-#dhcp-host=judge
-
-# Never offer DHCP service to a machine whose ethernet
-# address is 11:22:33:44:55:66
-#dhcp-host=11:22:33:44:55:66,ignore
-
-# Ignore any client-id presented by the machine with ethernet
-# address 11:22:33:44:55:66. This is useful to prevent a machine
-# being treated differently when running under different OS's or
-# between PXE boot and OS boot.
-#dhcp-host=11:22:33:44:55:66,id:*
-
-# Send extra options which are tagged as "red" to
-# the machine with ethernet address 11:22:33:44:55:66
-#dhcp-host=11:22:33:44:55:66,net:red
-
-# Send extra options which are tagged as "red" to
-# any machine with ethernet address starting 11:22:33:
-#dhcp-host=11:22:33:*:*:*,net:red
-
-# Ignore any clients which are specified in dhcp-host lines
-# or /etc/ethers. Equivalent to ISC "deny unkown-clients".
-# This relies on the special "known" tag which is set when 
-# a host is matched.
-#dhcp-ignore=#known
-
-# Send extra options which are tagged as "red" to any machine whose
-# DHCP vendorclass string includes the substring "Linux"
-#dhcp-vendorclass=red,Linux
-
-# Send extra options which are tagged as "red" to any machine one
-# of whose DHCP userclass strings includes the substring "accounts"
-#dhcp-userclass=red,accounts
-
-# Send extra options which are tagged as "red" to any machine whose
-# MAC address matches the pattern.
-#dhcp-mac=red,00:60:8C:*:*:*
-
-# If this line is uncommented, dnsmasq will read /etc/ethers and act
-# on the ethernet-address/IP pairs found there just as if they had
-# been given as --dhcp-host options. Useful if you keep
-# MAC-address/host mappings there for other purposes.
-#read-ethers
-
-# Send options to hosts which ask for a DHCP lease.
-# See RFC 2132 for details of available options.
-# Common options can be given to dnsmasq by name: 
-# run "dnsmasq --help dhcp" to get a list.
-# Note that all the common settings, such as netmask and
-# broadcast address, DNS server and default route, are given
-# sane defaults by dnsmasq. You very likely will not need 
-# any dhcp-options. If you use Windows clients and Samba, there
-# are some options which are recommended, they are detailed at the
-# end of this section.
-
-# Override the default route supplied by dnsmasq, which assumes the
-# router is the same machine as the one running dnsmasq.
-#dhcp-option=3,1.2.3.4
-
-# Do the same thing, but using the option name
-#dhcp-option=option:router,1.2.3.4
-
-# Override the default route supplied by dnsmasq and send no default
-# route at all. Note that this only works for the options sent by
-# default (1, 3, 6, 12, 28) the same line will send a zero-length option 
-# for all other option numbers.
-#dhcp-option=3
-
-# Set the NTP time server addresses to 192.168.0.4 and 10.10.0.5
-#dhcp-option=option:ntp-server,192.168.0.4,10.10.0.5
-
-# Set the NTP time server address to be the same machine as
-# is running dnsmasq
-#dhcp-option=42,0.0.0.0
-
-# Set the NIS domain name to "welly"
-#dhcp-option=40,welly
-
-# Set the default time-to-live to 50
-#dhcp-option=23,50
-
-# Set the "all subnets are local" flag
-#dhcp-option=27,1
-
-# Set the domain
-dhcp-option=15,"2.vmops-test.vmops.com"
-
-# Send the etherboot magic flag and then etherboot options (a string).
-#dhcp-option=128,e4:45:74:68:00:00
-#dhcp-option=129,NIC=eepro100
-
-# Specify an option which will only be sent to the "red" network
-# (see dhcp-range for the declaration of the "red" network)
-# Note that the net: part must precede the option: part.
-#dhcp-option = net:red, option:ntp-server, 192.168.1.1
-
-# The following DHCP options set up dnsmasq in the same way as is specified
-# for the ISC dhcpcd in
-# http://www.samba.org/samba/ftp/docs/textdocs/DHCP-Server-Configuration.txt
-# adapted for a typical dnsmasq installation where the host running
-# dnsmasq is also the host running samba.
-# you may want to uncomment them if you use Windows clients and Samba.
-#dhcp-option=19,0           # option ip-forwarding off
-#dhcp-option=44,0.0.0.0     # set netbios-over-TCP/IP nameserver(s) aka WINS server(s)
-#dhcp-option=45,0.0.0.0     # netbios datagram distribution server
-#dhcp-option=46,8           # netbios node type
-#dhcp-option=47             # empty netbios scope.
-
-# Send RFC-3397 DNS domain search DHCP option. WARNING: Your DHCP client
-# probably doesn't support this......
-#dhcp-option=option:domain-search,eng.apple.com,marketing.apple.com
-
-# Send RFC-3442 classless static routes (note the netmask encoding)
-#dhcp-option=121,192.168.1.0/24,1.2.3.4,10.0.0.0/8,5.6.7.8
-
-# Send vendor-class specific options encapsulated in DHCP option 43. 
-# The meaning of the options is defined by the vendor-class so
-# options are sent only when the client supplied vendor class
-# matches the class given here. (A substring match is OK, so "MSFT" 
-# matches "MSFT" and "MSFT 5.0"). This example sets the
-# mtftp address to 0.0.0.0 for PXEClients.
-#dhcp-option=vendor:PXEClient,1,0.0.0.0
-
-# Send microsoft-specific option to tell windows to release the DHCP lease
-# when it shuts down. Note the "i" flag, to tell dnsmasq to send the
-# value as a four-byte integer - that's what microsoft wants. See
-# http://technet2.microsoft.com/WindowsServer/en/library/a70f1bb7-d2d4-49f0-96d6-4b7414ecfaae1033.mspx?mfr=true
-dhcp-option=vendor:MSFT,2,1i
-
-# Send the Encapsulated-vendor-class ID needed by some configurations of
-# Etherboot to allow is to recognise the DHCP server.
-#dhcp-option=vendor:Etherboot,60,"Etherboot"
-
-# Send options to PXELinux. Note that we need to send the options even
-# though they don't appear in the parameter request list, so we need
-# to use dhcp-option-force here. 
-# See http://syslinux.zytor.com/pxe.php#special for details.
-# Magic number - needed before anything else is recognised
-#dhcp-option-force=208,f1:00:74:7e
-# Configuration file name
-#dhcp-option-force=209,configs/common
-# Path prefix
-#dhcp-option-force=210,/tftpboot/pxelinux/files/
-# Reboot time. (Note 'i' to send 32-bit value)
-#dhcp-option-force=211,30i
-
-# Set the boot filename for BOOTP. You will only need 
-# this is you want to boot machines over the network and you will need
-# a TFTP server; either dnsmasq's built in TFTP server or an
-# external one. (See below for how to enable the TFTP server.)
-#dhcp-boot=pxelinux.0
-
-# Enable dnsmasq's built-in TFTP server
-#enable-tftp
-
-# Set the root directory for files availble via FTP.
-#tftp-root=/var/ftpd
-
-# Make the TFTP server more secure: with this set, only files owned by
-# the user dnsmasq is running as will be send over the net.
-#tftp-secure
-
-# Set the boot file name only when the "red" tag is set.
-#dhcp-boot=net:red,pxelinux.red-net
-
-# An example of dhcp-boot with an external server: the name and IP
-# address of the server are given after the filename.
-#dhcp-boot=/var/ftpd/pxelinux.0,boothost,192.168.0.3
-
-# Set the limit on DHCP leases, the default is 150
-#dhcp-lease-max=150
-
-# The DHCP server needs somewhere on disk to keep its lease database.
-# This defaults to a sane location, but if you want to change it, use
-# the line below.
-#dhcp-leasefile=/var/lib/misc/dnsmasq.leases
-leasefile-ro
-
-# Set the DHCP server to authoritative mode. In this mode it will barge in
-# and take over the lease for any client which broadcasts on the network,
-# whether it has a record of the lease or not. This avoids long timeouts
-# when a machine wakes up on a new network. DO NOT enable this if there's
-# the slighest chance that you might end up accidentally configuring a DHCP
-# server for your campus/company accidentally. The ISC server uses
-# the same option, and this URL provides more information:
-# http://www.isc.org/index.pl?/sw/dhcp/authoritative.php
-#dhcp-authoritative
-
-# Run an executable when a DHCP lease is created or destroyed.
-# The arguments sent to the script are "add" or "del", 
-# then the MAC address, the IP address and finally the hostname
-# if there is one. 
-#dhcp-script=/bin/echo
-
-# Set the cachesize here.
-#cache-size=150
-
-# If you want to disable negative caching, uncomment this.
-#no-negcache
-
-# Normally responses which come form /etc/hosts and the DHCP lease
-# file have Time-To-Live set as zero, which conventionally means
-# do not cache further. If you are happy to trade lower load on the
-# server for potentially stale date, you can set a time-to-live (in
-# seconds) here.
-#local-ttl=
-
-# If you want dnsmasq to detect attempts by Verisign to send queries
-# to unregistered .com and .net hosts to its sitefinder service and
-# have dnsmasq instead return the correct NXDOMAIN response, uncomment
-# this line. You can add similar lines to do the same for other
-# registries which have implemented wildcard A records.
-#bogus-nxdomain=64.94.110.11
-
-# If you want to fix up DNS results from upstream servers, use the
-# alias option. This only works for IPv4.
-# This alias makes a result of 1.2.3.4 appear as 5.6.7.8
-#alias=1.2.3.4,5.6.7.8
-# and this maps 1.2.3.x to 5.6.7.x
-#alias=1.2.3.0,5.6.7.0,255.255.255.0
-
-
-# Change these lines if you want dnsmasq to serve MX records.
-
-# Return an MX record named "maildomain.com" with target
-# servermachine.com and preference 50
-#mx-host=maildomain.com,servermachine.com,50
-
-# Set the default target for MX records created using the localmx option.
-#mx-target=servermachine.com
-
-# Return an MX record pointing to the mx-target for all local
-# machines.
-#localmx
-
-# Return an MX record pointing to itself for all local machines.
-#selfmx
-
-# Change the following lines if you want dnsmasq to serve SRV
-# records.  These are useful if you want to serve ldap requests for
-# Active Directory and other windows-originated DNS requests.
-# See RFC 2782.
-# You may add multiple srv-host lines.
-# The fields are <name>,<target>,<port>,<priority>,<weight>
-# If the domain part if missing from the name (so that is just has the
-# service and protocol sections) then the domain given by the domain=
-# config option is used. (Note that expand-hosts does not need to be
-# set for this to work.)
-
-# A SRV record sending LDAP for the example.com domain to
-# ldapserver.example.com port 289
-#srv-host=_ldap._tcp.example.com,ldapserver.example.com,389
-
-# A SRV record sending LDAP for the example.com domain to
-# ldapserver.example.com port 289 (using domain=)
-###domain=example.com
-#srv-host=_ldap._tcp,ldapserver.example.com,389
-
-# Two SRV records for LDAP, each with different priorities
-#srv-host=_ldap._tcp.example.com,ldapserver.example.com,389,1
-#srv-host=_ldap._tcp.example.com,ldapserver.example.com,389,2
-
-# A SRV record indicating that there is no LDAP server for the domain
-# example.com
-#srv-host=_ldap._tcp.example.com
-
-# The following line shows how to make dnsmasq serve an arbitrary PTR
-# record. This is useful for DNS-SD. (Note that the
-# domain-name expansion done for SRV records _does_not
-# occur for PTR records.)
-#ptr-record=_http._tcp.dns-sd-services,"New Employee Page._http._tcp.dns-sd-services"
-
-# Change the following lines to enable dnsmasq to serve TXT records.
-# These are used for things like SPF and zeroconf. (Note that the
-# domain-name expansion done for SRV records _does_not
-# occur for TXT records.)
-
-#Example SPF.
-#txt-record=example.com,"v=spf1 a -all"
-
-#Example zeroconf
-#txt-record=_http._tcp.example.com,name=value,paper=A4
-
-
-# For debugging purposes, log each DNS query as it passes through
-# dnsmasq.
-#log-queries
-
-# Log lots of extra information about DHCP transactions.
-#log-dhcp
-
-log-facility=/var/log/dnsmasq.log
-
-# Include a another lot of configuration options.
-#conf-file=/etc/dnsmasq.more.conf
-conf-dir=/etc/dnsmasq.d

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6c261042/patches/systemvm/debian/config/opt/cloud/bin/checkbatchs2svpn.sh
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/opt/cloud/bin/checkbatchs2svpn.sh b/patches/systemvm/debian/config/opt/cloud/bin/checkbatchs2svpn.sh
deleted file mode 100755
index 80e3213..0000000
--- a/patches/systemvm/debian/config/opt/cloud/bin/checkbatchs2svpn.sh
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/bash
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-for i in $*
-do
-    info=`/opt/cloud/bin/checks2svpn.sh $i`
-    ret=$?
-    echo -n "$i:$ret:$info&"
-done
-

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6c261042/patches/systemvm/debian/config/opt/cloud/bin/checks2svpn.sh
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/opt/cloud/bin/checks2svpn.sh b/patches/systemvm/debian/config/opt/cloud/bin/checks2svpn.sh
deleted file mode 100755
index 59ab426..0000000
--- a/patches/systemvm/debian/config/opt/cloud/bin/checks2svpn.sh
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/bin/bash
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-if [ -z $1 ]
-then
-    echo "Fail to find VPN peer address!"
-    exit 1
-fi
-
-ipsec auto --status | grep vpn-$1 > /tmp/vpn-$1.status
-
-cat /tmp/vpn-$1.status | grep "ISAKMP SA established" > /dev/null
-isakmpok=$?
-if [ $isakmpok -ne 0 ]
-then
-    echo -n "ISAKMP SA NOT found but checking IPsec;"
-else
-    echo -n "ISAKMP SA found;"
-fi
-
-cat /tmp/vpn-$1.status | grep "IPsec SA established" > /dev/null
-ipsecok=$?
-if [ $ipsecok -ne 0 ]
-then
-    echo -n "IPsec SA not found;"
-    echo "Site-to-site VPN have not connected"
-    exit 11
-fi
-echo -n "IPsec SA found;"
-echo "Site-to-site VPN have connected"
-exit 0

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6c261042/patches/systemvm/debian/config/opt/cloud/bin/cloud-nic.sh
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/opt/cloud/bin/cloud-nic.sh b/patches/systemvm/debian/config/opt/cloud/bin/cloud-nic.sh
deleted file mode 100755
index 871b789..0000000
--- a/patches/systemvm/debian/config/opt/cloud/bin/cloud-nic.sh
+++ /dev/null
@@ -1,80 +0,0 @@
-#!/usr/bin/env bash
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-plug_nic() {
-  sudo echo "$tableNo $tableName" >> /etc/iproute2/rt_tables 2>/dev/null
-  sudo ip rule add fwmark $tableNo table $tableName 2>/dev/null
-  sudo ip route flush table $tableName
-  sudo ip route flush cache
-}
-
-
-unplug_nic() {
-  sudo iptables -t mangle -D PREROUTING -i $dev -m state --state NEW -j CONNMARK --set-mark $tableNo 2>/dev/null
-
-  sudo ip rule del fwmark $tableNo 2>/dev/null
-  sudo ip route flush table $tableName
-  sudo sed -i /"$tableNo $tableName"/d /etc/iproute2/rt_tables 2>/dev/null
-  sudo ip route flush cache
-  # remove network usage rules
-  sudo iptables -F NETWORK_STATS_$dev 2>/dev/null
-  iptables-save | grep NETWORK_STATS_$dev | grep "\-A"  | while read rule
-  do
-    rule=$(echo $rule | sed 's/\-A/\-D/')
-    sudo iptables $rule
-  done
-  sudo iptables -X NETWORK_STATS_$dev 2>/dev/null
-  # remove vpn network usage rules
-  sudo iptables -t mangle -F VPN_STATS_$dev 2>/dev/null
-  iptables-save -t mangle | grep VPN_STATS_$dev | grep "\-A"  | while read rule
-  do
-    rule=$(echo $rule | sed 's/\-A/\-D/')
-    sudo iptables -t mangle $rule
-  done
-  sudo iptables -t mangle -X VPN_STATS_$dev 2>/dev/null  
-  # remove rules on this dev
-  iptables-save -t mangle | grep $dev | grep "\-A"  | while read rule
-  do
-    rule=$(echo $rule | sed 's/\-A/\-D/')
-    sudo iptables -t mangle $rule
-  done
-  iptables-save -t nat | grep $dev | grep "\-A"  | while read rule
-  do
-    rule=$(echo $rule | sed 's/\-A/\-D/')
-    sudo iptables -t nat $rule
-  done
-  iptables-save | grep $dev | grep "\-A"  | while read rule
-  do
-    rule=$(echo $rule | sed 's/\-A/\-D/')
-    sudo iptables $rule
-  done
-  # remove apache config for this eth
-  rm -f /etc/apache2/conf.d/vhost$dev.conf
-}
-
-action=$1
-dev=$2
-tableNo=${dev:3}
-tableName="Table_$dev"
-
-if [ $action == 'add' ]
-then
-  plug_nic
-else
-  unplug_nic
-fi

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6c261042/patches/systemvm/debian/config/opt/cloud/bin/get_template_version.sh
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/opt/cloud/bin/get_template_version.sh b/patches/systemvm/debian/config/opt/cloud/bin/get_template_version.sh
deleted file mode 100755
index 233ec98..0000000
--- a/patches/systemvm/debian/config/opt/cloud/bin/get_template_version.sh
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/bin/bash
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# As the last command send to router before any rules operation, wait until boot up done
-
-__TIMEOUT=60
-__FLAGFILE=/var/cache/cloud/boot_up_done
-done=0
-for i in `seq 1 $(($__TIMEOUT * 10))`
-do
-    if [ -e $__FLAGFILE ]
-    then
-        done=1
-        break
-    fi
-    sleep 0.1
-    if [ $((i % 10)) -eq 0 ]
-    then
-        logger -t cloud "Waiting for VM boot up done for one second"
-    fi
-done
-
-if [ -z $done ]
-then
-    # declare we failed booting process
-    echo "Waited 60 seconds but boot up haven't been completed"
-    exit
-fi
-
-echo -n `cat /etc/cloudstack-release`'&'
-cat /var/cache/cloud/cloud-scripts-signature

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6c261042/patches/systemvm/debian/config/opt/cloud/bin/ilb.sh
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/opt/cloud/bin/ilb.sh b/patches/systemvm/debian/config/opt/cloud/bin/ilb.sh
deleted file mode 100755
index 2a29892..0000000
--- a/patches/systemvm/debian/config/opt/cloud/bin/ilb.sh
+++ /dev/null
@@ -1,211 +0,0 @@
-#!/usr/bin/env bash
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-source /root/func.sh
-
-lock="biglock"
-locked=$(getLockFile $lock)
-if [ "$locked" != "1" ]
-then
-    exit 1
-fi
-
-usage() {
-  printf "Usage: %s:  -a <added public ip address ip:port> -d <removed ip:port> -f <load balancer config> -s <stats ip ip:port:cidr>  \n" $(basename $0) >&2
-}
-
-#set -x
-
-fw_remove_backup() {
-  logger -t cloud "$(basename $0): Entering fw_remove_backup"
-  local lb_vif_list=eth0
-  for vif in $lb_vif_list; do 
-    sudo iptables -F back_load_balancer_$vif 2> /dev/null
-    sudo iptables -D INPUT -i $vif -p tcp  -j back_load_balancer_$vif 2> /dev/null
-    sudo iptables -X back_load_balancer_$vif 2> /dev/null
-  done
-  sudo iptables -F back_lb_stats 2> /dev/null
-  sudo iptables -D INPUT -p tcp  -j back_lb_stats 2> /dev/null
-  sudo iptables -X back_lb_stats 2> /dev/null
-}
-
-fw_restore() {
-  logger -t cloud "$(basename $0): Entering fw_restore"
-  local lb_vif_list="eth0"
-  for vif in $lb_vif_list; do 
-    sudo iptables -F load_balancer_$vif 2> /dev/null
-    sudo iptables -D INPUT -i $vif -p tcp  -j load_balancer_$vif 2> /dev/null
-    sudo iptables -X load_balancer_$vif 2> /dev/null
-    sudo iptables -E back_load_balancer_$vif load_balancer_$vif 2> /dev/null
-  done
-  sudo iptables -F lb_stats 2> /dev/null
-  sudo iptables -D INPUT -p tcp  -j lb_stats 2> /dev/null
-  sudo iptables -X lb_stats 2> /dev/null
-  sudo iptables -E back_lb_stats lb_stats 2> /dev/null
-}
-
-# firewall entry to ensure that haproxy can receive on specified port
-fw_entry() {
-  logger -t cloud "$(basename $0): Entering fw_entry"
-  local added=$1
-  local removed=$2
-  local stats=$3
-  
-  if [ "$added" == "none" ]
-  then
-  	added=""
-  fi
-  
-  if [ "$removed" == "none" ]
-  then
-  	removed=""
-  fi
-  
-  local a=$(echo $added | cut -d, -f1- --output-delimiter=" ")
-  local r=$(echo $removed | cut -d, -f1- --output-delimiter=" ")
-
-# back up the iptable rules by renaming before creating new. 
-  local lb_vif_list=eth0
-  for vif in $lb_vif_list; do 
-    sudo iptables -E load_balancer_$vif back_load_balancer_$vif 2> /dev/null
-    sudo iptables -N load_balancer_$vif 2> /dev/null
-    sudo iptables -A INPUT -i $vif -p tcp  -j load_balancer_$vif
-  done
-  sudo iptables -E lb_stats back_lb_stats 2> /dev/null
-  sudo iptables -N lb_stats 2> /dev/null
-  sudo iptables -A INPUT  -p tcp  -j lb_stats
-
-  for i in $a
-  do
-    local pubIp=$(echo $i | cut -d: -f1)
-    local dport=$(echo $i | cut -d: -f2)    
-    local lb_vif_list="eth0"
-    for vif in $lb_vif_list; do 
-      sudo iptables -A load_balancer_$vif  -p tcp -d $pubIp --dport $dport -j ACCEPT
-      if [ $? -gt 0 ]
-      then
-        return 1
-      fi
-    done      
-  done
-  local pubIp=$(echo $stats | cut -d: -f1)
-  local dport=$(echo $stats | cut -d: -f2)    
-  local cidrs=$(echo $stats | cut -d: -f3 | sed 's/-/,/')
-  sudo iptables -A lb_stats -s $cidrs -p tcp -m state --state NEW -d $pubIp --dport $dport -j ACCEPT
- 
-  return 0
-}
-
-#Hot reconfigure HA Proxy in the routing domain
-reconfig_lb() {
-  /root/reconfigLB.sh
-  return $?
-}
-
-# Restore the HA Proxy to its previous state, and revert iptables rules on loadbalancer
-restore_lb() {
-  logger -t cloud "Restoring HA Proxy to previous state"
-  # Copy the old version of haproxy.cfg into the file that reconfigLB.sh uses
-  cp /etc/haproxy/haproxy.cfg.old /etc/haproxy/haproxy.cfg.new
-   
-  if [ $? -eq 0 ]
-  then
-    # Run reconfigLB.sh again
-    /root/reconfigLB.sh
-  fi
-}
-
-
-logger -t cloud "$(basename $0): Entering $(dirname $0)/$(basename $0)"
-
-iflag=
-aflag=
-dflag=
-sflag=
-
-while getopts 'i:a:d:s:' OPTION
-do
-  case $OPTION in
-  i)	iflag=1
-		domRIp="$OPTARG" #unused but passed in
-		;;
-  a)	aflag=1
-		addedIps="$OPTARG"
-		;;
-  d)	dflag=1
-		removedIps="$OPTARG"
-		;;
-
-  s)	sflag=1
-		statsIp="$OPTARG"
-		;;
-  ?)	usage
-                unlock_exit 2 $lock $locked
-		;;
-  esac
-done
-
-if [[ "$aflag$dflag" != "1" && "$aflag$dflag" != "11" ]]
-then
-   usage
-   unlock_exit 2 $lock $locked
-fi
-
-if [ "$addedIps" == "" ]
-then
-  addedIps="none"
-fi
-
-
-if [ "$removedIps" == "" ]
-then
-  removedIps="none"
-fi
-
-
-# hot reconfigure haproxy
-reconfig_lb $cfgfile
-
-if [ $? -gt 0 ]
-then
-  logger -t cloud "Reconfiguring ilb failed"
-  unlock_exit 1 $lock $locked
-fi
-
-logger -t cloud "HAProxy reconfigured successfully, configuring firewall"
-
-# iptables entry to ensure that haproxy receives traffic
-fw_entry $addedIps $removedIps $statsIp
-  	
-if [ $? -gt 0 ]
-then
-  logger -t cloud "Failed to apply firewall rules for internal load balancing, reverting HA Proxy config"
-  # Restore the LB
-  restore_lb
-
-  logger -t cloud "Reverting firewall config"
-  fw_restore
-
-  unlock_exit 1 $lock $locked
-else
-  # Remove backedup iptable rules
-  logger -t cloud "Firewall configured successfully, deleting backup firewall config"
-  fw_remove_backup
-fi
- 
-unlock_exit 0 $lock $locked

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6c261042/patches/systemvm/debian/config/opt/cloud/bin/ipassoc.sh
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/opt/cloud/bin/ipassoc.sh b/patches/systemvm/debian/config/opt/cloud/bin/ipassoc.sh
deleted file mode 100755
index ae2d7e4..0000000
--- a/patches/systemvm/debian/config/opt/cloud/bin/ipassoc.sh
+++ /dev/null
@@ -1,443 +0,0 @@
-#!/usr/bin/env bash
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
- 
-
-# $Id: ipassoc.sh 9804 2010-06-22 18:36:49Z alex $ $HeadURL: svn://svn.lab.vmops.com/repos/vmdev/java/scripts/network/domr/ipassoc.sh $
-# ipassoc.sh -- associate/disassociate a public ip with an instance
-# @VERSION@
-
-source /root/func.sh
-
-lock="biglock"
-locked=$(getLockFile $lock)
-if [ "$locked" != "1" ]
-then
-    exit 1
-fi
-
-usage() {
-  printf "Usage:\n %s -A    -l <public-ip-address>   -c <dev> [-f] \n" $(basename $0) >&2
-  printf " %s -D  -l <public-ip-address>  -c <dev> [-f] \n" $(basename $0) >&2
-}
-
-add_fw_chain_for_ip () {
-  local pubIp=$(echo $1 | awk -F'/' '{print $1}')
-  if sudo iptables -t mangle -N FIREWALL_$pubIp &> /dev/null
-  then
-    logger -t cloud "$(basename $0): created firewall chain for $pubIp"
-    sudo iptables -t mangle -A FIREWALL_$pubIp -j DROP> /dev/null
-    #ensure outgoing connections are maintained (first rule in chain)
-    sudo iptables -t mangle -I FIREWALL_$pubIp -m state --state RELATED,ESTABLISHED -j ACCEPT> /dev/null
-    #ensure that this table is after VPN chain
-    sudo iptables -t mangle -I PREROUTING 2 -d $pubIp -j FIREWALL_$pubIp
-    return $?
-  fi
-  logger -t cloud "$(basename $0): firewall chain for $pubIp already exists"
-}
-
-add_vpn_chain_for_ip () {
-  local pubIp=$(echo $1 | awk -F'/' '{print $1}')
-  if sudo iptables -t mangle -N VPN_$pubIp &> /dev/null
-  then
-    logger -t cloud "$(basename $0): created VPN chain for $pubIp"
-    #ensure outgoing connections are maintained (first rule in chain)
-    sudo iptables -t mangle -I VPN_$pubIp -m state --state RELATED,ESTABLISHED -j ACCEPT
-    sudo iptables -t mangle -A VPN_$pubIp -j RETURN
-    #ensure that this table is the first
-    sudo iptables -t mangle -I PREROUTING 1 -d $pubIp -j VPN_$pubIp
-    return $?
-  fi
-  logger -t cloud "$(basename $0): VPN chain for $pubIp already exists"
-}
-
-del_fw_chain_for_ip () {
-  local pubIp=$(echo $1 | awk -F'/' '{print $1}')
-  if ! sudo iptables -t mangle -N FIREWALL_$pubIp &> /dev/null
-  then
-    logger -t cloud "$(basename $0): destroying firewall chain for $pubIp"
-    sudo iptables -t mangle -D PREROUTING  -d $pubIp -j FIREWALL_$pubIp
-    sudo iptables -t mangle -F FIREWALL_$pubIp
-    sudo iptables -t mangle -X FIREWALL_$pubIp 
-    return $?
-  fi
-  # firewall chain got created as a result of testing for the chain, cleanup
-  sudo iptables -t mangle -F FIREWALL_$pubIp
-  sudo iptables -t mangle -X FIREWALL_$pubIp
-  logger -t cloud "$(basename $0): firewall chain did not exist for $pubIp, cleaned up"
-}
-
-del_vpn_chain_for_ip () {
-  local pubIp=$(echo $1 | awk -F'/' '{print $1}')
-  if ! sudo iptables -t mangle -N VPN_$pubIp &> /dev/null
-  then
-    logger -t cloud "$(basename $0): destroying vpn chain for $pubIp"
-    sudo iptables -t mangle -D PREROUTING  -d $pubIp -j VPN_$pubIp
-    sudo iptables -t mangle -F VPN_$pubIp
-    sudo iptables -t mangle -X VPN_$pubIp 
-    return $?
-  fi
-  # vpn chain got created as a result of testing for the chain, cleanup
-  sudo iptables -t mangle -F VPN_$pubIp
-  sudo iptables -t mangle -X VPN_$pubIp
-  logger -t cloud "$(basename $0): vpn chain did not exist for $pubIp, cleaned up"
-}
-
-remove_routing() {
-  local pubIp=$1
-  logger -t cloud "$(basename $0):Remove routing $pubIp on interface $ethDev"
-  local ipNoMask=$(echo $pubIp | awk -F'/' '{print $1}')
-  local mask=$(echo $pubIp | awk -F'/' '{print $2}')
-  local tableNo=$(echo $ethDev | awk -F'eth' '{print $2}')
-
-  local tableName="Table_$ethDev"
-  local remainip=`ip addr show $ethDev | grep "inet "`
-  if [ "$remainip" == "" ]
-  then
-# rules and routes will be deleted for the last ip of the interface.
-     sudo ip rule delete fwmark $tableNo table $tableName
-     sudo ip rule delete table $tableName
-     sudo ip route flush  table $tableName 
-     sudo ip route flush cache
-     logger -t cloud "$(basename $0):Remove routing $pubIp - routes and rules deleted"
-  fi
-}
-
-# copy eth0,eth1 and the current public interface
-copy_routes_from_main() {
-  local tableName=$1
-
-#get the network masks from the main table
-  local eth0Mask=$(ip route list scope link dev eth0 | awk '{print $1}')
-  local eth1Mask=$(ip route list scope link dev eth1 | awk '{print $1}')
-  local ethMask=$(getcidr $ethDev)
-
-# eth0,eth1 and other know routes will be skipped, so as main routing table will decide the route. This will be useful if the interface is down and up.  
-  sudo ip route add throw $eth0Mask table $tableName proto static 
-  sudo ip route add throw $eth1Mask table $tableName proto static 
-  sudo ip route add throw $ethMask  table $tableName proto static 
-  return 0;
-}
-
-ip_addr_add() {
-  local dev="$1"
-  local ip="$2"
-  sudo ip addr add dev $dev $ip brd + > /dev/null
-
-}
-
-add_routing() {
-  local pubIp=$1
-  logger -t cloud "$(basename $0):Add routing $pubIp on interface $ethDev"
-  local ipNoMask=$(echo $1 | awk -F'/' '{print $1}')
-  local mask=$(echo $1 | awk -F'/' '{print $2}')
-
-  local tableName="Table_$ethDev"
-  local tablePresent=$(grep $tableName /etc/iproute2/rt_tables)
-  local tableNo=$(echo $ethDev | awk -F'eth' '{print $2}')
-  if [ "$tablePresent" == "" ]
-  then
-     if [ "$tableNo" == "" ]
-     then
-       return 0;
-     fi
-     sudo echo "$tableNo $tableName" >> /etc/iproute2/rt_tables
-  fi
-
-  copy_routes_from_main $tableName
-# NOTE: this  entry will be deleted if the interface is down without knowing to Management server, in that case all the outside traffic will be send through main routing table or it will be the first public NIC.
-  sudo ip route add default via $defaultGwIP table $tableName proto static
-  sudo ip route flush cache
-
-  local ethMask=$(getcidr $ethDev)
-  local rulePresent=$(ip rule show | grep $ethMask)
-  if [ "$rulePresent" == "" ]
-  then
-# rules will be added while adding the first ip of the interface 
-     sudo ip rule add from $ethMask table $tableName
-     sudo ip rule add fwmark $tableNo table $tableName
-     logger -t cloud "$(basename $0):Add routing $pubIp rules added"
-  fi
-  return 0;
-}
-add_snat() {
-  local pubIp=$1
-  local ipNoMask=$(echo $1 | awk -F'/' '{print $1}')
-  if [ "$sflag" == "0" ]
-  then
-    logger -t cloud "$(basename $0):Remove SourceNAT $pubIp on interface $ethDev if it is present"
-    sudo iptables -t nat -D POSTROUTING   -j SNAT -o $ethDev --to-source $ipNoMask ;
-    return 0;
-  fi
-
-  logger -t cloud "$(basename $0):Added SourceNAT $pubIp on interface $ethDev"
-  sudo iptables -t nat -D POSTROUTING   -j SNAT -o $ethDev --to-source $ipNoMask ;
-  sudo iptables -t nat -A POSTROUTING   -j SNAT -o $ethDev --to-source $ipNoMask ;
-  return $?
-}
-remove_snat() {
-  if [ "$sflag" == "0" ]
-  then
-    return 0;
-  fi
-
-  local pubIp=$1
-  logger -t cloud "$(basename $0):Removing SourceNAT $pubIp on interface $ethDev"
-  sudo iptables -t nat -D POSTROUTING   -j SNAT -o $ethDev --to-source $ipNoMask;
-  return $?
-}
-add_first_ip() {
-  local pubIp=$1
-  logger -t cloud "$(basename $0):Adding first ip $pubIp on interface $ethDev"
-  local ipNoMask=$(echo $1 | awk -F'/' '{print $1}')
-  local mask=$(echo $1 | awk -F'/' '{print $2}')
-  sudo ip link show $ethDev | grep "state DOWN" > /dev/null
-  local old_state=$?
-  
-  ip_addr_add $ethDev $pubIp
-
-  sudo iptables -D FORWARD -i $ethDev -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
-  sudo iptables -D FORWARD -i eth0 -o $ethDev  -j FW_OUTBOUND
-  sudo iptables -A FORWARD -i $ethDev -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
-  sudo iptables -A FORWARD -i eth0 -o $ethDev  -j FW_OUTBOUND
-
-  add_snat $1
-  if [ $? -gt 0  -a $? -ne 2 ]
-  then
-     logger -t cloud "$(basename $0):Failed adding source nat entry for ip $pubIp on interface $ethDev"
-     return 1
-  fi
-
-  logger -t cloud "$(basename $0):Added first ip $pubIp on interface $ethDev"
-  if [ $if_keep_state -ne 1 -o $old_state -ne 0 ]
-  then
-      sudo ip link set $ethDev up
-      sudo arping -c 1 -I $ethDev -A -U -s $ipNoMask $ipNoMask;
-      sudo arping -c 1 -I $ethDev -A -U -s $ipNoMask $ipNoMask;
-  fi
-  add_routing $1
-
-  return 0
-}
-
-remove_first_ip() {
-  local pubIp=$1
-  logger -t cloud "$(basename $0):Removing first ip $pubIp on interface $ethDev"
-  local ipNoMask=$(echo $1 | awk -F'/' '{print $1}')
-  local mask=$(echo $1 | awk -F'/' '{print $2}')
-
-  local existingIpMask=$(sudo ip addr show dev $ethDev | grep inet | awk '{print $2}'  | grep -w $ipNoMask)
-  [ "$existingIpMask" == "" ] && return 0
-
-  [ "$mask" == "" ] && mask="32"
-
-  sudo iptables -D FORWARD -i $ethDev -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
-  sudo iptables -D FORWARD -i eth0 -o $ethDev  -j FW_OUTBOUND
-  remove_snat $1
-  
-  sudo ip addr del dev $ethDev "$ipNoMask/$mask"
-  if [ $? -gt 0  -a $? -ne 2 ]
-  then
-     remove_routing $1
-     return 1
-  fi
-  remove_routing $1
-
-  return $?
-}
-
-
-add_an_ip () {
-  local pubIp=$1
-  logger -t cloud "$(basename $0):Adding ip $pubIp on interface $ethDev"
-  local ipNoMask=$(echo $1 | awk -F'/' '{print $1}')
-  sudo ip link show $ethDev | grep "state DOWN" > /dev/null
-  local old_state=$?
-
-  ip_addr_add $ethDev $pubIp
-  add_snat $1
-  if [ $if_keep_state -ne 1 -o $old_state -ne 0 ]
-  then
-      sudo ip link set $ethDev up
-      sudo arping -c 1 -I $ethDev -A -U -s $ipNoMask $ipNoMask;
-      sudo arping -c 1 -I $ethDev -A -U -s $ipNoMask $ipNoMask;
-  fi
-  add_routing $1
-  return $?
-   
-}
-
-remove_an_ip () {
-  local pubIp=$1
-  logger -t cloud "$(basename $0):Removing ip $pubIp on interface $ethDev"
-  remove_snat $1
-  local existingIpMask=$(sudo ip addr show dev $ethDev | grep "inet " | awk '{print $2}')
-
-  sudo ip addr del dev $ethDev $pubIp
-
-  for ipMask in $existingIpMask
-  do
-    if [ "$ipMask" == "$pubIp" ]
-    then
-      continue
-    fi
-    sudo ip addr add dev $ethDev $ipMask brd +
-  done
-
-  remove_routing $1
-  return 0
-}
-
-enable_rpsrfs() {
-    #enable rps and rfs for this new interface
-    if [  -f /etc/rpsrfsenable ]
-    then
-        enable=$(cat /etc/rpsrfsenable)
-        if [ $enable -eq 1 ]
-        then
-          proc=$(cat /proc/cpuinfo | grep "processor" | wc -l)
-          if [ $proc -le 1 ]
-          then
-              return $status;
-          fi
-
-          num=1
-          num=$(($num<<$proc))
-          num=$(($num-1));
-          echo $num;
-          hex=$(printf "%x\n" $num)
-          echo $hex;
-          #enable rps
-          echo $hex > /sys/class/net/$ethDev/queues/rx-0/rps_cpus
-
-          #enable rfs
-          echo 256 > /sys/class/net/$ethDev/queues/rx-0/rps_flow_cnt
-
-         fi
-     fi
-}
-
-#set -x
-sflag=0
-lflag=
-fflag=
-cflag=
-nflag=
-op=""
-
-is_master=0
-is_redundant=0
-if_keep_state=0
-grep "redundant_router=1" /var/cache/cloud/cmdline > /dev/null
-if [ $? -eq 0 ]
-then
-    is_redundant=1
-    sudo /opt/cloud/bin/checkrouter.sh --no-lock|grep "Status: MASTER" > /dev/null 2>&1
-    if [ $? -eq 0 ]
-    then
-        is_master=1
-    fi
-fi
-if [ $is_redundant -eq 1 -a $is_master -ne 1 ]
-then
-    if_keep_state=1
-fi
-
-while getopts 'sfADna:l:c:g:' OPTION
-do
-  case $OPTION in
-  A)	Aflag=1
-		op="-A"
-		;;
-  D)	Dflag=1
-		op="-D"
-		;;
-  f)	fflag=1
-		;;
-  s)	sflag=1
-		;;
-  l)	lflag=1
-		publicIp="$OPTARG"
-		;;
-  c)	cflag=1
-  		ethDev="$OPTARG"
-  		;;
-  g)	gflag=1
-  		defaultGwIP="$OPTARG"
-  		;;
-  n)   nflag=1
-        ;;
-  ?)	usage
-                unlock_exit 2 $lock $locked
-		;;
-  esac
-done
-
-
-if [ "$Aflag$Dflag" != "1" ]
-then
-    usage
-    unlock_exit 2 $lock $locked
-fi
-
-if [ "$lflag$cflag" != "11" ] 
-then
-    usage
-    unlock_exit 2 $lock $locked
-fi
-
-
-if [ "$Aflag" == "1" ] && [ "$nflag" == "1" ]
-then
-    #enable rps, rfs for the new interface
-    enable_rpsrfs
-
- fi
-
-if [ "$fflag" == "1" ] && [ "$Aflag" == "1" ]
-then
-  add_first_ip  $publicIp  &&
-  add_vpn_chain_for_ip $publicIp &&
-  add_fw_chain_for_ip $publicIp 
-  unlock_exit $? $lock $locked
-fi
-
-if [ "$Aflag" == "1" ]
-then  
-  add_an_ip  $publicIp  &&
-  add_fw_chain_for_ip $publicIp 
-  unlock_exit $? $lock $locked
-fi
-
-if [ "$fflag" == "1" ] && [ "$Dflag" == "1" ]
-then
-  remove_first_ip  $publicIp &&
-  del_fw_chain_for_ip $publicIp &&
-  del_vpn_chain_for_ip $publicIp
-  unlock_exit $? $lock $locked
-fi
-
-if [ "$Dflag" == "1" ]
-then
-  remove_an_ip  $publicIp &&
-  del_fw_chain_for_ip $publicIp 
-  unlock_exit $? $lock $locked
-fi
-
-unlock_exit 0 $lock $locked
-

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6c261042/patches/systemvm/debian/config/opt/cloud/bin/ipsectunnel.sh
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/opt/cloud/bin/ipsectunnel.sh b/patches/systemvm/debian/config/opt/cloud/bin/ipsectunnel.sh
deleted file mode 100755
index e511a3d..0000000
--- a/patches/systemvm/debian/config/opt/cloud/bin/ipsectunnel.sh
+++ /dev/null
@@ -1,298 +0,0 @@
-#!/usr/bin/env bash
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-source /root/func.sh
-
-lock="biglock"
-locked=$(getLockFile $lock)
-if [ "$locked" != "1" ]
-then
-    exit 1
-fi
-
-vpnconfdir="/etc/ipsec.d"
-vpnoutmark="0x525"
-vpninmark="0x524"
-
-usage() {
-    printf "Usage: %s: (-A|-D) -l <left-side vpn peer> -n <left-side guest cidr> -g <left-side gateway> -r <right-side vpn peer> -N <right-side private subnets> -e <esp policy> -i <ike policy> -t <ike lifetime> -T <esp lifetime> -s <pre-shared secret> -d <dpd 0 or 1> \n" $(basename $0) >&2
-}
-
-#set -x
-
-start_ipsec() {
-  service ipsec status > /dev/null
-  if [ $? -ne 0 ]
-  then
-    service ipsec start > /dev/null
-    #Wait until ipsec started, 5 seconds at most
-    for i in {1..5}
-    do
-      logger -t cloud "$(basename $0): waiting ipsec start..."
-      service ipsec status > /dev/null
-      result=$?
-      if [ $result -eq 0 ]
-      then
-          break
-      fi
-      sleep 1
-    done
-  fi
-  service ipsec status > /dev/null
-  return $?
-}
-
-enable_iptables_subnets() {
-  for net in $rightnets
-  do
-    sudo iptables -I FORWARD -t mangle -s $leftnet -d $net -j MARK --set-mark $vpnoutmark
-    sudo iptables -A OUTPUT -t mangle -s $leftnet -d $net -j MARK --set-mark $vpnoutmark
-    sudo iptables -I FORWARD -t mangle -s $net -d $leftnet -j MARK --set-mark $vpninmark
-    sudo iptables -A INPUT -t mangle -s $net -d $leftnet -j MARK --set-mark $vpninmark
-  done
-  return 0
-}
-
-check_and_enable_iptables() {
-  sudo iptables-save | grep "A INPUT -i $outIf -p udp -m udp --dport 500 -j ACCEPT"
-  if [ $? -ne 0 ]
-  then
-      sudo iptables -A INPUT -i $outIf -p udp -m udp --dport 500 -j ACCEPT
-      sudo iptables -A INPUT -i $outIf -p udp -m udp --dport 4500 -j ACCEPT
-      sudo iptables -A INPUT -i $outIf -p 50 -j ACCEPT
-      # Prevent NAT on "marked" VPN traffic, so need to be the first one on POSTROUTING chain
-      sudo iptables -t nat -I POSTROUTING -t nat -o $outIf -m mark --mark $vpnoutmark -j ACCEPT
-  fi
-  return 0
-}
-
-disable_iptables_subnets() {
-  for net in $rightnets
-  do
-    sudo iptables -D FORWARD -t mangle -s $leftnet -d $net -j MARK --set-mark $vpnoutmark
-    sudo iptables -D OUTPUT -t mangle -s $leftnet -d $net -j MARK --set-mark $vpnoutmark
-    sudo iptables -D FORWARD -t mangle -s $net -d $leftnet -j MARK --set-mark $vpninmark
-    sudo iptables -D INPUT -t mangle -s $net -d $leftnet -j MARK --set-mark $vpninmark
-  done
-  return 0
-}
-
-check_and_disable_iptables() {
-  find $vpnconfdir -name "ipsec.vpn*.conf" | grep ipsec
-  if [ $? -ne 0 ]
-  then
-    #Nobody else use s2s vpn now, so delete the iptables rules
-    sudo iptables -D INPUT -i $outIf -p udp -m udp --dport 500 -j ACCEPT
-    sudo iptables -D INPUT -i $outIf -p udp -m udp --dport 4500 -j ACCEPT
-    sudo iptables -D INPUT -i $outIf -p 50 -j ACCEPT
-    sudo iptables -t nat -D POSTROUTING -t nat -o $outIf -m mark --mark $vpnoutmark -j ACCEPT
-  fi
-  return 0
-}
-
-ipsec_tunnel_del() {
-  disable_iptables_subnets
-  sudo ipsec auto --down vpn-$rightpeer
-  sudo ipsec auto --delete vpn-$rightpeer
-  outIp=$leftpeer
-  local vpnconffile=$vpnconfdir/ipsec.vpn-$rightpeer.conf
-  local vpnsecretsfile=$vpnconfdir/ipsec.vpn-$rightpeer.secrets
-  logger -t cloud "$(basename $0): removing configuration for ipsec tunnel to $rightpeer"
-  sudo rm -f $vpnconffile
-  sudo rm -f $vpnsecretsfile
-  sudo ipsec auto --rereadall
-  check_and_disable_iptables
-  return 0
-}
-
-ipsec_tunnel_add() {
-  #need to unify with remote access VPN
-  start_ipsec
-
-  if [ $? -ne 0 ]
-  then
-      logger -t cloud "$(basename $0): Failed to start ipsec service!"
-      return 1
-  fi
-
-  outIp=$leftpeer
-  sudo mkdir -p $vpnconfdir
-  local vpnconffile=$vpnconfdir/ipsec.vpn-$rightpeer.conf
-  local vpnsecretsfile=$vpnconfdir/ipsec.vpn-$rightpeer.secrets
-
-  logger -t cloud "$(basename $0): creating configuration for ipsec tunnel: left peer=$leftpeer \
-    left net=$leftnet left gateway=$leftgw right peer=$rightpeer right network=$rightnets phase1 policy=$ikepolicy \
-    phase2 policy=$esppolicy secret=$secret"
-
-  [ "$op" == "-A" ] && ipsec_tunnel_del
-
-  check_and_enable_iptables
-
-    sudo echo "conn vpn-$rightpeer" > $vpnconffile &&
-    sudo echo "  left=$leftpeer" >> $vpnconffile &&
-    sudo echo "  leftsubnet=$leftnet" >> $vpnconffile &&
-    sudo echo "  leftnexthop=$leftgw" >> $vpnconffile &&
-    sudo echo "  right=$rightpeer" >> $vpnconffile &&
-    sudo echo "  rightsubnets={$rightnets}" >> $vpnconffile &&
-    sudo echo "  type=tunnel" >> $vpnconffile &&
-    sudo echo "  authby=secret" >> $vpnconffile &&
-    sudo echo "  keyexchange=ike" >> $vpnconffile &&
-    sudo echo "  ike=$ikepolicy" >> $vpnconffile &&
-    sudo echo "  ikelifetime=${ikelifetime}s" >> $vpnconffile &&
-    sudo echo "  esp=$esppolicy" >> $vpnconffile &&
-    sudo echo "  salifetime=${esplifetime}s" >> $vpnconffile &&
-    sudo echo "  pfs=$pfs" >> $vpnconffile &&
-    sudo echo "  keyingtries=2" >> $vpnconffile &&
-    sudo echo "  auto=add" >> $vpnconffile &&
-    sudo echo "$leftpeer $rightpeer: PSK \"$secret\"" > $vpnsecretsfile &&
-    sudo chmod 0400 $vpnsecretsfile
-
-    if [ $dpd -ne 0 ]
-    then
-        sudo echo "  dpddelay=30" >> $vpnconffile &&
-        sudo echo "  dpdtimeout=120" >> $vpnconffile &&
-        sudo echo "  dpdaction=restart" >> $vpnconffile
-    fi
-
-    enable_iptables_subnets
-
-    sudo ipsec auto --rereadall
-    sudo ipsec auto --add vpn-$rightpeer
-    sudo ipsec auto --up vpn-$rightpeer
-
-  logger -t cloud "$(basename $0): done ipsec tunnel entry for right peer=$rightpeer right networks=$rightnets"
-
-  #5 seconds for checking if it's ready
-  for i in {1..5}
-  do
-    logger -t cloud "$(basename $0): checking connection status..."
-    /opt/cloud/bin/checks2svpn.sh $rightpeer
-    result=$?
-    if [ $result -eq 0 ]
-    then
-        break
-    fi
-    sleep 1
-  done
-  if [ $result -eq 0 ]
-  then
-    logger -t cloud "$(basename $0): connect to remote successful"
-  else
-    logger -t cloud "$(basename $0): fail to connect to remote, status code: $result"
-    logger -t cloud "$(basename $0): would stop site-to-site VPN connection"
-    ipsec_tunnel_del
-  fi
-  return $result
-}
-
-rflag=
-pflag=
-eflag=
-Eflag=
-lflag=
-iflag=
-Iflag=
-sflag=
-op=""
-
-while getopts 'ADl:n:g:r:N:e:i:t:T:s:d:' OPTION
-do
-  case $OPTION in
-  A)    opflag=1
-        op="-A"
-        ;;
-  D)    opflag=2
-        op="-D"
-        ;;
-  l)    lflag=1
-        leftpeer="$OPTARG"
-        ;;
-  n)    nflag=1
-        leftnet="$OPTARG"
-        ;;
-  g)    gflag=1
-        leftgw="$OPTARG"
-        ;;
-  r)    rflag=1
-        rightpeer="$OPTARG"
-        ;;
-  N)    Nflag=1
-        rightnets="$OPTARG"
-        ;;
-  e)    eflag=1
-        esppolicy="$OPTARG"
-        ;;
-  i)    iflag=1
-        ikepolicy="$OPTARG"
-        ;;
-  t)    tflag=1
-        ikelifetime="$OPTARG"
-        ;;
-  T)    Tflag=1
-        esplifetime="$OPTARG"
-        ;;
-  s)    sflag=1
-        secret="$OPTARG"
-        ;;
-  d)    dflag=1
-        dpd="$OPTARG"
-        ;;
-  ?)    usage
-        unlock_exit 2 $lock $locked
-        ;;
-  esac
-done
-
-logger -t cloud "$(basename $0): parameters $*"
-
-# get interface for public ip
-ip link|grep BROADCAST|grep -v eth0|cut -d ":" -f 2 > /tmp/iflist
-while read i
-do
-    ip addr show $i|grep "$leftpeer"
-    if [ $? -eq 0 ]
-    then
-        outIf=$i
-        break
-    fi
-done < /tmp/iflist
-
-rightnets=${rightnets//,/ }
-pfs="no"
-echo "$esppolicy" | grep "modp" > /dev/null
-if [ $? -eq 0 ]
-then
-    pfs="yes"
-fi
-
-ret=0
-#Firewall ports for one-to-one/static NAT
-if [ "$opflag" == "1" ]
-then
-    ipsec_tunnel_add
-    ret=$?
-elif [ "$opflag" == "2" ]
-then
-    ipsec_tunnel_del
-    ret=$?
-else
-    printf "Invalid action specified, must choose -A or -D to add/del tunnels\n" >&2
-    unlock_exit 5 $lock $locked
-fi
-
-unlock_exit $ret $lock $locked

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6c261042/patches/systemvm/debian/config/opt/cloud/bin/netusage.sh
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/opt/cloud/bin/netusage.sh b/patches/systemvm/debian/config/opt/cloud/bin/netusage.sh
deleted file mode 100755
index 10c6190..0000000
--- a/patches/systemvm/debian/config/opt/cloud/bin/netusage.sh
+++ /dev/null
@@ -1,155 +0,0 @@
-#!/usr/bin/env bash
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
- 
-
-# netusage.sh -- create iptable rules to gather network stats, running within DomR
-
-source /root/func.sh
-
-lock="biglock"
-locked=$(getLockFile $lock)
-if [ "$locked" != "1" ]
-then
-    exit 1
-fi
-
-usage() {
-  printf "Usage: %s -[c|g|r] [-[a|d] <public interface>]\n" $(basename $0)  >&2
-}
-
-create_usage_rules () {
-  iptables-save|grep "INPUT -j NETWORK_STATS" > /dev/null
-  if [ $? -eq 0 ]
-  then
-      return $?
-  fi
-  iptables -N NETWORK_STATS > /dev/null
-  iptables -I FORWARD -j NETWORK_STATS > /dev/null
-  iptables -I INPUT -j NETWORK_STATS > /dev/null
-  iptables -I OUTPUT -j NETWORK_STATS > /dev/null
-  iptables -A NETWORK_STATS -i eth0 -o eth2 > /dev/null
-  iptables -A NETWORK_STATS -i eth2 -o eth0 > /dev/null
-  iptables -A NETWORK_STATS -o eth2 ! -i eth0 -p tcp > /dev/null
-  iptables -A NETWORK_STATS -i eth2 ! -o eth0 -p tcp > /dev/null
-  return $?
-}
-
-add_public_interface () {
-  local pubIf=$1
-  iptables-save|grep "NETWORK_STATS -i eth0 -o $pubIf" > /dev/null
-  if [ $? -eq 0 ]
-  then
-      return $?
-  fi
-  iptables -A NETWORK_STATS -i eth0 -o $pubIf > /dev/null
-  iptables -A NETWORK_STATS -i $pubIf -o eth0 > /dev/null
-  iptables -A NETWORK_STATS -o $pubIf ! -i eth0 -p tcp > /dev/null
-  iptables -A NETWORK_STATS -i $pubIf ! -o eth0 -p tcp > /dev/null
-  return $?
-}
-
-delete_public_interface () {
-  local pubIf=$1
-  echo $pubIf >> /root/removedVifs
-  return $?
-}
-
-get_usage () {
-  iptables -L NETWORK_STATS -n -v -x | awk '$1 ~ /^[0-9]+$/ { printf "%s:", $2}'; > /dev/null
-  if [ -f /root/removedVifs ] ; then iptables -Z NETWORK_STATS ; fi; > /dev/null
-  /root/clearUsageRules.sh > /dev/null
-  if [ $? -gt 0  -a $? -ne 2 ]
-  then
-     printf $?
-     return 1
-  fi
-}
-
-reset_usage () {
-  iptables -Z NETWORK_STATS > /dev/null
-  if [ $? -gt 0  -a $? -ne 2 ]
-  then
-     return 1
-  fi
-}
-
-#set -x
-
-cflag=
-gflag=
-rflag=
-iflag=
-aflag=
-dflag=
-
-while getopts 'cgria:d:' OPTION
-do
-  case $OPTION in
-  c)	cflag=1
-		;;
-  g)	gflag=1
-		;;
-  r)	rflag=1
-		;;
-  a)    aflag=1
-        publicIf="$OPTARG"
-        ;;
-  d)    dflag=1
-        publicIf="$OPTARG"
-        ;;
-  i)    #Do nothing, since it's parameter for host script
-        ;;
-  ?)	usage
-                unlock_exit 2 $lock $locked
-		;;
-  esac
-done
-
-if [ "$cflag" == "1" ] 
-then
-  create_usage_rules  
-  unlock_exit $? $lock $locked
-fi
-
-if [ "$gflag" == "1" ] 
-then
-  get_usage 
-  unlock_exit $? $lock $locked
-fi
-
-if [ "$rflag" == "1" ] 
-then
-  reset_usage  
-  unlock_exit $? $lock $locked
-fi
-
-if [ "$aflag" == "1" ] 
-then
-  add_public_interface $publicIf 
-  unlock_exit $? $lock $locked
-fi
-
-if [ "$dflag" == "1" ] 
-then
-  delete_public_interface $publicIf 
-  unlock_exit $? $lock $locked
-fi
-
-unlock_exit 0 $lock $locked
-

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6c261042/patches/systemvm/debian/config/opt/cloud/bin/passwd_server
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/opt/cloud/bin/passwd_server b/patches/systemvm/debian/config/opt/cloud/bin/passwd_server
deleted file mode 100755
index 0f4a772..0000000
--- a/patches/systemvm/debian/config/opt/cloud/bin/passwd_server
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-ips=$(ip addr show dev eth0 | grep inet | grep eth0 | awk '{print $2}' ); echo $ips
-for ip in $ips; do
-	addr=$(echo $ip | awk -F'/' '{print $1}')
-	/opt/cloud/bin/passwd_server_ip $addr >> /var/log/cloud.log 2>&1 &
-done;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6c261042/patches/systemvm/debian/config/opt/cloud/bin/passwd_server_ip
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/opt/cloud/bin/passwd_server_ip b/patches/systemvm/debian/config/opt/cloud/bin/passwd_server_ip
deleted file mode 100755
index 4622860..0000000
--- a/patches/systemvm/debian/config/opt/cloud/bin/passwd_server_ip
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/bash
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-. /etc/default/cloud-passwd-srvr
-addr=$1;
-while [ "$ENABLED" == "1" ]
-do
-	socat -lf /var/log/cloud.log TCP4-LISTEN:8080,reuseaddr,fork,crnl,bind=$addr SYSTEM:"/opt/cloud/bin/serve_password.sh \"\$SOCAT_PEERADDR\""
-
-	rc=$?
-	if [ $rc -ne 0 ]
-	then
-		logger -t cloud "Password server failed with error code $rc. Restarting socat..."
-		sleep 3
-	fi
-        . /etc/default/cloud-passwd-srvr
-done

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6c261042/patches/systemvm/debian/config/opt/cloud/bin/patchsystemvm.sh
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/opt/cloud/bin/patchsystemvm.sh b/patches/systemvm/debian/config/opt/cloud/bin/patchsystemvm.sh
deleted file mode 100755
index 9cb0250..0000000
--- a/patches/systemvm/debian/config/opt/cloud/bin/patchsystemvm.sh
+++ /dev/null
@@ -1,279 +0,0 @@
-#/bin/bash
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
- 
-
-# $Id: patchsystemvm.sh 10800 2010-07-16 13:48:39Z edison $ $HeadURL: svn://svn.lab.vmops.com/repos/branches/2.1.x/java/scripts/vm/hypervisor/xenserver/prepsystemvm.sh $
-
-#set -x
-logfile="/var/log/patchsystemvm.log"
-# To use existing console proxy .zip-based package file
-patch_console_proxy() {
-   local patchfile=$1
-   rm /usr/local/cloud/systemvm -rf
-   mkdir -p /usr/local/cloud/systemvm
-   echo "All" | unzip $patchfile -d /usr/local/cloud/systemvm >$logfile 2>&1
-   find /usr/local/cloud/systemvm/ -name \*.sh | xargs chmod 555
-   return 0
-}
-
-consoleproxy_svcs() {
-   chkconfig cloud on
-   chkconfig postinit on
-   chkconfig cloud-passwd-srvr off
-   chkconfig haproxy off ;
-   chkconfig dnsmasq off
-   chkconfig ssh on
-   chkconfig apache2 off
-   chkconfig nfs-common off
-   chkconfig portmap off
-   chkconfig keepalived off
-   chkconfig conntrackd off
-   echo "cloud postinit ssh" > /var/cache/cloud/enabled_svcs
-   echo "cloud-passwd-srvr haproxy dnsmasq apache2 nfs-common portmap" > /var/cache/cloud/disabled_svcs
-   mkdir -p /var/log/cloud
-}
-
-secstorage_svcs() {
-   chkconfig cloud on
-   chkconfig postinit on
-   chkconfig cloud-passwd-srvr off
-   chkconfig haproxy off ;
-   chkconfig dnsmasq off
-   chkconfig portmap on
-   chkconfig nfs-common on
-   chkconfig ssh on
-   chkconfig apache2 off
-   chkconfig keepalived off
-   chkconfig conntrackd off
-   echo "cloud postinit ssh nfs-common portmap" > /var/cache/cloud/enabled_svcs
-   echo "cloud-passwd-srvr haproxy dnsmasq" > /var/cache/cloud/disabled_svcs
-   mkdir -p /var/log/cloud
-}
-
-routing_svcs() {
-   grep "redundant_router=1" /var/cache/cloud/cmdline > /dev/null
-   RROUTER=$?
-   chkconfig cloud off
-   chkconfig haproxy on ; 
-   chkconfig ssh on
-   chkconfig nfs-common off
-   chkconfig portmap off
-   echo "ssh haproxy apache2" > /var/cache/cloud/enabled_svcs
-   echo "cloud nfs-common portmap" > /var/cache/cloud/disabled_svcs
-   if [ $RROUTER -eq 0 ]
-   then
-       chkconfig dnsmasq off
-       chkconfig cloud-passwd-srvr off
-       chkconfig keepalived on
-       chkconfig conntrackd on
-       chkconfig postinit on
-       echo "keepalived conntrackd postinit" >> /var/cache/cloud/enabled_svcs
-       echo "dnsmasq cloud-passwd-srvr" >> /var/cache/cloud/disabled_svcs
-   else
-       chkconfig dnsmasq on
-       chkconfig cloud-passwd-srvr on
-       chkconfig keepalived off
-       chkconfig conntrackd off
-       echo "dnsmasq cloud-passwd-srvr " >> /var/cache/cloud/enabled_svcs
-       echo "keepalived conntrackd " >> /var/cache/cloud/disabled_svcs
-   fi
-}
-
-vpcrouting_svcs() {
-   chkconfig cloud off
-   chkconfig haproxy on ; 
-   chkconfig ssh on
-   chkconfig nfs-common off
-   chkconfig portmap off
-   chkconfig dnsmasq on
-   chkconfig keepalived off
-   chkconfig conntrackd off
-   chkconfig apache2 off
-   echo "ssh haproxy dnsmasq" > /var/cache/cloud/enabled_svcs
-   echo "cloud cloud-passwd-srvr apache2 nfs-common portmap keepalived conntrackd" > /var/cache/cloud/disabled_svcs
-}
-
-dhcpsrvr_svcs() {
-   chkconfig cloud off
-   chkconfig cloud-passwd-srvr on ; 
-   chkconfig haproxy off ; 
-   chkconfig dnsmasq on
-   chkconfig ssh on
-   chkconfig nfs-common off
-   chkconfig portmap off
-   chkconfig keepalived off
-   chkconfig conntrackd off
-   echo "ssh dnsmasq cloud-passwd-srvr apache2" > /var/cache/cloud/enabled_svcs
-   echo "cloud nfs-common haproxy portmap" > /var/cache/cloud/disabled_svcs
-}
-
-elbvm_svcs() {
-   chkconfig cloud off
-   chkconfig haproxy on ; 
-   chkconfig ssh on
-   chkconfig nfs-common off
-   chkconfig portmap off
-   chkconfig keepalived off
-   chkconfig conntrackd off
-   echo "ssh haproxy" > /var/cache/cloud/enabled_svcs
-   echo "cloud dnsmasq cloud-passwd-srvr apache2 nfs-common portmap" > /var/cache/cloud/disabled_svcs
-}
-
-
-ilbvm_svcs() {
-   chkconfig cloud off
-   chkconfig haproxy on ; 
-   chkconfig ssh on
-   chkconfig nfs-common off
-   chkconfig portmap off
-   chkconfig keepalived off
-   chkconfig conntrackd off
-   echo "ssh haproxy" > /var/cache/cloud/enabled_svcs
-   echo "cloud dnsmasq cloud-passwd-srvr apache2 nfs-common portmap" > /var/cache/cloud/disabled_svcs
-}
-
-enable_pcihotplug() {
-   sed -i -e "/acpiphp/d" /etc/modules
-   sed -i -e "/pci_hotplug/d" /etc/modules
-   echo acpiphp >> /etc/modules
-   echo pci_hotplug >> /etc/modules
-}
-
-enable_serial_console() {
-   sed -i -e "/^serial.*/d" /boot/grub/grub.conf
-   sed -i -e "/^terminal.*/d" /boot/grub/grub.conf
-   sed -i -e "/^default.*/a\serial --unit=0 --speed=115200 --parity=no --stop=1" /boot/grub/grub.conf
-   sed -i -e "/^serial.*/a\terminal --timeout=0 serial console" /boot/grub/grub.conf
-   sed -i -e "s/\(^kernel.* ro\) \(console.*\)/\1 console=tty0 console=ttyS0,115200n8/" /boot/grub/grub.conf
-   sed -i -e "/^s0:2345:respawn.*/d" /etc/inittab
-   sed -i -e "/6:23:respawn/a\s0:2345:respawn:/sbin/getty -L 115200 ttyS0 vt102" /etc/inittab
-}
-
-
-CMDLINE=$(cat /var/cache/cloud/cmdline)
-TYPE="router"
-PATCH_MOUNT=$1
-Hypervisor=$2
-
-for i in $CMDLINE
-  do
-    # search for foo=bar pattern and cut out foo
-    KEY=$(echo $i | cut -d= -f1)
-    VALUE=$(echo $i | cut -d= -f2)
-    case $KEY in
-      type)
-        TYPE=$VALUE
-        ;;
-      *)
-        ;;
-    esac
-done
-
-if [ "$TYPE" == "consoleproxy" ] || [ "$TYPE" == "secstorage" ]  && [ -f ${PATCH_MOUNT}/systemvm.zip ]
-then
-  patch_console_proxy ${PATCH_MOUNT}/systemvm.zip
-  if [ $? -gt 0 ]
-  then
-    printf "Failed to apply patch systemvm\n" >$logfile
-    exit 5
-  fi
-fi
-
-
-#empty known hosts
-echo "" > /root/.ssh/known_hosts
-
-if [ "$Hypervisor" == "kvm" ]
-then
-   enable_pcihotplug
-   enable_serial_console
-fi
-
-if [ "$TYPE" == "router" ] || [ "$TYPE" == "vpcrouter" ]
-then
-  routing_svcs
-  if [ $? -gt 0 ]
-  then
-    printf "Failed to execute routing_svcs\n" >$logfile
-    exit 6
-  fi
-fi
-
-if [ "$TYPE" == "vpcrouter" ]
-then
-  vpcrouting_svcs
-  if [ $? -gt 0 ]
-  then
-    printf "Failed to execute vpcrouting_svcs\n" >$logfile
-    exit 6
-  fi
-fi
-
-if [ "$TYPE" == "dhcpsrvr" ]
-then
-  dhcpsrvr_svcs
-  if [ $? -gt 0 ]
-  then
-    printf "Failed to execute dhcpsrvr_svcs\n" >$logfile
-    exit 6
-  fi
-fi
-
-
-if [ "$TYPE" == "consoleproxy" ]
-then
-  consoleproxy_svcs
-  if [ $? -gt 0 ]
-  then
-    printf "Failed to execute consoleproxy_svcs\n" >$logfile
-    exit 7
-  fi
-fi
-
-if [ "$TYPE" == "secstorage" ]
-then
-  secstorage_svcs
-  if [ $? -gt 0 ]
-  then
-    printf "Failed to execute secstorage_svcs\n" >$logfile
-    exit 8
-  fi
-fi
-
-if [ "$TYPE" == "elbvm" ]
-then
-  elbvm_svcs
-  if [ $? -gt 0 ]
-  then
-    printf "Failed to execute elbvm svcs\n" >$logfile
-    exit 9
-  fi
-fi
-
-if [ "$TYPE" == "ilbvm" ]
-then
-  ilbvm_svcs
-  if [ $? -gt 0 ]
-  then
-    printf "Failed to execute ilbvm svcs\n" >$logfile
-    exit 9
-  fi
-fi
-
-exit $?

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6c261042/patches/systemvm/debian/config/opt/cloud/bin/serve_password.sh
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/opt/cloud/bin/serve_password.sh b/patches/systemvm/debian/config/opt/cloud/bin/serve_password.sh
deleted file mode 100755
index a3a2732..0000000
--- a/patches/systemvm/debian/config/opt/cloud/bin/serve_password.sh
+++ /dev/null
@@ -1,103 +0,0 @@
-#!/bin/bash
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
- 
-
-
-# set -x 
-
-source /root/func.sh
-
-lock="passwdlock"
-locked=$(getLockFile $lock)
-if [ "$locked" != "1" ]
-then
-    exit 1
-fi
-
-PASSWD_FILE=/var/cache/cloud/passwords
-
-#   $1 filename
-#   $2 keyname
-#   $3 value
-replace_in_file() {
-  local filename=$1
-  local keyname=$2
-  local value=$3
-  sed -i /$keyname=/d $filename
-  echo "$keyname=$value" >> $filename
-  return $?
-}
-
-#   $1 filename
-#   $2 keyname
-get_value() {
-  local filename=$1
-  local keyname=$2
-  grep -i $keyname= $filename | cut -d= -f2
-}
-
-ip=$1
-
-logger -t cloud "serve_password called to service a request for $ip."
-
-while read input
-do
-	if [ "$input" == "" ]
-	then
-		break
-	fi
-
-	request=$(echo "$input" | grep "DomU_Request:" | cut -d: -f2 | sed 's/^[ \t]*//')
-
-	if [ "$request" != "" ]
-	then
-		break
-	fi
-done
-
-# echo -e \"\\\"HTTP/1.0 200 OK\\\nDocumentType: text/plain\\\n\\\n\\\"\"; 
-
-if [ "$request" == "send_my_password" ]
-then
-	password=$(get_value $PASSWD_FILE $ip)
-	if [ "$password" == "" ]
-	then
-		logger -t cloud "serve_password sent bad_request to $ip."
-		# echo "bad_request"
-                # Return "saved_password" for non-existed entry, to make it
-                # work if domR was once destroyed.
-		echo "saved_password"
-	else
-		logger -t cloud "serve_password sent a password to $ip."
-		echo $password
-	fi
-else
-	if [ "$request" == "saved_password" ]
-	then
-		replace_in_file $PASSWD_FILE $ip "saved_password"
-		logger -t cloud "serve_password sent saved_password to $ip."
-		echo "saved_password"
-	else
-		logger -t cloud "serve_password sent bad_request to $ip."
-		echo "bad_request"
-	fi
-fi
-
-# echo -e \"\\\"\\\n\\\"\"
-
-unlock_exit 0 $lock $locked

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6c261042/patches/systemvm/debian/config/opt/cloud/bin/vmdata.py
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/opt/cloud/bin/vmdata.py b/patches/systemvm/debian/config/opt/cloud/bin/vmdata.py
deleted file mode 100755
index f508032..0000000
--- a/patches/systemvm/debian/config/opt/cloud/bin/vmdata.py
+++ /dev/null
@@ -1,204 +0,0 @@
-#!/usr/bin/python
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-import sys, getopt, json, os, base64
-from fcntl import flock, LOCK_EX, LOCK_UN
-
-
-def main(argv):
-    fpath =  ''
-    b64data = ''
-
-    try:
-        opts, args = getopt.getopt(argv,"f:d:")
-    except getopt.GetoptError:
-        print 'params: -f <filename> -d <b64jsondata>'
-        sys.exit(2)
-    for opt, arg in opts:
-        if opt == '-f':
-            fpath = arg
-        elif opt == '-d':
-            b64data = arg
-
-    json_data = ''
-    if fpath != '':
-        fh = open(fpath, 'r')
-        json_data = json.loads(fh.read())
-    elif b64data != '':
-        json_data = json.loads(base64.b64decode(b64data))
-    else:
-        print '-f <filename> or -d <b64jsondata> required'
-        sys.exit(2)
-
-    for ip in json_data:
-        for item in json_data[ip]:
-            folder = item[0]
-            file   = item[1]
-            data   = item[2]
-
-            # process only valid data
-            if folder != "userdata" and folder != "metadata":
-                continue
-
-            if file == "":
-                continue
-
-            htaccess(ip, folder, file)
-
-            if data == "":
-                deletefile(ip, folder, file)
-            else:
-                createfile(ip, folder, file, data)
-    
-    if fpath != '':
-        fh.close()
-        os.remove(fpath)
-
-def deletefile(ip, folder, file):
-    datafile = "/var/www/html/" + folder + "/" + ip + "/" + file
-
-    if os.path.exists(datafile):
-        os.remove(datafile)
-
-def createfile(ip, folder, file, data):
-    dest = "/var/www/html/" + folder + "/" + ip + "/" + file
-    metamanifestdir = "/var/www/html/" + folder + "/" + ip 
-    metamanifest =  metamanifestdir + "/meta-data"
-
-    # base64 decode userdata
-    if folder == "userdata" or folder == "user-data":
-        if data is not None:
-            data = base64.b64decode(data)
-
-    fh = open(dest, "w")
-    exflock(fh)
-    if data is not None:
-        fh.write(data)
-    else:
-        fh.write("")
-    unflock(fh)
-    fh.close()
-    os.chmod(dest, 0644)
-
-    if folder == "metadata" or folder == "meta-data":
-        try:
-            os.makedirs(metamanifestdir, 0755)
-        except OSError as e:
-            # error 17 is already exists, we do it this way for concurrency
-            if e.errno != 17:
-                print "failed to make directories " + metamanifestdir + " due to :" +e.strerror
-                sys.exit(1)
-        if os.path.exists(metamanifest):
-            fh = open(metamanifest, "r+a")
-            exflock(fh) 
-            if not file in fh.read():
-                fh.write(file + '\n')
-            unflock(fh)
-            fh.close()
-        else:
-            fh = open(metamanifest, "w")
-            exflock(fh)
-            fh.write(file + '\n')
-            unflock(fh)
-            fh.close()
-
-    if os.path.exists(metamanifest):
-        os.chmod(metamanifest, 0644)
-
-def htaccess(ip, folder, file):
-    entry = "RewriteRule ^" + file + "$  ../" + folder + "/%{REMOTE_ADDR}/" + file + " [L,NC,QSA]"
-    htaccessFolder = "/var/www/html/latest"
-    htaccessFile = htaccessFolder + "/.htaccess"
-
-    try:
-        os.mkdir(htaccessFolder,0755)
-    except OSError as e:
-        # error 17 is already exists, we do it this way for concurrency
-        if e.errno != 17:
-            print "failed to make directories " + htaccessFolder + " due to :" +e.strerror
-            sys.exit(1)
-
-    if os.path.exists(htaccessFile):
-        fh = open(htaccessFile, "r+a")
-        exflock(fh)
-        if not entry in fh.read():
-            fh.write(entry + '\n')
-        unflock(fh) 
-        fh.close()
-    else:
-        fh = open(htaccessFile, "w")
-        exflock(fh)
-        fh.write("Options +FollowSymLinks\nRewriteEngine On\n\n")  
-        fh.write(entry + '\n')
-        unflock(fh)
-        fh.close()
-
-    entry="Options -Indexes\nOrder Deny,Allow\nDeny from all\nAllow from " + ip
-    htaccessFolder = "/var/www/html/" + folder + "/" + ip
-    htaccessFile = htaccessFolder+"/.htaccess"
-
-    try:
-        os.makedirs(htaccessFolder,0755)
-    except OSError as e:
-        # error 17 is already exists, we do it this way for sake of concurrency
-        if e.errno != 17:
-            print "failed to make directories " + htaccessFolder + " due to :" +e.strerror
-            sys.exit(1)
-
-    fh = open(htaccessFile, "w")
-    exflock(fh)
-    fh.write(entry + '\n')
-    unflock(fh)
-    fh.close()
-
-    if folder == "metadata" or folder == "meta-data":
-        entry = "RewriteRule ^meta-data/(.+)$  ../" + folder + "/%{REMOTE_ADDR}/$1 [L,NC,QSA]"
-        htaccessFolder = "/var/www/html/latest"
-        htaccessFile = htaccessFolder + "/.htaccess"
-
-        fh = open(htaccessFile, "r+a")
-        exflock(fh)
-        if not entry in fh.read():
-            fh.write(entry + '\n')
-
-        entry = "RewriteRule ^meta-data/$  ../" + folder + "/%{REMOTE_ADDR}/meta-data [L,NC,QSA]"
-
-        fh.seek(0)
-        if not entry in fh.read():
-            fh.write(entry + '\n')
-        unflock(fh)
-        fh.close()
-
-def exflock(file):
-    try:
-        flock(file, LOCK_EX)
-    except IOError as e:
-        print "failed to lock file" + file.name + " due to : " + e.strerror
-        sys.exit(1)
-    return True
-    
-def unflock(file):
-    try:
-        flock(file, LOCK_UN)
-    except IOError:
-        print "failed to unlock file" + file.name + " due to : " + e.strerror
-        sys.exit(1)
-    return True
-
-if __name__ == "__main__":
-    main(sys.argv[1:])

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6c261042/patches/systemvm/debian/config/opt/cloud/bin/vpc_acl.sh
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/opt/cloud/bin/vpc_acl.sh b/patches/systemvm/debian/config/opt/cloud/bin/vpc_acl.sh
deleted file mode 100755
index 903d6d6..0000000
--- a/patches/systemvm/debian/config/opt/cloud/bin/vpc_acl.sh
+++ /dev/null
@@ -1,233 +0,0 @@
-#!/usr/bin/env bash
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-# firewall_rule.sh -- allow some ports / protocols to vm instances
-# @VERSION@
-
-source /root/func.sh
-
-lock="biglock"
-locked=$(getLockFile $lock)
-if [ "$locked" != "1" ]
-then
-    exit 1
-fi
-
-usage() {
-  printf "Usage: %s:  -a <public ip address:protocol:startport:endport:sourcecidrs>  \n" $(basename $0) >&2
-  printf "sourcecidrs format:  cidr1-cidr2-cidr3-...\n"
-}
-#set -x
-#FIXME: eating up the error code during execution of iptables
-
-acl_switch_to_new() {
-  sudo iptables -D FORWARD -o $dev -d $gcidr -j _ACL_INBOUND_$dev  2>/dev/null
-  sudo iptables-save  | grep "\-j _ACL_INBOUND_$dev" | grep "\-A" | while read rule;
-  do
-    rule1=$(echo $rule | sed 's/\_ACL_INBOUND/ACL_INBOUND/')
-    sudo iptables $rule1
-    rule2=$(echo $rule | sed 's/\-A/\-D/')
-    sudo iptables $rule2
-  done
-  sudo iptables -F _ACL_INBOUND_$dev 2>/dev/null
-  sudo iptables -X _ACL_INBOUND_$dev 2>/dev/null
-  sudo iptables -t mangle -F _ACL_OUTBOUND_$dev 2>/dev/null
-  sudo iptables -t mangle -D PREROUTING -m state --state NEW -i $dev -s $gcidr ! -d $ip -j _ACL_OUTBOUND_$dev  2>/dev/null
-  sudo iptables -t mangle -X _ACL_OUTBOUND_$dev 2>/dev/null
-}
-
-acl_remove_backup() {
-  sudo iptables -F _ACL_INBOUND_$dev 2>/dev/null
-  sudo iptables -D FORWARD -o $dev -d $gcidr -j _ACL_INBOUND_$dev  2>/dev/null
-  sudo iptables -X _ACL_INBOUND_$dev 2>/dev/null
-  sudo iptables -t mangle -F _ACL_OUTBOUND_$dev 2>/dev/null
-  sudo iptables -t mangle -D PREROUTING -m state --state NEW -i $dev -s $gcidr ! -d $ip -j _ACL_OUTBOUND_$dev  2>/dev/null
-  sudo iptables -t mangle -X _ACL_OUTBOUND_$dev 2>/dev/null
-}
-
-acl_remove() {
-  sudo iptables -F ACL_INBOUND_$dev 2>/dev/null
-  sudo iptables -D FORWARD -o $dev -d $gcidr -j ACL_INBOUND_$dev  2>/dev/null
-  sudo iptables -X ACL_INBOUND_$dev 2>/dev/null
-  sudo iptables -t mangle -F ACL_OUTBOUND_$dev 2>/dev/null
-  sudo iptables -t mangle -D PREROUTING -m state --state NEW -i $dev -s $gcidr ! -d $ip -j ACL_OUTBOUND_$dev  2>/dev/null
-  sudo iptables -t mangle -X ACL_OUTBOUND_$dev 2>/dev/null
-}
-
-acl_restore() {
-  acl_remove
-  sudo iptables -E _ACL_INBOUND_$dev ACL_INBOUND_$dev 2>/dev/null
-  sudo iptables -t mangle -E _ACL_OUTBOUND_$dev ACL_OUTBOUND_$dev 2>/dev/null
-}
-
-acl_save() {
-  acl_remove_backup
-  sudo iptables -E ACL_INBOUND_$dev _ACL_INBOUND_$dev 2>/dev/null
-  sudo iptables -t mangle -E ACL_OUTBOUND_$dev _ACL_OUTBOUND_$dev 2>/dev/null
-}
-
-acl_chain_for_guest_network () {
-  acl_save
-  # inbound
-  sudo iptables -N ACL_INBOUND_$dev 2>/dev/null
-  # drop if no rules match (this will be the last rule in the chain)
-  sudo iptables -A ACL_INBOUND_$dev -j DROP 2>/dev/null
-  sudo iptables -A FORWARD -o $dev -d $gcidr -j ACL_INBOUND_$dev  2>/dev/null
-  # outbound
-  sudo iptables -t mangle -N ACL_OUTBOUND_$dev 2>/dev/null
-  sudo iptables -t mangle -A PREROUTING -m state --state NEW -i $dev -s $gcidr ! -d $ip -j ACL_OUTBOUND_$dev  2>/dev/null
-}
-
-
-
-acl_entry_for_guest_network() {
-  local rule=$1
-
-  local ttype=$(echo $rule | cut -d: -f1)
-  local prot=$(echo $rule | cut -d: -f2)
-  local sport=$(echo $rule | cut -d: -f3)
-  local eport=$(echo $rule | cut -d: -f4)
-  local cidrs=$(echo $rule | cut -d: -f5 | sed 's/-/ /g')
-  local action=$(echo $rule | cut -d: -f6)
-  if [ "$sport" == "0" -a "$eport" == "0" ]
-  then
-      DPORT=""
-  else
-      DPORT="--dport $sport:$eport"
-  fi
-  logger -t cloud "$(basename $0): enter apply acl rules for guest network: $gcidr, inbound:$inbound:$prot:$sport:$eport:$cidrs"  
-  
-  # note that rules are inserted after the RELATED,ESTABLISHED rule 
-  # but before the DROP rule
-  for lcidr in $cidrs
-  do
-    [ "$prot" == "reverted" ] && continue;
-    if [ "$prot" == "icmp" ]
-    then
-      typecode="$sport/$eport"
-      [ "$eport" == "-1" ] && typecode="$sport"
-      [ "$sport" == "-1" ] && typecode="any"
-      if [ "$ttype" == "Ingress" ]
-      then
-        sudo iptables -I ACL_INBOUND_$dev -p $prot -s $lcidr  \
-                    --icmp-type $typecode  -j $action
-      else
-        let egress++
-        sudo iptables -t mangle -I ACL_OUTBOUND_$dev -p $prot -d $lcidr  \
-                    --icmp-type $typecode  -j $action
-      fi
-    else
-      if [ "$ttype" == "Ingress" ]
-      then
-        sudo iptables -I ACL_INBOUND_$dev -p $prot -s $lcidr \
-                    $DPORT -j $action
-      else
-        let egress++
-        sudo iptables -t mangle -I ACL_OUTBOUND_$dev -p $prot -d $lcidr \
-                    $DPORT -j $action
-      fi
-    fi
-    result=$?
-    [ $result -gt 0 ] && 
-       logger -t cloud "Error adding iptables entry for guest network : $gcidr,inbound:$inbound:$prot:$sport:$eport:$cidrs" &&
-       break
-  done
-      
-  logger -t cloud "$(basename $0): exit apply acl rules for guest network : $gcidr"  
-  return $result
-}
-
-
-dflag=0
-gflag=0
-aflag=0
-rules=""
-rules_list=""
-ip=""
-dev=""
-while getopts 'd:i:m:a:' OPTION
-do
-  case $OPTION in
-  d)    dflag=1
-                dev="$OPTARG"
-                ;;
-  i)    iflag=1
-                ip="$OPTARG"
-                ;;
-  m)    mflag=1
-                mask="$OPTARG"
-                ;;
-  a)	aflag=1
-		rules="$OPTARG"
-		;;
-  ?)	usage
-                unlock_exit 2 $lock $locked
-		;;
-  esac
-done
-
-if [ "$dflag$iflag$mflag$aflag" != "1111" ]
-then
-  usage
-  unlock_exit 2 $lock $locked
-fi
-
-gcidr="$ip/$mask"
-if [ -n "$rules" ]
-then
-  rules_list=$(echo $rules | cut -d, -f1- --output-delimiter=" ")
-fi
-
-# rule format
-# protocal:sport:eport:cidr
-#-a tcp:80:80:0.0.0.0/0::tcp:220:220:0.0.0.0/0:,172.16.92.44:tcp:222:222:192.168.10.0/24-75.57.23.0/22-88.100.33.1/32
-#    if any entry is reverted , entry will be in the format <ip>:reverted:0:0:0
-# example : 172.16.92.44:tcp:80:80:0.0.0.0/0:ACCEPT:,172.16.92.44:tcp:220:220:0.0.0.0/0:DROP,200.1.1.2:reverted:0:0:0
-
-success=0
-
-acl_chain_for_guest_network
-egress=0
-for r in $rules_list
-do
-  acl_entry_for_guest_network $r
-  success=$?
-  if [ $success -gt 0 ]
-  then
-    logger -t cloud "$(basename $0): failure to apply fw rules for guest network: $gcidr"
-    break
-  else
-    logger -t cloud "$(basename $0): successful in applying fw rules for guest network: $gcidr"
-  fi
-done
-
-if [ $success -gt 0 ]
-then
-  logger -t cloud "$(basename $0): restoring from backup for guest network: $gcidr"
-  acl_restore
-else
-  logger -t cloud "$(basename $0): deleting backup for guest network: $gcidr"
-  if [ $egress -eq 0 ]
-  then
-    sudo iptables -t mangle -A ACL_OUTBOUND_$dev -j ACCEPT 2>/dev/null
-  else
-    sudo iptables -t mangle -A ACL_OUTBOUND_$dev -j DROP 2>/dev/null
-  fi   
-  acl_switch_to_new
-fi
-unlock_exit $success $lock $locked
-


Mime
View raw message