#!/bin/sh
#
#  This script disables checksumming within the domU
#

prefix=$1

#
#  Source the common functions
#
if [ -e /usr/lib/xen-tools/common.sh ]; then
    . /usr/lib/xen-tools/common.sh
else
    . ./hooks/common.sh
fi

logMessage Script $0 starting

# To avoid UDP checksum problems.
installDebianPackage ${prefix} ethtool

if ! sed -i -e 's/^\(\s*\)#\s*post-up\s\+ethtool/\1post-up ethtool -K eth0 tso off\n\0/' ${prefix}/etc/network/interfaces; then
    echo "ERROR: unable to disable network segmentation offloading"
    exit 1
fi

#
# Log our finish
#
logMessage Script $0 finished
