-
Notifications
You must be signed in to change notification settings - Fork 315
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
fix: Do not include router option if no nat #5727
base: develop
Are you sure you want to change the base?
Conversation
@MMaiero I verified the issue on my device and that this PR fixes it. I tested the solution with However, it seems that if the framework is configured in ![]() I don't think that this is a correct configuration. I know that it's bit out of scope... |
1fffef8
to
0e54fcf
Compare
efd88e7
to
553ee87
Compare
8afb682
to
11d437e
Compare
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.
PR Overview
This pull request ensures that the router option is omitted in the DHCP configuration when NAT is disabled. Key changes include updates to test cases to cover NAT enabled/disabled scenarios, modifications in the DHCP server configuration writer to conditionally set the router, and adjustments in the DHCP config converters (Dhcpd, Dnsmasq, and Udhcpd) to properly handle the absence of a router address.
Reviewed Changes
File | Description |
---|---|
kura/test/org.eclipse.kura.nm.test/src/test/java/org/eclipse/kura/nm/configuration/writer/DhcpServerConfigWriterTest.java | Added test cases to cover scenarios with NAT disabled. |
kura/org.eclipse.kura.nm/src/main/java/org/eclipse/kura/nm/configuration/writer/DhcpServerConfigWriter.java | Updated to conditionally set the router field based on the NAT flag. |
kura/org.eclipse.kura.linux.net/src/main/java/org/eclipse/kura/linux/net/dhcp/server/DhcpdConfigConverter.java | Refactored configuration appending by splitting DNS, interface, router, lease times, and pool range into dedicated methods. |
kura/test/org.eclipse.kura.linux.net.test/src/test/java/org/eclipse/kura/linux/net/dhcp/server/DhcpdConfigConverterTest.java | Updated expected configurations for NAT disabled scenarios. |
kura/org.eclipse.kura.linux.net/src/main/java/org/eclipse/kura/linux/net/dhcp/server/DnsmasqConfigConverter.java | Adjusted the router option handling to conditionally include the router value. |
kura/org.eclipse.kura.linux.net/src/main/java/org/eclipse/kura/linux/net/dhcp/server/UdhcpdConfigConverter.java | Modified to conditionally output the router line based on its availability. |
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
String routerAddress = isNull(config.getRouterAddress()) ? "" : "," + config.getRouterAddress().toString(); | ||
sb.append(DHCP_OPTION_KEY).append(config.getInterfaceName()).append(",3").append(routerAddress).append("\n"); | ||
|
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.
When 'nat.enabled' is false and config.getRouterAddress() is null, this line produces a router option output like 'dhcp-option=eth0,3' without a value. To adhere to the PR intent of omitting the router option entirely, consider conditionally skipping the entire router option line when routerAddress is null.
String routerAddress = isNull(config.getRouterAddress()) ? "" : "," + config.getRouterAddress().toString(); | |
sb.append(DHCP_OPTION_KEY).append(config.getInterfaceName()).append(",3").append(routerAddress).append("\n"); | |
if (!isNull(config.getRouterAddress())) { | |
String routerAddress = "," + config.getRouterAddress().toString(); | |
sb.append(DHCP_OPTION_KEY).append(config.getInterfaceName()).append(",3").append(routerAddress).append("\n"); | |
} |
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
Signed-off-by: MMaiero <[email protected]>
Signed-off-by: MMaiero <[email protected]>
Signed-off-by: MMaiero <[email protected]>
Signed-off-by: MMaiero <[email protected]>
Signed-off-by: MMaiero <[email protected]>
Signed-off-by: MMaiero <[email protected]>
Signed-off-by: MMaiero <[email protected]>
Signed-off-by: MMaiero <[email protected]>
Signed-off-by: MMaiero <[email protected]>
Signed-off-by: MMaiero <[email protected]>
Signed-off-by: MMaiero <[email protected]>
Signed-off-by: MMaiero <[email protected]>
Signed-off-by: MMaiero <[email protected]>
11d437e
to
b0cbbcb
Compare
Brief description of the PR. [e.g. Added
null
check onobject
to avoidNullPointerException
]Related Issue: This PR fixes/closes {issue number}
Description of the solution adopted: A more detailed description of the changes made to solve/close one or more issues. If the PR is simple and easy to understand this section can be skipped
Screenshots: If applicable, add screenshots to help explain your solution
Manual Tests: Optional description of the tests performed to check correct functioning of changes, useful for an efficient review
Any side note on the changes made: Description of any other change that has been made, which is not directly linked to the issue resolution [e.g. Code clean up/Sonar issue resolution]