Fix handling of no port setting in IPv6
authorMateusz Majewski <m.majewski2@samsung.com>
Tue, 12 Jan 2021 14:08:35 +0000 (15:08 +0100)
committerMateusz Majewski <m.majewski2@samsung.com>
Thu, 14 Jan 2021 12:00:37 +0000 (13:00 +0100)
IPv4 implementation contains exact same fix, but somebody forgot to copy
it into IPv6.

Change-Id: I7f21a7273096b96bb0769b6deb9cb351da443178

src/helper/helper-ip6tables.c

index e456864a1dc44dcf5ad71f2cab193519226fd558..28926f581b19a03a3755361dea65976b33921cbd 100755 (executable)
@@ -166,6 +166,8 @@ static unsigned int __add_port_match(ip6tables_protocol_type_e prot_type,
                                tcp.spts[1] = ntohs(htons(sport2));
                                break;
                        default:
+                               tcp.spts[0] = 0x0000;
+                               tcp.spts[1] = 0xFFFF;
                                break;
                        }
                        switch(dport_type) {
@@ -180,6 +182,8 @@ static unsigned int __add_port_match(ip6tables_protocol_type_e prot_type,
                                tcp.dpts[1] = ntohs(htons(dport2));
                                break;
                        default:
+                               tcp.dpts[0] = 0x0000;
+                               tcp.dpts[1] = 0xFFFF;
                                break;
                        }
                        return __add_match(IP6TC_TCP, start, 0, sizeof(ip6t_tcp_info_t), &tcp);
@@ -200,6 +204,8 @@ static unsigned int __add_port_match(ip6tables_protocol_type_e prot_type,
                                udp.spts[1] = ntohs(htons(sport2));
                                break;
                        default:
+                               udp.spts[0] = 0x0000;
+                               udp.spts[1] = 0xFFFF;
                                break;
                        }
                        switch(dport_type) {
@@ -214,6 +220,8 @@ static unsigned int __add_port_match(ip6tables_protocol_type_e prot_type,
                                udp.dpts[1] = ntohs(htons(dport2));
                                break;
                        default:
+                               udp.dpts[0] = 0x0000;
+                               udp.dpts[1] = 0xFFFF;
                                break;
                        }
                        return __add_match(IP6TC_UDP, start, 0, sizeof(ip6t_udp_info_t), &udp);