Skip to content

Commit

Permalink
Aligned unknown net value in update methods
Browse files Browse the repository at this point in the history
Signed-off-by: pierantoniomerlino <[email protected]>
  • Loading branch information
pierantoniomerlino authored and MMaiero committed Oct 11, 2023
1 parent 70de7bf commit 016ebd3
Showing 1 changed file with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
public class GwtNetworkServiceImpl {

private static final String FIREWALL_CONFIGURATION_SERVICE_PID = "org.eclipse.kura.net.admin.ipv6.FirewallConfigurationServiceIPv6";
private static final String UNKNOWN_NETWORK = "::/0";
private static final String UNKNOWN_NETWORK_SHORT = "::/0";
private static final String UNKNOWN_NETWORK_LONG = "0:0:0:0:0:0:0:0/0";

private GwtNetworkServiceImpl() {

Expand Down Expand Up @@ -319,8 +320,8 @@ public static void updateDeviceFirewallOpenPortsIPv6(List<GwtFirewallOpenPortEnt
for (GwtFirewallOpenPortEntry entry : entries) {
openPorts.append(entry.getPortRange()).append(",");
openPorts.append(entry.getProtocol()).append(",");
if (entry.getPermittedNetwork() == null || entry.getPermittedNetwork().equals(UNKNOWN_NETWORK)) {
openPorts.append(UNKNOWN_NETWORK);
if (entry.getPermittedNetwork() == null || entry.getPermittedNetwork().equals(UNKNOWN_NETWORK_LONG)) {
openPorts.append(UNKNOWN_NETWORK_SHORT);
} else {
appendNetwork(entry.getPermittedNetwork(), openPorts);
}
Expand Down Expand Up @@ -372,8 +373,8 @@ public static void updateDeviceFirewallPortForwardsIPv6(List<GwtFirewallPortForw
portForwarding.append("false");
}
portForwarding.append(",");
if (entry.getPermittedNetwork() == null || entry.getPermittedNetwork().equals(UNKNOWN_NETWORK)) {
portForwarding.append(UNKNOWN_NETWORK);
if (entry.getPermittedNetwork() == null || entry.getPermittedNetwork().equals(UNKNOWN_NETWORK_LONG)) {
portForwarding.append(UNKNOWN_NETWORK_SHORT);
} else {
appendNetwork(entry.getPermittedNetwork(), portForwarding);
}
Expand Down Expand Up @@ -406,14 +407,14 @@ public static void updateDeviceFirewallNATsIPv6(List<GwtFirewallNatEntry> entrie
nat.append(entry.getInInterface()).append(",");
nat.append(entry.getOutInterface()).append(",");
nat.append(entry.getProtocol()).append(",");
if (UNKNOWN_NETWORK.equals(entry.getSourceNetwork())) {
nat.append(UNKNOWN_NETWORK);
if (UNKNOWN_NETWORK_LONG.equals(entry.getSourceNetwork())) {
nat.append(UNKNOWN_NETWORK_SHORT);
} else {
appendNetwork(entry.getSourceNetwork(), nat);
}
nat.append(",");
if (UNKNOWN_NETWORK.equals(entry.getDestinationNetwork())) {
nat.append(UNKNOWN_NETWORK);
if (UNKNOWN_NETWORK_LONG.equals(entry.getDestinationNetwork())) {
nat.append(UNKNOWN_NETWORK_SHORT);
} else {
appendNetwork(entry.getDestinationNetwork(), nat);
}
Expand Down

0 comments on commit 016ebd3

Please sign in to comment.