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

Added PXE DHCP options #559

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

Added PXE DHCP options #559

wants to merge 3 commits into from

Conversation

Qubasa
Copy link
Contributor

@Qubasa Qubasa commented Oct 24, 2021

I added three new DHCP options for PXE boot defined in this RFC4578
Appropriate tests have been added too. I also added two option fields vendor id and time offset from RFC2132

@Qubasa Qubasa force-pushed the pxe_support branch 3 times, most recently from e41c8ec to 7064337 Compare October 26, 2021 21:04
Copy link
Member

@Dirbaio Dirbaio left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! Code looks good.

The DHCP fuzzer (#562) found a few issues though.

  • Out of bounds at line 215 if option data length is 0.
  • emit panics at line 306, maybe something wrong in buffer_len.

Could you fix them, and then run the fuzzer yourself to check there are no more? If you get the fuzzer to run for 10-15min without finding anything it should be good to go.

src/wire/dhcpv4.rs Show resolved Hide resolved
src/wire/dhcpv4.rs Outdated Show resolved Hide resolved
@@ -166,13 +362,39 @@ impl<'a> DhcpOption<'a> {
}
_ => {
skip_length = self.buffer_len();

assert!(skip_length <= buffer.len());
Copy link
Contributor Author

@Qubasa Qubasa Nov 21, 2021

Choose a reason for hiding this comment

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

@whitequark @Dirbaio I have a problem I can't return an error in this function, so in the case someone puts an 'Other' option with a very large payload into the function and the supplied buffer is smaller, then this function panics. I don't want to silently return and ignore the option either. But the fuzzer will find this crash and stop there. What I did now is insert an assert so the panic is easier to reason about

Copy link
Member

Choose a reason for hiding this comment

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

It's OK for emit to panic if the supplied buffer len is not exactly equal to the length provided by buffer_len.It's the caller's responsibility to ensure that.

I guess it's either a bug in the fuzzer (but from a quick look it looks OK to me) or a mismatch in the length you return from buffer_len and the length you require in emit...

Copy link
Contributor Author

@Qubasa Qubasa Nov 21, 2021

Choose a reason for hiding this comment

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

@Dirbaio Ah alright yeah the Repr returns the incorrect size and the fuzzer allocates exactly that size, I see! As I'm looking into it that bug already existed beforehand

@Qubasa
Copy link
Contributor Author

Qubasa commented Mar 7, 2022

If someone wants to open up a new reworked pull request go ahead :-) I sadly won't be able to work on this for at least a couple of months sadly

@Dirbaio Dirbaio marked this pull request as draft March 20, 2022 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants