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 vlan support to embedded script: #44

Merged
merged 2 commits into from
Sep 8, 2022

Conversation

jacobweinstock
Copy link
Member

Description

This allows creating an interface with a vlan tag based off of DHCP option 43, suboption 116. This will not change the existing behavior. The vlan interface is only created if DHCP option 43.116 is set. This PR is the start of the implementation of proposal 28.

Why is this needed

Fixes: #

How Has This Been Tested?

I have manually test this.

How are existing users impacted? What migration steps/scripts do we need?

No impact.

Checklist:

I have:

  • updated the documentation and/or roadmap (if required)
  • added unit or e2e tests
  • provided instructions on how to upgrade

This allows creating an interface with a vlan
tag based off of DHCP option 43, suboption 116.

Signed-off-by: Jacob Weinstock <[email protected]>
@jacobweinstock jacobweinstock added the kind/feature New feature or request label Sep 8, 2022
@codecov
Copy link

codecov bot commented Sep 8, 2022

Codecov Report

Merging #44 (55f6930) into main (59f736c) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main      #44   +/-   ##
=======================================
  Coverage   97.10%   97.10%           
=======================================
  Files           4        4           
  Lines         415      415           
=======================================
  Hits          403      403           
  Misses          8        8           
  Partials        4        4           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@@ -6,4 +6,21 @@ echo Welcome to Neverland!
# Allow the operator to drop to a shell
prompt --key 0x02 --timeout 2000 Press Ctrl-B for the iPXE command line... && shell ||

set vlan-id ${43.116:string}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused. If this is the script embedded in our ipxe binaries, at this point I would have expected that DHCP hasn't happened yet from the perspective of ipxe... How would that value have been populated at this point?

Do we need to split out an explicit dhcp from the autoboot part?

Copy link
Member Author

@jacobweinstock jacobweinstock Sep 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a great point. I will add a comment above this value to explain. My understanding of iPXE is that "the original vendor PXE DHCP request [is] available within [the chainloaded] UEFI iPXE [and] BIOS iPXE" -- ref. This bears out in my testing, jfyi.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for adding the comment in there!

When chainloading from an original vendor PXE
the DHCP options it received are available to
the chainloaded binary. This allows us to pull
out option 43.116 and use it to set up the vlan
interface before autoboot-ing which does another
DHCP PXE request.

Signed-off-by: Jacob Weinstock <[email protected]>
Copy link
Member

@nshalman nshalman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the explanation!
I've noted one other place where I'm a little confused, but I don't want to block this if all the testing shows it working as expected so far.

@@ -6,4 +6,21 @@ echo Welcome to Neverland!
# Allow the operator to drop to a shell
prompt --key 0x02 --timeout 2000 Press Ctrl-B for the iPXE command line... && shell ||

set vlan-id ${43.116:string}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for adding the comment in there!

:boot-with-vlan
set idx:int32 0
# Find the first interface that is configured
:loop isset ${net${idx}/mac} && goto loop_done ||
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you by any chance test this on a machine with multiple NICs and verify that it behaves correctly booting from all of them?

To my eye I'd expect this to find the first NIC with a valid MAC address.

I wonder if there are any other hints from the prior DHCP request that could be helpful here?

I'm mostly flagging this as a place to look for bugs later. I think we should land this so that further testing can proceed. It's already a big step up.

Copy link
Member Author

@jacobweinstock jacobweinstock Sep 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another great point! yes, i did test with multiple network interfaces. I found that when the PXE firmware would request PXE it would show trying against, for example, net0, net1, etc but once our iPXE binary was loaded, i found that only net0 was available regardless of the firmware PXE net number. That was my very specific testing.

Copy link
Contributor

@mmlb mmlb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, I trust your testing @jacobweinstock and @nshalman's 👍 too :D

@mmlb mmlb added the ready-to-merge Mergify: Ready for Merging label Sep 8, 2022
@mergify mergify bot merged commit c811281 into tinkerbell:main Sep 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature New feature or request ready-to-merge Mergify: Ready for Merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants