@@ -81,7 +81,7 @@ case "$command" in
;&
online)
setup_virtual_bridge_port "$dev"
- set_mtu "$bridge" "$dev"
+ set_mtu "$bridge" "$dev" "$type_if"
add_to_bridge "$bridge" "$dev"
;;
remove)
@@ -164,9 +164,33 @@ remove_from_bridge () {
set_mtu () {
local bridge=$1
local dev=$2
- mtu="`ip link show dev ${bridge}| awk '/mtu/ { print $5 }'`"
+ local type_if=$3
+
+ XENBUS_PATH="${XENBUS_PATH:?}"
+
+ local mtu=$(xenstore_read_default "$XENBUS_PATH/mtu" "")
+ if [ -z "$mtu" ]
+ then
+ mtu="`ip link show dev ${bridge}| awk '/mtu/ { print $5 }'`"
+ if [ -n "$mtu" ]
+ then
+ log debug "$bridge MTU is $mtu"
+ fi
+ fi
if [ -n "$mtu" ] && [ "$mtu" -gt 0 ]
then
- ip link set dev ${dev} mtu $mtu || :
+ log debug "setting $dev MTU to $mtu"
+ ip link set dev ${dev} mtu ${mtu} || :
+
+ if [ ${type_if} = vif ]
+ then
+ local dev_=${dev#vif}
+ local domid=${dev_%.*}
+ local devid=${dev_#*.}
+
+ local FRONTEND_PATH="/local/domain/$domid/device/vif/$devid"
+
+ xenstore_write "$FRONTEND_PATH/mtu" ${mtu}
+ fi
fi
}