From patchwork Wed Apr 9 09:10:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 28071 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f197.google.com (mail-qc0-f197.google.com [209.85.216.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9A34F2145A for ; Wed, 9 Apr 2014 09:12:48 +0000 (UTC) Received: by mail-qc0-f197.google.com with SMTP id i8sf5926399qcq.4 for ; Wed, 09 Apr 2014 02:12:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:message-id:from:to:date:in-reply-to :references:organization:mime-version:cc:subject:precedence:list-id :list-unsubscribe:list-post:list-help:list-subscribe:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:list-archive:content-type:content-transfer-encoding; bh=Bpqi7TFSSQZCvYkRz91PCmalgaIr3EH2hIi9jSGdLNg=; b=AGm7M8wcJe6zXYmRQHb3z10rTWnHXonN0dRE37Vop1Jj3Y+U2HshTt1BUj/UgFSN0p UiJ/salEUlMrBi+og6aXZoCUWjOtXw/6Q7yFvsk9CLdLiDh7w9aYVjDxGLZlepL3uCkC ChifXGjgOebW5BhjJvVA1m/PhXUDcTXE5NcAGcCaTQVyTzg6ROMdehXkAQPxq3MJCXR+ Q61f62SMxmML4AIWEhomZKxfL2YZ/gyZeZ4Rhea7dA5CJ1L/rmxI9tZw9QYqbYMpqkSG s1eZ7EHlUvjw/Fy4AIujdhmvFvKPa7upLLV/cVqEz7Bo+ULatCw4kPPr1X7EwAJkM9Qo oViw== X-Gm-Message-State: ALoCoQlKk2xrcx6TQfYXvOKWJw/jrJre5f83wFepRR4J3ziKt0sLNj/r1wSAVdFNjJBXClkCZmPf X-Received: by 10.236.138.113 with SMTP id z77mr3511398yhi.25.1397034768381; Wed, 09 Apr 2014 02:12:48 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.34.233 with SMTP id l96ls539366qgl.90.gmail; Wed, 09 Apr 2014 02:12:48 -0700 (PDT) X-Received: by 10.220.159.4 with SMTP id h4mr7910073vcx.1.1397034768211; Wed, 09 Apr 2014 02:12:48 -0700 (PDT) Received: from mail-vc0-f175.google.com (mail-vc0-f175.google.com [209.85.220.175]) by mx.google.com with ESMTPS id vb6si45469vec.182.2014.04.09.02.12.48 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 09 Apr 2014 02:12:48 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.175 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.175; Received: by mail-vc0-f175.google.com with SMTP id lh14so1797488vcb.20 for ; Wed, 09 Apr 2014 02:12:48 -0700 (PDT) X-Received: by 10.58.207.74 with SMTP id lu10mr7660443vec.15.1397034768107; Wed, 09 Apr 2014 02:12:48 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.12.8 with SMTP id v8csp313307vcv; Wed, 9 Apr 2014 02:12:47 -0700 (PDT) X-Received: by 10.50.73.130 with SMTP id l2mr3471677igv.42.1397034767404; Wed, 09 Apr 2014 02:12:47 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id x2si8618182iga.39.2014.04.09.02.12.46 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 09 Apr 2014 02:12:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xen.org designates 50.57.142.19 as permitted sender) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WXoX6-0007OX-GK; Wed, 09 Apr 2014 09:11:00 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WXoX5-0007OC-0x for xen-devel@lists.xen.org; Wed, 09 Apr 2014 09:10:59 +0000 Received: from [85.158.137.68:10549] by server-4.bemta-3.messagelabs.com id 5A/CC-17399-2AE05435; Wed, 09 Apr 2014 09:10:58 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-4.tower-31.messagelabs.com!1397034655!5906475!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n X-StarScan-Received: X-StarScan-Version: 6.11.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 28053 invoked from network); 9 Apr 2014 09:10:56 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-4.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 9 Apr 2014 09:10:56 -0000 X-IronPort-AV: E=Sophos;i="4.97,825,1389744000"; d="scan'208";a="118231091" Received: from accessns.citrite.net (HELO FTLPEX01CL02.citrite.net) ([10.9.154.239]) by FTLPIPO02.CITRIX.COM with ESMTP; 09 Apr 2014 09:10:55 +0000 Received: from [10.80.2.80] (10.80.2.80) by FTLPEX01CL02.citrite.net (10.13.107.79) with Microsoft SMTP Server id 14.2.342.4; Wed, 9 Apr 2014 05:10:54 -0400 Message-ID: <1397034653.31448.29.camel@kazak.uk.xensource.com> From: Ian Campbell To: Roger Pau =?ISO-8859-1?Q?Monn=E9?= Date: Wed, 9 Apr 2014 10:10:53 +0100 In-Reply-To: <53450B0A.30009@citrix.com> References: <1397032120-21058-1-git-send-email-ian.campbell@citrix.com> <53450B0A.30009@citrix.com> Organization: Citrix Systems, Inc. X-Mailer: Evolution 3.8.5-2+b3 MIME-Version: 1.0 X-Originating-IP: [10.80.2.80] X-DLP: MIA1 Cc: ian.jackson@eu.citrix.com, xen-devel@lists.xen.org Subject: Re: [Xen-devel] [PATCH] tools/hotplug: Remove network-* X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ian.campbell@citrix.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.175 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: On Wed, 2014-04-09 at 10:55 +0200, Roger Pau Monné wrote: > On 09/04/14 10:28, Ian Campbell wrote: > > These are a xend-ism. Since Xen 4.1 the recommened way to configure networking > > has been to use the distro facilities (e.g. > > http://wiki.xen.org/wiki/HostConfiguration/Networking) > > > > Signed-off-by: Ian Campbell > > --- > > tools/hotplug/Linux/network-bridge | 339 ------------------------------------ > > tools/hotplug/Linux/network-nat | 124 ------------- > > tools/hotplug/Linux/network-route | 28 --- > > Shouldn't you also modify tools/hotplug/Linux/Makefile to remove the > references to those files, or am I missing something? You aren't, I've no idea why this didn't fail for me before... I suspect I just didn't pay close enough attention to the test build. -----8<---------- >From 3f2142f0b7a0d600fa8d2d06b5eacf0d52aa5bca Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Fri, 4 Apr 2014 15:00:12 +0100 Subject: [PATCH v2] tools/hotplug: Remove network-* These are a xend-ism. Since Xen 4.1 the recommened way to configure networking has been to use the distro facilities (e.g. http://wiki.xen.org/wiki/HostConfiguration/Networking) Signed-off-by: Ian Campbell Acked-by: Roger Pau Monné Acked-by: Ian Jackson --- v2: Remove references from Makefile and README --- tools/examples/README | 5 +- tools/hotplug/Linux/Makefile | 6 +- tools/hotplug/Linux/network-bridge | 339 ------------------------------------ tools/hotplug/Linux/network-nat | 124 ------------- tools/hotplug/Linux/network-route | 28 --- 5 files changed, 4 insertions(+), 498 deletions(-) delete mode 100644 tools/hotplug/Linux/network-bridge delete mode 100644 tools/hotplug/Linux/network-nat delete mode 100644 tools/hotplug/Linux/network-route diff --git a/tools/examples/README b/tools/examples/README index 2225d5c..5916df3 100644 --- a/tools/examples/README +++ b/tools/examples/README @@ -18,9 +18,6 @@ external-device-migrate - called by xend for migrating external devices locking.sh - locking functions to prevent concurrent access to critical sections inside script files logging.sh - logging function to log output using syslog -network-bridge - xen network start/stop script when using bridging -network-nat - xen network start/stop script when using NAT -network-route - xen network start/stop script when using routing vif-bridge - virtual network start/stop script in bridged mode vif-common.sh - sourced by vif-bridge vif-nat - xen virtual network start/stop script in NAT mode @@ -31,7 +28,7 @@ xen-backend.rules - hotplug script rules xend-config.sxp - default xend configuration file xen-hotplug-common.sh - sourced by vif-common.sh xen-network-common.sh - sourced by vif-common.sh -xen-script-common.sh - sourced by network-bridge, xen-hotplug-common.sh +xen-script-common.sh - sourced by xen-hotplug-common.sh xmexample1 - example configuration script for 'xm create' xmexample2 - a more complex configuration script for 'xm create' xmexample3 - an advanced configuration script for 'xm create' diff --git a/tools/hotplug/Linux/Makefile b/tools/hotplug/Linux/Makefile index a14cb42..4874ec5 100644 --- a/tools/hotplug/Linux/Makefile +++ b/tools/hotplug/Linux/Makefile @@ -9,9 +9,9 @@ XENCOMMONS_INITD = init.d/xencommons XENCOMMONS_SYSCONFIG = init.d/sysconfig.xencommons # Xen script dir and scripts to go there. -XEN_SCRIPTS = network-bridge vif-bridge -XEN_SCRIPTS += network-route vif-route -XEN_SCRIPTS += network-nat vif-nat +XEN_SCRIPTS = vif-bridge +XEN_SCRIPTS += vif-route +XEN_SCRIPTS += vif-nat XEN_SCRIPTS += vif-openvswitch XEN_SCRIPTS += vif2 XEN_SCRIPTS += vif-setup diff --git a/tools/hotplug/Linux/network-bridge b/tools/hotplug/Linux/network-bridge deleted file mode 100644 index 9aa9dda..0000000 --- a/tools/hotplug/Linux/network-bridge +++ /dev/null @@ -1,339 +0,0 @@ -#!/bin/bash -#============================================================================ -# Default Xen network start/stop script. -# Xend calls a network script when it starts. -# The script name to use is defined in ${XEN_CONFIG_DIR}/xend-config.sxp -# in the network-script field. -# -# This script creates a bridge (default ${netdev}), adds a device -# (defaults to the device on the default gateway route) to it, copies -# the IP addresses from the device to the bridge and adjusts the routes -# accordingly. -# -# If all goes well, this should ensure that networking stays up. -# However, some configurations are upset by this, especially -# NFS roots. If the bridged setup does not meet your needs, -# configure a different script, for example using routing instead. -# -# Usage: -# -# network-bridge (start|stop|status) {VAR=VAL}* -# -# Vars: -# -# bridge The bridge to use (default ${netdev}). -# netdev The interface to add to the bridge (default gateway device). -# antispoof Whether to use iptables to prevent spoofing (default no). -# -# Internal Vars: -# pdev="p${netdev}" -# tdev=tmpbridge -# -# start: -# Creates the bridge as tdev -# Copies the IP and MAC addresses from pdev to bridge -# Renames netdev to be pdev -# Renames tdev to bridge -# Enslaves pdev to bridge -# -# stop: -# Removes pdev from the bridge -# Transfers addresses, routes from bridge to pdev -# Renames bridge to tdev -# Renames pdev to netdev -# Deletes tdev -# -# status: -# Print addresses, interfaces, routes -# -#============================================================================ - - -dir=$(dirname "$0") -. "$dir/logging.sh" -. "$dir/xen-script-common.sh" -. "$dir/xen-network-common.sh" -. "$dir/locking.sh" - -findCommand "$@" -evalVariables "$@" - -is_network_root () { - local rootfs=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $3; }}' /etc/mtab) - local rootopts=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $4; }}' /etc/mtab) - - [[ "$rootfs" =~ "^nfs" ]] || [[ "$rootopts" =~ "_netdev" ]] && has_nfsroot=1 || has_nfsroot=0 - if [ $has_nfsroot -eq 1 ]; then - local bparms=$(cat /proc/cmdline) - for p in $bparms; do - local ipaddr=$(echo $p | awk /nfsroot=/'{ print substr($1,9,index($1,":")-9) }') - if [ "$ipaddr" != "" ]; then - local nfsdev=$(ip route get $ipaddr | awk /$ipaddr/'{ print $3 }') - [[ "$nfsdev" == "$netdev" ]] && return 0 || return 1 - fi - done - fi - return 1 -} - -find_alt_device () { - local interf=$1 - local prefix=${interf%[[:digit:]]} - local ifs=$(ip link show | grep " $prefix" |\ - awk '{ printf ("%s",substr($2,1,length($2)-1)) }' |\ - sed s/$interf//) - echo "$ifs" -} - -netdev=${netdev:-$(ip route list 0.0.0.0/0 | \ - sed 's/.*dev \([a-z]\+[0-9]\+\).*$/\1/')} -if is_network_root ; then - altdevs=$(find_alt_device $netdev) - for netdev in $altdevs; do break; done - if [ -z "$netdev" ]; then - [ -x /usr/bin/logger ] && /usr/bin/logger "network-bridge: bridging not supported on network root; not starting" - exit - fi -fi -netdev=${netdev:-eth0} -bridge=${bridge:-${netdev}} -antispoof=${antispoof:-no} - -pdev="p${netdev}" -tdev=tmpbridge - -get_ip_info() { - addr_pfx=`ip addr show dev $1 | egrep '^ *inet' | sed -e 's/ *inet //' -e 's/ .*//'` - gateway=`ip route show dev $1 | fgrep default | sed 's/default via //'` -} - -do_ifup() { - if [ $1 != "${netdev}" ] || ! ifup $1 ; then - if [ -n "$addr_pfx" ] ; then - # use the info from get_ip_info() - ip addr flush $1 - ip addr add ${addr_pfx} dev $1 - fi - ip link set dev $1 up - if [ -n "$gateway" ] ; then - ip route add default via ${gateway} - fi - fi -} - -# Usage: transfer_addrs src dst -# Copy all IP addresses (including aliases) from device $src to device $dst. -transfer_addrs () { - local src=$1 - local dst=$2 - # Don't bother if $dst already has IP addresses. - if ip addr show dev ${dst} | egrep -q '^ *inet ' ; then - return - fi - # Address lines start with 'inet' and have the device in them. - # Replace 'inet' with 'ip addr add' and change the device name $src - # to 'dev $src'. - ip addr show dev ${src} | egrep '^ *inet ' | sed -e " -s/inet/ip addr add/ -s@\([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+/[0-9]\+\)@\1@ -s/${src}/dev ${dst} label ${dst}/ -s/secondary// -" | sh -e - # Remove automatic routes on destination device - ip route list | sed -ne " -/dev ${dst}\( \|$\)/ { - s/^/ip route del / - p -}" | sh -e -} - -# Usage: transfer_routes src dst -# Get all IP routes to device $src, delete them, and -# add the same routes to device $dst. -# The original routes have to be deleted, otherwise adding them -# for $dst fails (duplicate routes). -transfer_routes () { - local src=$1 - local dst=$2 - # List all routes and grep the ones with $src in. - # Stick 'ip route del' on the front to delete. - # Change $src to $dst and use 'ip route add' to add. - ip route list | sed -ne " -/dev ${src}\( \|$\)/ { - h - s/^/ip route del / - P - g - s/${src}/${dst}/ - s/^/ip route add / - P - d -}" | sh -e -} - - -## -# link_exists interface -# -# Returns 0 if the interface named exists (whether up or down), 1 otherwise. -# -link_exists() -{ - if ip link show "$1" >/dev/null 2>/dev/null - then - return 0 - else - return 1 - fi -} - -# Set the default forwarding policy for $dev to drop. -# Allow forwarding to the bridge. -antispoofing () { - iptables -P FORWARD DROP - iptables -F FORWARD - iptables -A FORWARD -m physdev --physdev-in ${pdev} -j ACCEPT -} - -# Usage: show_status dev bridge -# Print ifconfig and routes. -show_status () { - local dev=$1 - local bridge=$2 - - echo '============================================================' - ip addr show ${dev} - ip addr show ${bridge} - echo ' ' - brctl show ${bridge} - echo ' ' - ip route list - echo ' ' - route -n - echo '============================================================' -} - -op_start () { - if [ "${bridge}" = "null" ] ; then - return - fi - - if [ `brctl show | wc -l` != 1 ]; then - return - fi - - if link_exists "$pdev"; then - # The device is already up. - return - fi - - claim_lock "network-bridge" - - create_bridge ${tdev} - - preiftransfer ${netdev} - transfer_addrs ${netdev} ${tdev} - # Remember slaves for bonding interface. - if [ -e /sys/class/net/${netdev}/bonding/slaves ]; then - slaves=`cat /sys/class/net/${netdev}/bonding/slaves` - fi - # Remember the IP details for do_ifup. - get_ip_info ${netdev} - if ! ifdown ${netdev}; then - ip link set ${netdev} down - ip addr flush ${netdev} - fi - ip link set ${netdev} name ${pdev} - ip link set ${tdev} name ${bridge} - - setup_physical_bridge_port ${pdev} - - # Restore slaves - if [ -n "${slaves}" ]; then - ip link set ${pdev} up - ifenslave ${pdev} ${slaves} - fi - add_to_bridge2 ${bridge} ${pdev} - do_ifup ${bridge} - - if [ ${antispoof} = 'yes' ] ; then - antispoofing - fi - - release_lock "network-bridge" -} - -op_stop () { - if [ "${bridge}" = "null" ]; then - return - fi - if ! link_exists "$bridge"; then - return - fi - if ! [ -e "/sys/class/net/${bridge}/brif/${pdev}" ]; then - # $bridge is not a bridge to which pdev is enslaved - return - fi - - claim_lock "network-bridge" - - transfer_addrs ${bridge} ${pdev} - if ! ifdown ${bridge}; then - get_ip_info ${bridge} - fi - ip link set ${pdev} down - ip addr flush ${bridge} - - brctl delif ${bridge} ${pdev} - ip link set ${bridge} down - - ip link set ${bridge} name ${tdev} - ip link set ${pdev} name ${netdev} - do_ifup ${netdev} - - brctl delbr ${tdev} - - release_lock "network-bridge" -} - -# adds $dev to $bridge but waits for $dev to be in running state first -add_to_bridge2() { - local bridge=$1 - local dev=$2 - local maxtries=10 - - echo -n "Waiting for ${dev} to negotiate link." - ip link set ${dev} up - for i in `seq ${maxtries}` ; do - if ifconfig ${dev} | grep -q RUNNING ; then - break - else - echo -n '.' - sleep 1 - fi - done - - if [ ${i} -eq ${maxtries} ] ; then echo -n '(link isnt in running state)' ; fi - echo - - add_to_bridge ${bridge} ${dev} -} - -case "$command" in - start) - op_start - ;; - - stop) - op_stop - ;; - - status) - show_status ${netdev} ${bridge} - ;; - - *) - echo "Unknown command: $command" >&2 - echo 'Valid commands are: start, stop, status' >&2 - exit 1 -esac diff --git a/tools/hotplug/Linux/network-nat b/tools/hotplug/Linux/network-nat deleted file mode 100644 index eb1740e..0000000 --- a/tools/hotplug/Linux/network-nat +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -#============================================================================ -# Default Xen network start/stop script when using NAT. -# Xend calls a network script when it starts. -# The script name to use is defined in ${XEN_CONFIG_DIR}/xend-config.sxp -# in the network-script field. -# -# Usage: -# -# network-nat (start|stop|status) {VAR=VAL}* -# -# Vars: -# -# netdev The gateway interface (default eth0). -# antispoof Whether to use iptables to prevent spoofing (default no). -# dhcp Whether to alter the local DHCP configuration (default no). -# -#============================================================================ - -dir=$(dirname "$0") -. "$dir/hotplugpath.sh" -. "$dir/xen-script-common.sh" -. "$dir/xen-network-common.sh" - -findCommand "$@" -evalVariables "$@" - -netdev=${netdev:-eth0} -# antispoofing not yet implemented -antispoof=${antispoof:-no} - -# turn on dhcp feature by default if dhcpd is installed -if [ -f /etc/dhcpd.conf ] -then - dhcp=${dhcp:-yes} -else - dhcp=${dhcp:-no} -fi - - -if [ "$dhcp" != 'no' ] -then - dhcpd_conf_file=$(find_dhcpd_conf_file) - dhcpd_init_file=$(find_dhcpd_init_file) - if [ -z "$dhcpd_conf_file" ] || [ -z "$dhcpd_init_file" ] - then - echo 'Failed to find dhcpd configuration or init file.' >&2 - exit 1 - fi -fi - -domain_name=`cat /etc/resolv.conf | grep -v "#" | grep -E 'search|domain' -i | tail -n 1 | awk '{ print $2 }'` -nameserver=`cat /etc/resolv.conf | grep -v "#" | grep "nameserver" -i -m 1 | awk '{ print $2 }'` - -function dhcp_start() -{ - if ! grep -q "subnet 10.0.0.0" "$dhcpd_conf_file" - then - echo >>"$dhcpd_conf_file" "subnet 10.0.0.0 netmask 255.255.0.0 {\ - option domain-name \"$domain_name\";\ - option domain-name-servers $nameserver; }" - fi - - "$dhcpd_init_file" restart -} - - -function dhcp_stop() -{ - local tmpfile=$(mktemp) - grep -v "subnet 10.0.0.0" "$dhcpd_conf_file" >"$tmpfile" - if diff "$tmpfile" "$dhcpd_conf_file" >&/dev/null - then - rm "$tmpfile" - else - mv "$tmpfile" "$dhcpd_conf_file" - fi - - "$dhcpd_init_file" restart -} - - -op_start() { - echo 1 >/proc/sys/net/ipv4/ip_forward - iptables -t nat -A POSTROUTING -o ${netdev} -j MASQUERADE - [ "$dhcp" != 'no' ] && dhcp_start -} - - -op_stop() { - [ "$dhcp" != 'no' ] && dhcp_stop - iptables -t nat -D POSTROUTING -o ${netdev} -j MASQUERADE -} - - -show_status() { - echo '============================================================' - ifconfig - echo ' ' - ip route list - echo ' ' - route -n - echo '============================================================' - -} - -case "$command" in - start) - op_start - ;; - - stop) - op_stop - ;; - - status) - show_status - ;; - - *) - echo "Unknown command: $command" >&2 - echo 'Valid commands are: start, stop, status' >&2 - exit 1 -esac diff --git a/tools/hotplug/Linux/network-route b/tools/hotplug/Linux/network-route deleted file mode 100644 index 8f6a1be..0000000 --- a/tools/hotplug/Linux/network-route +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -#============================================================================ -# Default Xen network start/stop script. -# Xend calls a network script when it starts. -# The script name to use is defined in ${XEN_CONFIG_DIR}/xend-config.sxp -# in the network-script field. -# -# Usage: -# -# network-route (start|stop|status) {VAR=VAL}* -# -# Vars: -# -# netdev The gateway interface (default eth0). -# antispoof Whether to use iptables to prevent spoofing (default yes). -# -#============================================================================ - -dir=$(dirname "$0") -. "$dir/hotplugpath.sh" -. "$dir/xen-script-common.sh" - -evalVariables "$@" - -netdev=${netdev:-eth0} - -echo 1 >/proc/sys/net/ipv4/ip_forward -echo 1 >/proc/sys/net/ipv4/conf/${netdev}/proxy_arp