-
Notifications
You must be signed in to change notification settings - Fork 7.7k
net: ppp: ipcp: Improvements to DNS option negotiation #93181
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
base: main
Are you sure you want to change the base?
net: ppp: ipcp: Improvements to DNS option negotiation #93181
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR modifies PPP IPCP (Internet Protocol Control Protocol) negotiation to conditionally request DNS addresses based on configuration needs. The implementation ensures DNS options are only included in IPCP requests when actually required, and fixes DNS serving to use peer options instead of local options.
- Conditionally compiles DNS-related functions and options based on
CONFIG_NET_L2_PPP_OPTION_DNS_USE
- Updates
IPCP_NUM_MY_OPTIONS
to reflect the actual number of options being used - Changes DNS serving logic to use
peer_options
instead ofmy_options
for proper IPCP ConfNak responses
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
subsys/net/l2/ppp/ipcp.c | Wraps DNS functions in conditional compilation and fixes DNS serving source |
include/zephyr/net/ppp.h | Makes IPCP_NUM_MY_OPTIONS conditional based on DNS usage configuration |
Logs from running this against Linux PPPD Without the change
As seen, Zephyr side is sending With this change
PPPD logs when using
PPPD logs without the
As seen, when PPPD is not requesting a |
a7045b2
to
b47e462
Compare
When Kconfig option CONFIG_NET_L2_PPP_OPTION_DNS_USE is enabled, Zephyr should request two DNS addresses in IPCP negotiation by sending IPCP ConfReq for DNS otions using 0.0.0.0 as an address. Remote peer may offer DNS by sending IPCP ConfNak with proper address. This is explained in RFC 1332 and RFC 1877 (DNS extension). When no DNS is required, we should only send IPCP ConfReq for IP address, without having DNS fields in the same request. However, when PPP is configured to serve a DNS using Kconfig option CONFIG_NET_L2_PPP_OPTION_SERVE_DNS it should serve the DNS address in the IPCP ConfNak message and from the ipcp.peer_options structure, not from the ipcp.my_options. This might break backward compatibility outside this repository as DNS addresses used to be served from ipcp.my_options. Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
b47e462
to
774e2dc
Compare
There are cases, for example when peer is requesting two DNS addresses, but we can only give one, we should reject the secondary DNS request first, before sending NAK to acceptable options. Option parser can reject a parameter by returning -ENOTSUP and when it wants to NAK the parameter, it returns -EINVAL. On RFC 1661: Configure-Reject If some Configuration Options received in a Configure-Request are not recognizable or are not acceptable for negotiation (as configured by a network administrator), then the implementation MUST transmit a Configure-Reject. Configure-Nak If every instance of the received Configuration Options is recognizable, but some values are not acceptable, then the implementation MUST transmit a Configure-Nak. So as stated by RFC, we should start the negotiation by rejecting all parameters that we cannot configure. I added an example of rejecting DNS requests, if we don't have those. Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
|
After testing this a bit against the Linux PPPD, I decided to add a second commit into this PR. net: ppp: Allow peer-options to be rejectedThere are cases, for example when peer is requesting two DNS Option parser can reject a parameter by returning -ENOTSUP and when On RFC 1661:
Configure-Nak
So as stated by RFC, we should start the negotiation by rejecting all Test log from Linux PPPD
As seen, now it clearly rejects the |
When Kconfig option CONFIG_NET_L2_PPP_OPTION_DNS_USE is enabled, Zephyr should request two DNS addresses in IPCP negotiation by sending IPCP ConfReq for DNS otions using 0.0.0.0 as an address.
Remote peer may offer DNS by sending IPCP ConfNak with proper address. This is explained in RFC 1332 and RFC 1877 (DNS extension).
When no DNS is required, we should only send IPCP ConfReq for IP address, without having DNS fields in the same request.
However, when PPP is configured to serve a DNS using Kconfig option CONFIG_NET_L2_PPP_OPTION_SERVE_DNS it should serve the DNS address in the IPCP ConfNak message and from the ipcp.peer_options structure, not from the ipcp.my_options.
This might break backward compatibility outside this repository as DNS addresses used to be served from ipcp.my_options.