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 relaxed padding setting to the nclient4 #543

Closed

Conversation

Bogdan-Denisenko
Copy link
Contributor

RFC 2132 says:
The end option marks the end of valid information in the vendor field. Subsequent octets should be filled with pad options.

But it seems that this does not mean that the client should consider packages with non-pad options after the End option invalid, because RFC 2119 explains:
3. SHOULD This word, or the adjective "RECOMMENDED", mean that there may exist valid reasons in particular circumstances to ignore a particular item, but the full implications must be understood and carefully weighed before choosing a different course.

So we need a way to accept packets not padded with zeros.

@Bogdan-Denisenko
Copy link
Contributor Author

@pmazzini review required

@pmazzini pmazzini requested a review from hugelgupf July 31, 2024 10:21
Copy link

codecov bot commented Jul 31, 2024

Codecov Report

Attention: Patch coverage is 57.14286% with 6 lines in your changes missing coverage. Please review.

Project coverage is 73.83%. Comparing base (bf3278a) to head (475cd0f).
Report is 2 commits behind head on master.

Files Patch % Lines
dhcpv4/nclient4/client.go 16.66% 5 Missing ⚠️
dhcpv4/dhcpv4.go 66.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #543      +/-   ##
==========================================
+ Coverage   73.77%   73.83%   +0.05%     
==========================================
  Files          81       81              
  Lines        5122     5141      +19     
==========================================
+ Hits         3779     3796      +17     
- Misses       1200     1202       +2     
  Partials      143      143              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pmazzini
Copy link
Collaborator

I am not sure if we should make this an optional parsing or if it should make it the default one. cc @hugelgupf

Signed-off-by: Bogdan-Denisenko <bogdandenisenko28@gmail.com>
@Bogdan-Denisenko
Copy link
Contributor Author

I am not sure if we should make this an optional parsing or if it should make it the default one. cc @hugelgupf

Yes, I think it makes sense to make this behavior the default. I made it optional just to avoid changing the behavior of the exported functions.

@pmazzini
Copy link
Collaborator

pmazzini commented Aug 5, 2024

I made it optional just to avoid changing the behavior of the exported functions

Which functions? What is the benefit of having 2 behaviors?

@Bogdan-Denisenko
Copy link
Contributor Author

Which functions? What is the benefit of having 2 behaviors?

Functions dhcp4.FromBytes() and dhcp4.Options.FromBytes(). In my opinion it's better to just remove the check for zero-padded packets or at least make such behavior default, because it seems that such packets should be considered valid according to RFC and I don't see any benefits from the possibility to consider such packets invalid. But this would change the behavior of exported (public) functions. Is it consistent with the backward compatibility policy of this project?

@Bogdan-Denisenko
Copy link
Contributor Author

@pmazzini Opened alternative PR with zero padding checking disabled by default - #545.

@pmazzini
Copy link
Collaborator

Continuation in #545

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