From ddd631aacba00e357bb53697aad60df5ee369959 Mon Sep 17 00:00:00 2001 From: Vasyl Saienko Date: Wed, 27 May 2020 07:07:59 +0000 Subject: [PATCH] [tinyipa] Fix getting MTU via dhcp The patch updates udhcpc script to handle MTU option advertised by DHCP server. Change-Id: I2708b71abfe3bc24089f4a51514d362da1491c66 --- tinyipa/build_files/bootlocal.sh | 38 ++++++++++++++++++-------------- tinyipa/udhcpc.script | 1 + 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/tinyipa/build_files/bootlocal.sh b/tinyipa/build_files/bootlocal.sh index 56c3a62..b87297a 100755 --- a/tinyipa/build_files/bootlocal.sh +++ b/tinyipa/build_files/bootlocal.sh @@ -38,23 +38,6 @@ sudo mkdir -p /etc/ipa-rescue-config export PYTHONOPTIMIZE=1 -# Run IPA -echo "Starting Ironic Python Agent:" -date -ironic-python-agent 2>&1 | tee /var/log/ironic-python-agent.log - - -create_rescue_user() { - crypted_pass=$(cat /etc/ipa-rescue-config/ipa-rescue-password) - sudo adduser rescue -D -G root # no useradd - echo "rescue:$crypted_pass" | sudo chpasswd -e - sudo sh -c "echo \"rescue ALL=(ALL) NOPASSWD: ALL\" >> /etc/sudoers" # no suooers.d in tiny core. - - # Restart sshd with allowing password authentication - sudo sed -i -e 's/^PasswordAuthentication no/PasswordAuthentication yes/' /usr/local/etc/ssh/sshd_config - sudo /usr/local/etc/init.d/openssh restart -} - # Setup DHCP network configure_dhcp_network() { for pidfile in `ls /var/run/udhcpc*.pid`; do @@ -74,8 +57,29 @@ configure_dhcp_network() { ip addr && true } +# Configure networking, use custom udhcpc script to handle MTU option +configure_dhcp_network + +# Run IPA +echo "Starting Ironic Python Agent:" +date +ironic-python-agent 2>&1 | tee /var/log/ironic-python-agent.log + + +create_rescue_user() { + crypted_pass=$(cat /etc/ipa-rescue-config/ipa-rescue-password) + sudo adduser rescue -D -G root # no useradd + echo "rescue:$crypted_pass" | sudo chpasswd -e + sudo sh -c "echo \"rescue ALL=(ALL) NOPASSWD: ALL\" >> /etc/sudoers" # no suooers.d in tiny core. + + # Restart sshd with allowing password authentication + sudo sed -i -e 's/^PasswordAuthentication no/PasswordAuthentication yes/' /usr/local/etc/ssh/sshd_config + sudo /usr/local/etc/init.d/openssh restart +} + if [ -f /etc/ipa-rescue-config/ipa-rescue-password ]; then create_rescue_user || exit 0 + # The network might change during rescue, renew addresses in this case. configure_dhcp_network || exit 0 else echo "IPA has exited. No rescue password file was defined." diff --git a/tinyipa/udhcpc.script b/tinyipa/udhcpc.script index ecd008c..274d782 100755 --- a/tinyipa/udhcpc.script +++ b/tinyipa/udhcpc.script @@ -37,6 +37,7 @@ case "$1" in echo adding dns $i echo nameserver $i >> $RESOLV_CONF done + [ -n "$mtu" ] && /sbin/ifconfig $interface mtu $mtu ;; esac