Skip to content

Commit 03a6772

Browse files
authored
Fix dhcp.sh script; update kernel (#158)
## Description `dhcp.sh` wasn't posix compliant and was failing to work accurately. Update the kernel to the latest build. ## Why is this needed Fixes: # ## How Has This Been Tested? Manually tested. ## How are existing users impacted? What migration steps/scripts do we need? ## Checklist: I have: - [ ] updated the documentation and/or roadmap (if required) - [ ] added unit or e2e tests - [ ] provided instructions on how to upgrade
2 parents ad7836d + 2107352 commit 03a6772

File tree

2 files changed

+4
-20
lines changed

2 files changed

+4
-20
lines changed

files/dhcp.sh

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,17 @@
77
# false: run the dhcp client as a service
88
set -x
99

10-
parse_cmdline() {
11-
c=$(cat /proc/cmdline)
12-
c="${c##*"$1"=}"
13-
c="${c%% *}"
14-
echo "$c"
15-
}
16-
1710
run_dhcp_client() {
1811
one_shot="$1"
1912
al="eth*"
2013

21-
vlan_id=$(parse_cmdline vlan_id)
22-
if [ -n "$vlan_id" ]; then
14+
if grep "vlan_id" /proc/cmdline; then
2315
al="eth*.*"
2416
fi
2517

26-
# Boots send kernel command line parameter "ip=dhcp", this causes the system to configure the network interface(s) with DHCP.
27-
# When an environment's network configuration has this machine connected a trunked interface with a default/native VLAN, the
28-
# interface will be configured on the default/native VLAN because we haven't yet configured the VLAN interface. Boots will respond
29-
# to this DHCP request because in this scenario it is not VLAN aware. Also in this scenario, the machine will end up being configured
30-
# with 2 default routes. To resolve this, we remove the default route and IP that kernel added and let the dhcpcd handle setting the route.
31-
ip route del default || true
32-
ipa=$(ip -4 -o addr show dev eth0 | awk '{print $4}')
33-
ip addr del dev eth0 "$ipa" || true
34-
3518
if [ "$one_shot" = "true" ]; then
36-
/sbin/dhcpcd --nobackground -f /dhcpcd.conf --allowinterfaces "${al}" -1
19+
# always return true for the one shot dhcp call so it doesn't block Hook from starting up.
20+
/sbin/dhcpcd --nobackground -f /dhcpcd.conf --allowinterfaces "${al}" -1 || true
3721
else
3822
/sbin/dhcpcd --nobackground -f /dhcpcd.conf --allowinterfaces "${al}"
3923
fi

hook.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
kernel:
2-
image: quay.io/tinkerbell/hook-kernel:5.10.85-5604bb0dc1cdb6263770a82bf91cbf7e00ffdd5c
2+
image: quay.io/tinkerbell/hook-kernel:5.10.85-d1225df88208e5a732e820a182b75fb35c737bdd
33
cmdline: "console=tty0 console=ttyS0 console=ttyAMA0 console=ttysclp0"
44

55
init:

0 commit comments

Comments
 (0)