diff --git a/network/network-manager-prepare-conf-dir b/network/network-manager-prepare-conf-dir new file mode 100755 index 00000000..84a36350 --- /dev/null +++ b/network/network-manager-prepare-conf-dir @@ -0,0 +1,10 @@ +#!/bin/sh + +if [ -d /etc/NetworkManager/system-connections ]; then + mkdir -p /rw/config/NM-system-connections + mv /etc/NetworkManager/system-connections/* /rw/config/NM-system-connections/ 2> /dev/null || true + rmdir /etc/NetworkManager/system-connections + ln -s /rw/config/NM-system-connections /etc/NetworkManager/system-connections +fi + +exit 0 diff --git a/network/qubes_fix_nm_conf.sh b/network/qubes_fix_nm_conf.sh index 613fa159..9f1eca7b 100755 --- a/network/qubes_fix_nm_conf.sh +++ b/network/qubes_fix_nm_conf.sh @@ -4,6 +4,9 @@ VIFMAC=mac:fe:ff:ff:ff:ff:ff if ! grep -q ^plugins.*keyfile $FILE ; then sed -i 's/^plugins.*$/&,keyfile/' $FILE fi +if grep -q ^plugins.*ifcfg-rh $FILE ; then + sed -i 's/^plugins=\(.*\)ifcfg-rh,\(.*\)$/plugins=\1\2/' $FILE +fi if ! grep -q '^\[keyfile\]$' $FILE ; then echo '[keyfile]' >> $FILE fi diff --git a/network/qubes_setup_dnat_to_ns b/network/qubes_setup_dnat_to_ns index aa95186c..ef6a6dd1 100755 --- a/network/qubes_setup_dnat_to_ns +++ b/network/qubes_setup_dnat_to_ns @@ -14,7 +14,7 @@ source /var/run/qubes/qubes_ns if [ "X"$NS1 = "X" ] ; then exit ; fi iptables -t nat -F PR-QBS FIRSTONE=yes -grep ^nameserver /etc/resolv.conf | head -2 | +grep ^nameserver /etc/resolv.conf | grep -v ":.*:" | head -2 | ( while read x y z ; do addrule "$y" diff --git a/rpm_spec/core-vm.spec b/rpm_spec/core-vm.spec index 0b723879..12483b73 100644 --- a/rpm_spec/core-vm.spec +++ b/rpm_spec/core-vm.spec @@ -119,6 +119,7 @@ install network/qubes_network.rules $RPM_BUILD_ROOT/etc/udev/rules.d/99-qubes_ne install network/qubes_setup_dnat_to_ns $RPM_BUILD_ROOT/usr/lib/qubes install network/qubes_fix_nm_conf.sh $RPM_BUILD_ROOT/usr/lib/qubes install network/setup_ip $RPM_BUILD_ROOT/usr/lib/qubes/ +install network/network-manager-prepare-conf-dir $RPM_BUILD_ROOT/usr/lib/qubes/ install -d $RPM_BUILD_ROOT/etc/dhclient.d ln -s /usr/lib/qubes/qubes_setup_dnat_to_ns $RPM_BUILD_ROOT/etc/dhclient.d/qubes_setup_dnat_to_ns.sh install -d $RPM_BUILD_ROOT/etc/NetworkManager/dispatcher.d/ @@ -240,7 +241,7 @@ if [ "$1" != 1 ] ; then exit 0 fi -if ! [ -f /var/lib/qubes/serial.orig ] ; then +if [ -e /etc/init/serial.conf ] && ! [ -f /var/lib/qubes/serial.orig ] ; then cp /etc/init/serial.conf /var/lib/qubes/serial.orig fi @@ -342,6 +343,7 @@ rm -rf $RPM_BUILD_ROOT /usr/lib/qubes/block_cleanup /usr/lib/qubes/block_remove /usr/lib/qubes/meminfo-writer +/usr/lib/qubes/network-manager-prepare-conf-dir /usr/lib/qubes/qfile-agent /usr/lib/qubes/qfile-unpacker /usr/lib/qubes/qopen-in-vm diff --git a/vm-init.d/qubes_core_netvm b/vm-init.d/qubes_core_netvm index 053e4be0..fa67dc42 100755 --- a/vm-init.d/qubes_core_netvm +++ b/vm-init.d/qubes_core_netvm @@ -15,6 +15,7 @@ start() type=$(/usr/bin/xenstore-read qubes_vm_type) if [ "$type" == "NetVM" ]; then + /usr/lib/qubes/network-manager-prepare-conf-dir /sbin/service NetworkManager start fi diff --git a/vm-systemd/NetworkManager.service b/vm-systemd/NetworkManager.service index bf1e4864..1349161c 100644 --- a/vm-systemd/NetworkManager.service +++ b/vm-systemd/NetworkManager.service @@ -1,3 +1,8 @@ .include /lib/systemd/system/NetworkManager.service [Unit] ConditionPathExists=/var/run/qubes-service/network-manager +# For /rw +After=qubes-misc-post.service + +[Service] +ExecStartPre=/usr/lib/qubes/network-manager-prepare-conf-dir diff --git a/vm-systemd/network-proxy-setup.sh b/vm-systemd/network-proxy-setup.sh index c12e1d3a..387e6492 100755 --- a/vm-systemd/network-proxy-setup.sh +++ b/vm-systemd/network-proxy-setup.sh @@ -11,4 +11,5 @@ if [ "x$network" != "x" ]; then echo "NS2=$secondary_dns" >> /var/run/qubes/qubes_ns /usr/lib/qubes/qubes_setup_dnat_to_ns echo "1" > /proc/sys/net/ipv4/ip_forward + /sbin/ethtool -K eth0 sg off fi diff --git a/vm-systemd/qubes-network.service b/vm-systemd/qubes-network.service index 86c02fe7..afb53f03 100644 --- a/vm-systemd/qubes-network.service +++ b/vm-systemd/qubes-network.service @@ -7,7 +7,6 @@ Before=network.target [Service] Type=oneshot RemainAfterExit=yes -ExecStartPre=/sbin/ethtool -K eth0 sg off ExecStart=/usr/lib/qubes/init/network-proxy-setup.sh StandardOutput=syslog diff --git a/vm-systemd/qubes-sysinit.sh b/vm-systemd/qubes-sysinit.sh index da13fafa..dc93de5e 100755 --- a/vm-systemd/qubes-sysinit.sh +++ b/vm-systemd/qubes-sysinit.sh @@ -13,6 +13,11 @@ read_service() { $XS_READ qubes-service/$1 2> /dev/null } +# Wait for evtchn initialization +while [ ! -e /proc/xen/xenbus ]; do + sleep 0.1 +done + mkdir -p /var/run/qubes mkdir -p /var/run/qubes-service mkdir -p /var/run/xen-hotplug