summaryrefslogtreecommitdiffstats
path: root/builder/modules.d/systemd-networkd-ext
diff options
context:
space:
mode:
authorJonathan Bauer2019-06-17 17:37:02 +0200
committerJonathan Bauer2019-06-17 17:37:02 +0200
commita079118f0877886bd1c838778c26c410675b0b51 (patch)
tree203f5803b2034b0113eafa141a996d7ac24a8757 /builder/modules.d/systemd-networkd-ext
parent[slx-uuid] save uuid under /etc in stage4 (diff)
downloadsystemd-init-a079118f0877886bd1c838778c26c410675b0b51.tar.gz
systemd-init-a079118f0877886bd1c838778c26c410675b0b51.tar.xz
systemd-init-a079118f0877886bd1c838778c26c410675b0b51.zip
[systemd-networkd-ext] add missing 'Path=pci*' to
stage4 dhcp config. Also add DHCP options on VLAN network config
Diffstat (limited to 'builder/modules.d/systemd-networkd-ext')
-rw-r--r--builder/modules.d/systemd-networkd-ext/hooks/configure-dhcp-for-newroot.sh15
-rw-r--r--builder/modules.d/systemd-networkd-ext/hooks/parse-kcl-for-networkd.sh34
2 files changed, 38 insertions, 11 deletions
diff --git a/builder/modules.d/systemd-networkd-ext/hooks/configure-dhcp-for-newroot.sh b/builder/modules.d/systemd-networkd-ext/hooks/configure-dhcp-for-newroot.sh
index 1b300360..299f62b9 100644
--- a/builder/modules.d/systemd-networkd-ext/hooks/configure-dhcp-for-newroot.sh
+++ b/builder/modules.d/systemd-networkd-ext/hooks/configure-dhcp-for-newroot.sh
@@ -11,26 +11,26 @@
. "/run/openslx/pxe-network.conf"
NETWORKD_DIR="/etc/systemd/network"
-mkdir -p "${NEWROOT}/${NETWORKD_DIR}" # dirname a-la bash
+mkdir -p "${NEWROOT}/${NETWORKD_DIR}"
-# First, copy over every configuration made so far
+# First, copy over every configuration made so far,
+# excluding the physical interface if bridged
cp "${NETWORKD_DIR}/${SLX_BRIDGE}"* "${NEWROOT}/${NETWORKD_DIR}"
-# Workaround: UseHostname seems broken, so manually set the hostname for now...
-[ -n "${SLX_HOSTNAME}" ] && echo "${SLX_HOSTNAME}" > $NEWROOT/etc/hostname
-
# Now determine which network configuration we are running
# VLANs are already configured to DHCP, so nothing to do
-if [ -n "${SLX_STAGE4_DHCP}" -o -z "${SLX_VLAN_ID}" ]; then
+if [ -z "${SLX_VLAN_ID}" ]; then
# In both bridged and non-bridged mode, we need to adjust
# the configuration to DHCP for stage4
MATCH_LINE=
+ MATCH_LINE_EXTRA=
MAIN_NET_CONF=
if [ -n "${SLX_BRIDGE}" ]; then
MATCH_LINE="Name=${SLX_BRIDGE}"
MAIN_NETIF_CONF="${NETWORKD_DIR}/${SLX_BRIDGE}.network"
elif [ -n "${SLX_PXE_MAC}" ]; then
MATCH_LINE="MACAddress=${SLX_PXE_MAC}"
+ MATCH_LINE_EXTRA="Path=pci*"
MAIN_NETIF_CONF="${NETWORKD_DIR}/${SLX_PXE_NETIF}.network"
else
emergency_shell "Could not determine network configuration mode!"
@@ -45,6 +45,7 @@ if [ -n "${SLX_STAGE4_DHCP}" -o -z "${SLX_VLAN_ID}" ]; then
cat <<-EOF > "${NEWROOT}/${MAIN_NETIF_CONF}"
[Match]
${MATCH_LINE}
+ ${MATCH_LINE_EXTRA}
[Network]
DHCP=ipv4
@@ -59,3 +60,5 @@ if [ -n "${SLX_STAGE4_DHCP}" -o -z "${SLX_VLAN_ID}" ]; then
EOF
fi
+# Workaround: UseHostname seems broken, so manually set the hostname for now...
+[ -n "${SLX_HOSTNAME}" ] && echo "${SLX_HOSTNAME}" > $NEWROOT/etc/hostname
diff --git a/builder/modules.d/systemd-networkd-ext/hooks/parse-kcl-for-networkd.sh b/builder/modules.d/systemd-networkd-ext/hooks/parse-kcl-for-networkd.sh
index 707557c4..cf61be3c 100644
--- a/builder/modules.d/systemd-networkd-ext/hooks/parse-kcl-for-networkd.sh
+++ b/builder/modules.d/systemd-networkd-ext/hooks/parse-kcl-for-networkd.sh
@@ -98,6 +98,23 @@ create_udev_bootif_name_rule() {
echo 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="'${BOOTIF}'", NAME="'${BOOTIF_NAME}'"' > /etc/udev/rules.d/70-pxe-boot-interface.rules
}
+disable_ipv6() {
+ cat <<- EOF
+ LinkLocalAddressing=no
+ IPv6AcceptRA=no
+ EOF
+}
+
+dhcp_options() {
+ cat <<- EOF
+ [DHCP]
+ UseDNS=true
+ UseDomains=true
+ UseHostname=true
+ CriticalConnection=true
+ EOF
+}
+
## Generate network and link file(s) for networkd
# Checks if an IP configuration was forwarded by
generate_networkd_config() {
@@ -115,6 +132,7 @@ generate_networkd_config() {
# In particular, configuring both vlan tags and the physical
# interface is not supported (might be needed in some setups)
echo '[Network]'
+ disable_ipv6
if [ -n "${BRIDGED}" ]; then
echo "Bridge=${BRIDGE_NAME}"
elif [ -n "${CLIENT_IP}" -a -n "${GATEWAY_IP}" ]; then
@@ -122,9 +140,9 @@ generate_networkd_config() {
elif [ -n "${VLAN}" ]; then
echo "VLAN=$BOOTIF_NAME.$VLAN"
else
- echo "DHCP=ipv4"
+ echo -e "DHCP=ipv4\n"
+ dhcp_options
fi
- echo "LinkLocalAddressing=no"
) > "${BOOTIF_NETWORK_CONF}"
if [ -n "$VLAN" ]; then
@@ -151,8 +169,12 @@ generate_networkd_config() {
[Network]
DHCP=ipv4
- LinkLocalAddressing=no
EOF
+ (
+ disable_ipv6
+ echo ""
+ dhcp_options
+ ) >> "${VLAN_NETWORK_CONF}"
fi
# bridge setup
@@ -171,17 +193,19 @@ generate_networkd_config() {
echo "Name=${BRIDGE_NAME}"
echo ""
echo '[Network]'
+ disable_ipv6
if [ -n "${CLIENT_IP}" -a -n "${GATEWAY_IP}" ]; then
print_static_ip_conf "${CLIENT_IP}/${CIDR:-24}" "${GATEWAY_IP}"
else
# bad/no IP info, fallback to DHCP
- echo "DHCP=ipv4"
+ echo -e "DHCP=ipv4\n"
+ dhcp_options
fi
- echo "LinkLocalAddressing=no"
) > "${BRIDGE_NETWORK_CONF}"
fi
return 0
}
+
# from parse-ip-opts.sh
# Takes a netmask and outputs the corresponding CIDR
# e.g.