Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add IPv6 PxE support #227

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add IPv6 PxE support #227

wants to merge 1 commit into from

Conversation

rikka0w0
Copy link

@rikka0w0 rikka0w0 commented Jan 5, 2025

Add the missing feature mentioned in #99.

New config in /etc/config/dhcp:

config boot6
        option url 'tftp://[fd2b:dca9:fd11::1]/ipxe_x86_64.efi'
        option arch '7'

config boot6
        option url 'tftp://[fd2b:dca9:fd11::1]/ipxe_default.bin'

The patched odhcpd will send IPv6 PxE URLs in the Advertise message, according to the arch code specified in the Solicit message from the client.

The debugging procedure is similar to: USE_SOURCE_DIR

Workspace setup:

git clone [email protected]:rikka0w0/odhcpd.git
git clone https://github.com/openwrt/openwrt.git
ln -s odhcpd/.git openwrt/package/network/services/odhcpd/git-src
cd openwrt
make tools/compile -j32
make toolchain/compile -j32

Compile:

git add -A
git commit --amend --no-edit --allow-empty
make package/network/services/odhcpd/{clean,compile} -j32

Capture DHCPv6 packets on OpenWrt device:
tcpdump -i br-lan.1 'port 547' -v -n -w pxe.pcap

Binaries are:

bin/packages/x86_64/base/odhcpd_2023-10-24-d8118f6e-1_x86_64.ipk
build_dir/target-x86_64_musl/odhcpd-ipv6only/odhcpd-2023-10-24-d8118f6e/odhcpd

Build from SDK (A LOT faster)

#!/bin/sh

wget -O openwrt-sdk.tar.xz https://mirrors.cicku.me/openwrt/releases/23.05.5/targets/x86/64/openwrt-sdk-23.05.5-x86-64_gcc-12.3.0_musl.Linux-x86_64.tar.xz
tar xf openwrt-sdk.tar.xz
rm openwrt-sdk.tar.xz
cd openwrt-sdk*
SDK_DIR=$(pwd)

sed -i -E 's~https://git\.openwrt\.org/[A-Za-z]+/([^.]+)\.git~https://github.com/openwrt/\1.git~g' feeds.conf.default
./scripts/feeds update base
./scripts/feeds install -a -p base


MAKEFILE="package/feeds/base/odhcpd/Makefile"
# Replace PKG_SOURCE_URL line
sed -i 's|^PKG_SOURCE_URL=.*|PKG_SOURCE_URL=https://github.com/rikka0w0/odhcpd.git|' "$MAKEFILE"

# Update PKG_SOURCE_DATE
sed -i 's|\(PKG_SOURCE_DATE:=\).*|\12025-01-06|' "$MAKEFILE"

# Update PKG_SOURCE_VERSION
sed -i 's|\(PKG_SOURCE_VERSION:=\).*|\1e0c6642e306ac4cfae879660b0acb901552f16d3|' "$MAKEFILE"

# Update PKG_MIRROR_HASH
sed -i 's|\(PKG_MIRROR_HASH:=\).*|\1361efbf7110601e769ceed5c74b2e9f663b2fe265e6fb39c9fa2fc83a0b2b406|' "$MAKEFILE"

make defconfig
make package/feeds/base/odhcpd/{clean,download,compile} -j$(nproc)

ls bin/packages/x86_64/base/odhcpd*

@rikka0w0 rikka0w0 marked this pull request as ready for review January 5, 2025 07:31
@dedeckeh
Copy link
Contributor

dedeckeh commented Jan 5, 2025

Squash the different commits into one commit and add your SoB to the patch (see also https://openwrt.org/submitting-patches)

1. Implement PxE in separate files where possible
2. Update README
3. User can add IPv6 PxE entries in `/etc/config/dhcp`.
4. The new section type is "boot6".
5. The compulsory "url" string specifies the URL to the bootable image.
6. The optional "arch" integer specifies the expected client machine type.
7. The last "boot6" section without "arch" defines the default bootable image.

Signed-off-by: Hang Zhou <[email protected]>
@rikka0w0
Copy link
Author

rikka0w0 commented Jan 8, 2025

Squash the different commits into one commit and add your SoB to the patch (see also https://openwrt.org/submitting-patches)

I have squashed the commit and signed it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants