network: use the same gateway IP generation method as backend

Backend domain generates its IP address based on frontend IP, not
settings given from dom0. So change frontend method to the same (for
DispVM it makes a difference). Now "qubes-gateway" xenstore entry is
basically primary DNS address only.
This commit is contained in:
Marek Marczykowski-Górecki 2014-08-13 08:09:44 +02:00
parent 6c8ef2ddd8
commit 4ef785a016

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
if [ -x /usr/sbin/xenstore-read ]; then
XENSTORE_READ="/usr/sbin/xenstore-read"
@ -9,15 +9,16 @@ fi
ip=`$XENSTORE_READ qubes-ip 2> /dev/null`
if [ x$ip != x ]; then
netmask=`$XENSTORE_READ qubes-netmask`
gateway=`$XENSTORE_READ qubes-gateway`
primary_dns=`$XENSTORE_READ qubes-gateway`
secondary_dns=`$XENSTORE_READ qubes-secondary-dns`
/sbin/ifconfig $INTERFACE $ip netmask 255.255.255.255
/sbin/ifconfig $INTERFACE up
/sbin/route add -host $gateway dev $INTERFACE
/sbin/route add default gw $gateway
gw_ip=${ip%.*}.1
/sbin/route add -host $gw_ip dev $INTERFACE
/sbin/route add default gw $gw_ip
/sbin/ethtool -K $INTERFACE sg off
/sbin/ethtool -K $INTERFACE tx off
echo "nameserver $gateway" > /etc/resolv.conf
echo "nameserver $primary_dns" > /etc/resolv.conf
echo "nameserver $secondary_dns" >> /etc/resolv.conf
network=$($XENSTORE_READ qubes-netvm-network 2>/dev/null)
if [ "x$network" != "x" ]; then