Blame SOURCES/firewalld-0.4.4.4-support_sctp_and_dccp_rhbz#1429808.patch

843f86
commit 3e0997f5effaec309e03c9c7c639d8243536ad37
843f86
Author: Thomas Woerner <twoerner@redhat.com>
843f86
Date:   Tue Apr 4 19:03:27 2017 +0200
843f86
843f86
    Support sctp and dccp in ports, source-ports, forward-ports, helpers and rich rules
843f86
    
843f86
    This patch adds support to use ports with the protocols sctp and dccp if also
843f86
    a port id is specified. The use of sctp and dccp is now also allowed in
843f86
    source-ports, forward-ports, helpers and rich language rules.
843f86
    
843f86
    The test suite has been expanded to also test the new combinations.
843f86
    
843f86
    This fixes RHBZ#1429808
843f86
843f86
diff --git a/doc/xml/firewalld.helper.xml b/doc/xml/firewalld.helper.xml
843f86
index 9de4589..d931e22 100644
843f86
--- a/doc/xml/firewalld.helper.xml
843f86
+++ b/doc/xml/firewalld.helper.xml
843f86
@@ -69,7 +69,7 @@
843f86
 <helper module="<replaceable>nf_conntrack_module</replaceable>" [family="<literal>ipv4</literal>|<literal>ipv6</literal>"]>
843f86
   <short><replaceable>short</replaceable></short>
843f86
   <description><replaceable>description</replaceable></description>
843f86
-  <port <replaceable>portid</replaceable>[-<replaceable>portid</replaceable>]" protocol="<literal>tcp</literal>|<literal>udp</literal>"/>
843f86
+  <port <replaceable>portid</replaceable>[-<replaceable>portid</replaceable>]" protocol="<literal>tcp</literal>|<literal>udp</literal>|<literal>sctp</literal>|<literal>dccp</literal>"/>
843f86
 </helper>
843f86
       </programlisting>
843f86
     </para>
843f86
@@ -149,7 +149,7 @@
843f86
 	  <term>protocol="<replaceable>string</replaceable>"</term>
843f86
           <listitem>
843f86
 	    <para>
843f86
-              The protocol value can either be <option>tcp</option> or <option>udp</option>.
843f86
+              The protocol value can either be <option>tcp</option>, <option>udp</option>, <option>sctp</option> or <option>dccp</option>.
843f86
 	    </para>
843f86
 	  </listitem>
843f86
 	</varlistentry>
843f86
diff --git a/doc/xml/firewalld.service.xml b/doc/xml/firewalld.service.xml
843f86
index 568555f..425f5a9 100644
843f86
--- a/doc/xml/firewalld.service.xml
843f86
+++ b/doc/xml/firewalld.service.xml
843f86
@@ -136,7 +136,7 @@
843f86
 	  <term>protocol="<replaceable>string</replaceable>"</term>
843f86
           <listitem>
843f86
 	    <para>
843f86
-              The protocol value can either be <option>tcp</option> or <option>udp</option>.
843f86
+              The protocol value can either be <option>tcp</option>, <option>udp</option>, <option>sctp</option> or <option>dccp</option>.
843f86
 	    </para>
843f86
 	  </listitem>
843f86
 	</varlistentry>
843f86
@@ -185,7 +185,7 @@
843f86
 	  <term>protocol="<replaceable>string</replaceable>"</term>
843f86
           <listitem>
843f86
 	    <para>
843f86
-              The protocol value can either be <option>tcp</option> or <option>udp</option>.
843f86
+              The protocol value can either be <option>tcp</option>, <option>udp</option>, <option>sctp</option> or <option>dccp</option>.
843f86
 	    </para>
843f86
 	  </listitem>
843f86
 	</varlistentry>
843f86
diff --git a/doc/xml/firewalld.zone.xml b/doc/xml/firewalld.zone.xml
843f86
index 80290e7..c3283c0 100644
843f86
--- a/doc/xml/firewalld.zone.xml
843f86
+++ b/doc/xml/firewalld.zone.xml
843f86
@@ -73,25 +73,25 @@
843f86
   [ <interface name="<replaceable>string</replaceable>"/> ]
843f86
   [ <source address="<replaceable>address</replaceable>[/<replaceable>mask</replaceable>]"|mac="<replaceable>MAC</replaceable>"|ipset="<replaceable>ipset</replaceable>"/> ]
843f86
   [ <service name="<replaceable>string</replaceable>"/> ]
843f86
-  [ <port port="<replaceable>portid</replaceable>[-<replaceable>portid</replaceable>]" protocol="<literal>tcp</literal>|<literal>udp</literal>"/> ]
843f86
+  [ <port port="<replaceable>portid</replaceable>[-<replaceable>portid</replaceable>]" protocol="<literal>tcp</literal>|<literal>udp</literal>|<literal>sctp</literal>|<literal>dccp</literal>"/> ]
843f86
   [ <protcol value="<replaceable>protocol</replaceable>"/> ]
843f86
   [ <icmp-block name="<replaceable>string</replaceable>"/> ]
843f86
   [ <icmp-block-inversion/> ]
843f86
   [ <masquerade/> ]
843f86
-  [ <forward-port port="<replaceable>portid</replaceable>[-<replaceable>portid</replaceable>]" protocol="<literal>tcp</literal>|<literal>udp</literal>" [to-port="<replaceable>portid</replaceable>[-<replaceable>portid</replaceable>]"] [to-addr="<replaceable>ipv4address</replaceable>"]/> ]
843f86
-  [ <source-port port="<replaceable>portid</replaceable>[-<replaceable>portid</replaceable>]" protocol="<literal>tcp</literal>|<literal>udp</literal>"/> ]
843f86
+  [ <forward-port port="<replaceable>portid</replaceable>[-<replaceable>portid</replaceable>]" protocol="<literal>tcp</literal>|<literal>udp</literal>|<literal>sctp</literal>|<literal>dccp</literal>" [to-port="<replaceable>portid</replaceable>[-<replaceable>portid</replaceable>]"] [to-addr="<replaceable>ipv4address</replaceable>"]/> ]
843f86
+  [ <source-port port="<replaceable>portid</replaceable>[-<replaceable>portid</replaceable>]" protocol="<literal>tcp</literal>|<literal>udp</literal>|<literal>sctp</literal>|<literal>dccp</literal>"/> ]
843f86
   [
843f86
     <rule [family="<literal>ipv4</literal>|<literal>ipv6</literal>"]>
843f86
     [ <source address="<replaceable>address</replaceable>[/<replaceable>mask</replaceable>]"|mac="<replaceable>MAC</replaceable>"|ipset="<replaceable>ipset</replaceable>" [invert="<replaceable>True</replaceable>"]/> ]
843f86
     [ <destination address="<replaceable>address</replaceable>[/<replaceable>mask</replaceable>]" [invert="<replaceable>True</replaceable>"]/> ]
843f86
     [
843f86
       <service name="<replaceable>string</replaceable>"/> |
843f86
-      <port port="<replaceable>portid</replaceable>[-<replaceable>portid</replaceable>]" protocol="<literal>tcp</literal>|<literal>udp</literal>"/> |
843f86
+      <port port="<replaceable>portid</replaceable>[-<replaceable>portid</replaceable>]" protocol="<literal>tcp</literal>|<literal>udp</literal>|<literal>sctp</literal>|<literal>dccp</literal>"/> |
843f86
       <protocol value="<replaceable>protocol</replaceable>"/> |
843f86
       <icmp-block name="<replaceable>icmptype</replaceable>"/> |
843f86
       <icmp-type name="<replaceable>icmptype</replaceable>"/> |
843f86
       <masquerade/> |
843f86
-      <forward-port port="<replaceable>portid</replaceable>[-<replaceable>portid</replaceable>]" protocol="<literal>tcp</literal>|<literal>udp</literal>" [to-port="<replaceable>portid</replaceable>[-<replaceable>portid</replaceable>]"] [to-addr="<replaceable>address</replaceable>"]/>
843f86
+      <forward-port port="<replaceable>portid</replaceable>[-<replaceable>portid</replaceable>]" protocol="<literal>tcp</literal>|<literal>udp</literal>|<literal>sctp</literal>|<literal>dccp</literal>" [to-port="<replaceable>portid</replaceable>[-<replaceable>portid</replaceable>]"] [to-addr="<replaceable>address</replaceable>"]/>
843f86
     ]
843f86
     [ <log [prefix="<replaceable>prefixtext</replaceable>"] [level="<literal>emerg</literal>|<literal>alert</literal>|<literal>crit</literal>|<literal>err</literal>|<literal>warn</literal>|<literal>notice</literal>|<literal>info</literal>|<literal>debug</literal>"]> [<limit value="<replaceable>rate</replaceable>/<replaceable>duration</replaceable>"/>] </log> ]
843f86
     [ <audit> [<limit value="<replaceable>rate</replaceable>/<replaceable>duration</replaceable>"/>] </audit> ]
843f86
@@ -249,10 +249,10 @@
843f86
 	</varlistentry>
843f86
 
843f86
 	<varlistentry>
843f86
-	  <term>protocol="<literal>tcp</literal>|<literal>udp</literal>"</term>
843f86
+	  <term>protocol="<literal>tcp</literal>|<literal>udp</literal>|<literal>sctp</literal>|<literal>dccp</literal>"</term>
843f86
           <listitem>
843f86
 	    <para>
843f86
-	      The protocol can either be <replaceable>tcp</replaceable> or <replaceable>udp</replaceable>.
843f86
+	      The protocol can either be <replaceable>tcp</replaceable>, <option>udp</option>, <option>sctp</option> or <option>dccp</option>.
843f86
 	    </para>
843f86
 	  </listitem>
843f86
 	</varlistentry>
843f86
@@ -329,10 +329,10 @@
843f86
 	  </varlistentry>
843f86
 
843f86
 	  <varlistentry>
843f86
-	    <term>protocol="<literal>tcp</literal>|<literal>udp</literal>"</term>
843f86
+	    <term>protocol="<literal>tcp</literal>|<literal>udp</literal>|<literal>sctp</literal>|<literal>dccp</literal>"</term>
843f86
             <listitem>
843f86
 	      <para>
843f86
-		The protocol can either be <replaceable>tcp</replaceable> or <replaceable>udp</replaceable>.
843f86
+		The protocol can either be <replaceable>tcp</replaceable>, <option>udp</option>, <option>sctp</option> or <option>dccp</option>.
843f86
 	      </para>
843f86
 	    </listitem>
843f86
 	  </varlistentry>
843f86
@@ -382,10 +382,10 @@
843f86
 	</varlistentry>
843f86
 
843f86
 	<varlistentry>
843f86
-	  <term>protocol="<literal>tcp</literal>|<literal>udp</literal>"</term>
843f86
+	  <term>protocol="<literal>tcp</literal>|<literal>udp</literal>|<literal>sctp</literal>|<literal>dccp</literal>"</term>
843f86
           <listitem>
843f86
 	    <para>
843f86
-	      The protocol can either be <replaceable>tcp</replaceable> or <replaceable>udp</replaceable>.
843f86
+	      The protocol can either be <replaceable>tcp</replaceable>, <option>udp</option>, <option>sctp</option> or <option>dccp</option>.
843f86
 	    </para>
843f86
 	  </listitem>
843f86
 	</varlistentry>
843f86
@@ -407,13 +407,13 @@
843f86
   [ <destination address="<replaceable>address</replaceable>[/<replaceable>mask</replaceable>]" [invert="<replaceable>True</replaceable>"]/> ]
843f86
   [
843f86
     <service name="<replaceable>string</replaceable>"/> |
843f86
-    <port port="<replaceable>portid</replaceable>[-<replaceable>portid</replaceable>]" protocol="<literal>tcp</literal>|<literal>udp</literal>"/> |
843f86
+    <port port="<replaceable>portid</replaceable>[-<replaceable>portid</replaceable>]" protocol="<literal>tcp</literal>|<literal>udp</literal>|<literal>sctp</literal>|<literal>dccp</literal>"/> |
843f86
     <protocol value="<replaceable>protocol</replaceable>"/> |
843f86
     <icmp-block name="<replaceable>icmptype</replaceable>"/> |
843f86
     <icmp-type name="<replaceable>icmptype</replaceable>"/> |
843f86
     <masquerade/> |
843f86
-    <forward-port port="<replaceable>portid</replaceable>[-<replaceable>portid</replaceable>]" protocol="<literal>tcp</literal>|<literal>udp</literal>" [to-port="<replaceable>portid</replaceable>[-<replaceable>portid</replaceable>]"] [to-addr="<replaceable>address</replaceable>"]/> |
843f86
-    <source-port port="<replaceable>portid</replaceable>[-<replaceable>portid</replaceable>]" protocol="<literal>tcp</literal>|<literal>udp</literal>"/> |
843f86
+    <forward-port port="<replaceable>portid</replaceable>[-<replaceable>portid</replaceable>]" protocol="<literal>tcp</literal>|<literal>udp</literal>|<literal>sctp</literal>|<literal>dccp</literal>" [to-port="<replaceable>portid</replaceable>[-<replaceable>portid</replaceable>]"] [to-addr="<replaceable>address</replaceable>"]/> |
843f86
+    <source-port port="<replaceable>portid</replaceable>[-<replaceable>portid</replaceable>]" protocol="<literal>tcp</literal>|<literal>udp</literal>|<literal>sctp</literal>|<literal>dccp</literal>"/> |
843f86
   ]
843f86
   [ <log [prefix="<replaceable>prefixtext</replaceable>"] [level="<literal>emerg</literal>|<literal>alert</literal>|<literal>crit</literal>|<literal>err</literal>|<literal>warn</literal>|<literal>notice</literal>|<literal>info</literal>|<literal>debug</literal>"]/> [<limit value="<replaceable>rate</replaceable>/<replaceable>duration</replaceable>"/>] </log> ]
843f86
   [ <audit> [<limit value="<replaceable>rate</replaceable>/<replaceable>duration</replaceable>"/>] </audit> ]
843f86
diff --git a/src/firewall-config.glade b/src/firewall-config.glade
843f86
index 73cee5c..d209a34 100644
843f86
--- a/src/firewall-config.glade
843f86
+++ b/src/firewall-config.glade
843f86
@@ -1263,6 +1263,8 @@
843f86
                     <items>
843f86
                       <item>tcp</item>
843f86
                       <item>udp</item>
843f86
+                      <item>sctp</item>
843f86
+                      <item>dccp</item>
843f86
                     </items>
843f86
                     <signal name="changed" handler="onForwardChanged" swapped="no"/>
843f86
                   </object>
843f86
@@ -9196,6 +9198,8 @@
843f86
                     <items>
843f86
                       <item>tcp</item>
843f86
                       <item>udp</item>
843f86
+                      <item>sctp</item>
843f86
+                      <item>dccp</item>
843f86
                     </items>
843f86
                     <signal name="changed" handler="onPortChanged" swapped="no"/>
843f86
                   </object>
843f86
@@ -9597,6 +9601,7 @@
843f86
                       <item translatable="yes">- Select -</item>
843f86
                       <item>ah</item>
843f86
                       <item>esp</item>
843f86
+                      <item>dccp</item>
843f86
                       <item>ddp</item>
843f86
                       <item>icmp</item>
843f86
                       <item>igmp</item>
843f86
diff --git a/src/firewall/command.py b/src/firewall/command.py
843f86
index e3adde0..e2d032f 100644
843f86
--- a/src/firewall/command.py
843f86
+++ b/src/firewall/command.py
843f86
@@ -267,9 +267,10 @@ class FirewallCommand(object):
843f86
                                 "portid[-portid]%sprotocol" % separator)
843f86
         if not check_port(port):
843f86
             raise FirewallError(errors.INVALID_PORT, port)
843f86
-        if proto not in [ "tcp", "udp" ]:
843f86
+        if proto not in [ "tcp", "udp", "sctp", "dccp" ]:
843f86
             raise FirewallError(errors.INVALID_PROTOCOL,
843f86
-                                "'%s' not in {'tcp'|'udp'}" % proto)
843f86
+                                "'%s' not in {'tcp'|'udp'|'sctp'|'dccp'}" % \
843f86
+                                proto)
843f86
         return (port, proto)
843f86
 
843f86
     def parse_forward_port(self, value):
843f86
@@ -301,9 +302,10 @@ class FirewallCommand(object):
843f86
 
843f86
         if not check_port(port):
843f86
             raise FirewallError(errors.INVALID_PORT, port)
843f86
-        if protocol not in [ "tcp", "udp" ]:
843f86
+        if protocol not in [ "tcp", "udp", "sctp", "dccp" ]:
843f86
             raise FirewallError(errors.INVALID_PROTOCOL,
843f86
-                                "'%s' not in {'tcp'|'udp'}" % protocol)
843f86
+                                "'%s' not in {'tcp'|'udp'|'sctp'|'dccp'}" % \
843f86
+                                protocol)
843f86
         if toport and not check_port(toport):
843f86
             raise FirewallError(errors.INVALID_PORT, toport)
843f86
         if toaddr and not check_single_address("ipv4", toaddr):
843f86
diff --git a/src/firewall/core/fw.py b/src/firewall/core/fw.py
843f86
index f32ec22..8dbe59b 100644
843f86
--- a/src/firewall/core/fw.py
843f86
+++ b/src/firewall/core/fw.py
843f86
@@ -989,9 +989,10 @@ class Firewall(object):
843f86
     def check_tcpudp(self, protocol):
843f86
         if not protocol:
843f86
             raise FirewallError(errors.MISSING_PROTOCOL)
843f86
-        if protocol not in [ "tcp", "udp" ]:
843f86
+        if protocol not in [ "tcp", "udp", "sctp", "dccp" ]:
843f86
             raise FirewallError(errors.INVALID_PROTOCOL,
843f86
-                                "'%s' not in {'tcp'|'udp'}" % protocol)
843f86
+                                "'%s' not in {'tcp'|'udp'|'sctp'|'dccp'}" % \
843f86
+                                protocol)
843f86
 
843f86
     def check_ip(self, ip):
843f86
         if not functions.checkIP(ip):
843f86
diff --git a/src/firewall/core/fw_test.py b/src/firewall/core/fw_test.py
843f86
index 62385e6..9516823 100644
843f86
--- a/src/firewall/core/fw_test.py
843f86
+++ b/src/firewall/core/fw_test.py
843f86
@@ -456,9 +456,10 @@ class Firewall_test(object):
843f86
     def check_tcpudp(self, protocol):
843f86
         if not protocol:
843f86
             raise FirewallError(errors.MISSING_PROTOCOL)
843f86
-        if not protocol in [ "tcp", "udp" ]:
843f86
+        if not protocol in [ "tcp", "udp", "sctp", "dccp" ]:
843f86
             raise FirewallError(errors.INVALID_PROTOCOL,
843f86
-                                "'%s' not in {'tcp'|'udp'}" % protocol)
843f86
+                                "'%s' not in {'tcp'|'udp'|'sctp'|'dccp'}" % \
843f86
+                                protocol)
843f86
 
843f86
     def check_ip(self, ip):
843f86
         if not functions.checkIP(ip):
843f86
diff --git a/src/firewall/core/io/io_object.py b/src/firewall/core/io/io_object.py
843f86
index 3ae180a..139439f 100644
843f86
--- a/src/firewall/core/io/io_object.py
843f86
+++ b/src/firewall/core/io/io_object.py
843f86
@@ -292,9 +292,10 @@ def check_port(port):
843f86
                             "'%s' is invalid port range" % port)
843f86
 
843f86
 def check_tcpudp(protocol):
843f86
-    if protocol not in [ "tcp", "udp" ]:
843f86
+    if protocol not in [ "tcp", "udp", "sctp", "dccp" ]:
843f86
         raise FirewallError(errors.INVALID_PROTOCOL,
843f86
-                            "'%s' not from {'tcp'|'udp'}" % protocol)
843f86
+                            "'%s' not from {'tcp'|'udp'|'sctp'|'dccp'}" % \
843f86
+                            protocol)
843f86
 
843f86
 def check_protocol(protocol):
843f86
     if not functions.checkProtocol(protocol):
843f86
diff --git a/src/firewall/core/rich.py b/src/firewall/core/rich.py
843f86
index b33009f..3adcb4d 100644
843f86
--- a/src/firewall/core/rich.py
843f86
+++ b/src/firewall/core/rich.py
843f86
@@ -576,7 +576,7 @@ class Rich_Rule(object):
843f86
         elif type(self.element) == Rich_Port:
843f86
             if not functions.check_port(self.element.port):
843f86
                 raise FirewallError(errors.INVALID_PORT, self.element.port)
843f86
-            if self.element.protocol not in [ "tcp", "udp" ]:
843f86
+            if self.element.protocol not in [ "tcp", "udp", "sctp", "dccp" ]:
843f86
                 raise FirewallError(errors.INVALID_PROTOCOL, self.element.protocol)
843f86
 
843f86
         # protocol
843f86
@@ -611,7 +611,7 @@ class Rich_Rule(object):
843f86
         elif type(self.element) == Rich_ForwardPort:
843f86
             if not functions.check_port(self.element.port):
843f86
                 raise FirewallError(errors.INVALID_PORT, self.element.port)
843f86
-            if self.element.protocol not in [ "tcp", "udp" ]:
843f86
+            if self.element.protocol not in [ "tcp", "udp", "sctp", "dccp" ]:
843f86
                 raise FirewallError(errors.INVALID_PROTOCOL, self.element.protocol)
843f86
             if self.element.to_port == "" and self.element.to_address == "":
843f86
                 raise FirewallError(errors.INVALID_PORT, self.element.to_port)
843f86
@@ -631,7 +631,7 @@ class Rich_Rule(object):
843f86
         elif type(self.element) == Rich_SourcePort:
843f86
             if not functions.check_port(self.element.port):
843f86
                 raise FirewallError(errors.INVALID_PORT, self.element.port)
843f86
-            if self.element.protocol not in [ "tcp", "udp" ]:
843f86
+            if self.element.protocol not in [ "tcp", "udp", "sctp", "dccp" ]:
843f86
                 raise FirewallError(errors.INVALID_PROTOCOL, self.element.protocol)
843f86
 
843f86
         # other element and not empty?
843f86
diff --git a/src/tests/firewall-cmd_test.sh b/src/tests/firewall-cmd_test.sh
843f86
index 653c644..ea076a0 100755
843f86
--- a/src/tests/firewall-cmd_test.sh
843f86
+++ b/src/tests/firewall-cmd_test.sh
843f86
@@ -339,6 +339,15 @@ assert_good " --query-port=111-222/udp --zone=${default_zone}"
843f86
 assert_good "--remove-port 111-222/udp"
843f86
 assert_bad  " --query-port=111-222/udp"
843f86
 
843f86
+assert_good "   --add-port=5000/sctp"
843f86
+assert_good " --query-port=5000/sctp --zone=${default_zone}"
843f86
+assert_good "--remove-port 5000/sctp"
843f86
+assert_bad  " --query-port=5000/sctp"
843f86
+assert_good "   --add-port=222/dccp"
843f86
+assert_good " --query-port=222/dccp --zone=${default_zone}"
843f86
+assert_good "--remove-port 222/dccp"
843f86
+assert_bad  " --query-port=222/dccp"
843f86
+
843f86
 assert_bad  "--permanent    --add-port=666" # no protocol
843f86
 assert_bad  "--permanent    --add-port=666/dummy" # bad protocol
843f86
 assert_good "--permanent    --add-port=666/tcp"
843f86
@@ -348,6 +357,15 @@ assert_good "--permanent  --query-port=111-222/udp"
843f86
 assert_good "--permanent --remove-port 111-222/udp"
843f86
 assert_bad  "--permanent  --query-port=111-222/udp"
843f86
 
843f86
+assert_good "--permanent    --add-port=5000/sctp"
843f86
+assert_good "--permanent  --query-port=5000/sctp --zone=${default_zone}"
843f86
+assert_good "--permanent --remove-port 5000/sctp"
843f86
+assert_bad  "--permanent  --query-port=5000/sctp"
843f86
+assert_good "--permanent    --add-port=222/dccp"
843f86
+assert_good "--permanent  --query-port=222/dccp --zone=${default_zone}"
843f86
+assert_good "--permanent --remove-port 222/dccp"
843f86
+assert_bad  "--permanent  --query-port=222/dccp"
843f86
+
843f86
 assert_good "   --add-port=80/tcp --add-port 443-444/udp"
843f86
 assert_good " --query-port=80/tcp --zone=${default_zone}"
843f86
 assert_good " --query-port=443-444/udp"
843f86
@@ -488,6 +506,10 @@ assert_good "   --add-forward-port=port=55:proto=tcp:toport=66:toaddr=7.7.7.7"
843f86
 assert_good " --query-forward-port port=55:proto=tcp:toport=66:toaddr=7.7.7.7 --zone=${default_zone}"
843f86
 assert_good "--remove-forward-port=port=55:proto=tcp:toport=66:toaddr=7.7.7.7"
843f86
 assert_bad  " --query-forward-port=port=55:proto=tcp:toport=66:toaddr=7.7.7.7"
843f86
+assert_good "   --add-forward-port=port=66:proto=sctp:toport=66:toaddr=7.7.7.7"
843f86
+assert_good " --query-forward-port port=66:proto=sctp:toport=66:toaddr=7.7.7.7 --zone=${default_zone}"
843f86
+assert_good "--remove-forward-port=port=66:proto=sctp:toport=66:toaddr=7.7.7.7"
843f86
+assert_bad  " --query-forward-port=port=66:proto=sctp:toport=66:toaddr=7.7.7.7"
843f86
 
843f86
 assert_bad  "--permanent         --add-forward-port=666" # no protocol
843f86
 assert_good "--permanent    --add-forward-port=port=11:proto=tcp:toport=22 --zone=${default_zone}"
843f86
@@ -499,6 +521,10 @@ assert_good "--permanent    --add-forward-port=port=55:proto=tcp:toport=66:toadd
843f86
 assert_good "--permanent  --query-forward-port port=55:proto=tcp:toport=66:toaddr=7.7.7.7"
843f86
 assert_good "--permanent --remove-forward-port=port=55:proto=tcp:toport=66:toaddr=7.7.7.7"
843f86
 assert_bad  "--permanent  --query-forward-port=port=55:proto=tcp:toport=66:toaddr=7.7.7.7"
843f86
+assert_good "--permanent    --add-forward-port=port=66:proto=sctp:toport=66:toaddr=7.7.7.7"
843f86
+assert_good "--permanent  --query-forward-port port=66:proto=sctp:toport=66:toaddr=7.7.7.7 --zone=${default_zone}"
843f86
+assert_good "--permanent --remove-forward-port=port=66:proto=sctp:toport=66:toaddr=7.7.7.7"
843f86
+assert_bad  "--permanent  --query-forward-port=port=66:proto=sctp:toport=66:toaddr=7.7.7.7"
843f86
 
843f86
 assert_good "   --add-forward-port=port=88:proto=udp:toport=99 --add-forward-port port=100:proto=tcp:toport=200"
843f86
 assert_good " --query-forward-port=port=100:proto=tcp:toport=200"
843f86
@@ -597,6 +623,18 @@ assert_good "--permanent --icmptype=${myicmp} --query-destination=ipv4"
843f86
 assert_good "--permanent --icmptype=${myicmp} --remove-destination=ipv4"
843f86
 assert_bad "--permanent --icmptype=${myicmp} --query-destination=ipv4"
843f86
 
843f86
+# test sctp and dccp ports
843f86
+assert_good "--permanent --service=${myservice} --add-port=666/sctp"
843f86
+assert_good "--permanent --service=${myservice} --remove-port=666/sctp"
843f86
+assert_good "--permanent --service=${myservice} --remove-port 666/sctp"
843f86
+assert_bad  "--permanent --service=${myservice} --query-port=666/sctp"
843f86
+assert_good "--permanent --service=${myservice} --add-port=999/dccp"
843f86
+assert_good "--permanent --service=${myservice} --remove-port=999/dccp"
843f86
+assert_good "--permanent --service=${myservice} --remove-port 999/dccp"
843f86
+assert_bad  "--permanent --service=${myservice} --query-port=999/dccp"
843f86
+assert_good "--permanent --service=${myservice} --add-port=666/sctp"
843f86
+assert_good "--permanent --service=${myservice} --add-port=999/dccp"
843f86
+
843f86
 # add them to zone
843f86
 assert_good "--permanent --zone=${myzone} --add-service=${myservice}"
843f86
 assert_good "--permanent --zone=${myzone} --add-icmp-block=${myicmp}"
843f86
@@ -906,7 +944,9 @@ good_rules=(
843f86
  'rule family="ipv4" source address="192.168.1.0/24" masquerade'
843f86
  'rule family="ipv4" destination address="192.168.1.0/24" masquerade' # masquerade & destination
843f86
  'rule family="ipv6" masquerade'
843f86
- 'rule forward-port port="2222" to-port="22" to-addr="192.168.100.2" protocol="tcp" family="ipv4" source address="192.168.2.100"')
843f86
+ 'rule forward-port port="2222" to-port="22" to-addr="192.168.100.2" protocol="tcp" family="ipv4" source address="192.168.2.100"'
843f86
+ 'rule forward-port port="66" to-port="666" to-addr="192.168.100.2" protocol="sctp" family="ipv4" source address="192.168.2.100"'
843f86
+ 'rule forward-port port="99" to-port="999" to-addr="1::2:3:4:7" protocol="dccp" family="ipv6" source address="1:2:3:4:6::"')
843f86
 
843f86
 for (( i=0;i<${#good_rules[@]};i++)); do
843f86
   rule=${good_rules[${i}]}
843f86
diff --git a/src/tests/firewall-offline-cmd_test.sh b/src/tests/firewall-offline-cmd_test.sh
843f86
index ee7ffcd..f81c853 100755
843f86
--- a/src/tests/firewall-offline-cmd_test.sh
843f86
+++ b/src/tests/firewall-offline-cmd_test.sh
843f86
@@ -332,6 +332,15 @@ assert_good " --query-port=111-222/udp --zone=${default_zone}"
843f86
 assert_good "--remove-port 111-222/udp"
843f86
 assert_bad  " --query-port=111-222/udp"
843f86
 
843f86
+assert_good "   --add-port=5000/sctp"
843f86
+assert_good " --query-port=5000/sctp --zone=${default_zone}"
843f86
+assert_good "--remove-port 5000/sctp"
843f86
+assert_bad  " --query-port=5000/sctp"
843f86
+assert_good "   --add-port=222/dccp"
843f86
+assert_good " --query-port=222/dccp --zone=${default_zone}"
843f86
+assert_good "--remove-port 222/dccp"
843f86
+assert_bad  " --query-port=222/dccp"
843f86
+
843f86
 assert_good "   --add-port=80/tcp --add-port 443-444/udp"
843f86
 assert_good " --query-port=80/tcp --zone=${default_zone}"
843f86
 assert_good " --query-port=443-444/udp"
843f86
@@ -409,6 +418,10 @@ assert_good "   --add-forward-port=port=55:proto=tcp:toport=66:toaddr=7.7.7.7"
843f86
 assert_good " --query-forward-port port=55:proto=tcp:toport=66:toaddr=7.7.7.7 --zone=${default_zone}"
843f86
 assert_good "--remove-forward-port=port=55:proto=tcp:toport=66:toaddr=7.7.7.7"
843f86
 assert_bad  " --query-forward-port=port=55:proto=tcp:toport=66:toaddr=7.7.7.7"
843f86
+assert_good "   --add-forward-port=port=66:proto=sctp:toport=66:toaddr=7.7.7.7"
843f86
+assert_good " --query-forward-port port=66:proto=sctp:toport=66:toaddr=7.7.7.7 --zone=${default_zone}"
843f86
+assert_good "--remove-forward-port=port=66:proto=sctp:toport=66:toaddr=7.7.7.7"
843f86
+assert_bad  " --query-forward-port=port=66:proto=sctp:toport=66:toaddr=7.7.7.7"
843f86
 
843f86
 assert_good "   --add-forward-port=port=88:proto=udp:toport=99 --add-forward-port port=100:proto=tcp:toport=200"
843f86
 assert_good " --query-forward-port=port=100:proto=tcp:toport=200"
843f86
@@ -494,6 +507,18 @@ assert_good "--icmptype=${myicmp} --query-destination=ipv4"
843f86
 assert_good "--icmptype=${myicmp} --remove-destination=ipv4"
843f86
 assert_bad "--icmptype=${myicmp} --query-destination=ipv4"
843f86
 
843f86
+# test sctp and dccp ports
843f86
+assert_good "--service=${myservice} --add-port=666/sctp"
843f86
+assert_good "--service=${myservice} --remove-port=666/sctp"
843f86
+assert_good "--service=${myservice} --remove-port 666/sctp"
843f86
+assert_bad  "--service=${myservice} --query-port=666/sctp"
843f86
+assert_good "--service=${myservice} --add-port=999/dccp"
843f86
+assert_good "--service=${myservice} --remove-port=999/dccp"
843f86
+assert_good "--service=${myservice} --remove-port 999/dccp"
843f86
+assert_bad  "--service=${myservice} --query-port=999/dccp"
843f86
+assert_good "--service=${myservice} --add-port=666/sctp"
843f86
+assert_good "--service=${myservice} --add-port=999/dccp"
843f86
+
843f86
 # add them to zone
843f86
 assert_good "--zone=${myzone} --add-service=${myservice}"
843f86
 assert_good "--zone=${myzone} --add-icmp-block=${myicmp}"
843f86
@@ -688,7 +713,9 @@ good_rules=(
843f86
  'rule family="ipv6" source address="1:2:3:4:6::" icmp-block name="redirect" log prefix="redirect" level="info" limit value="4/m"'
843f86
  'rule family="ipv4" source address="192.168.1.0/24" masquerade'
843f86
  'rule family="ipv6" masquerade'
843f86
- 'rule forward-port port="2222" to-port="22" to-addr="192.168.100.2" protocol="tcp" family="ipv4" source address="192.168.2.100"')
843f86
+ 'rule forward-port port="2222" to-port="22" to-addr="192.168.100.2" protocol="tcp" family="ipv4" source address="192.168.2.100"'
843f86
+ 'rule forward-port port="66" to-port="666" to-addr="192.168.100.2" protocol="sctp" family="ipv4" source address="192.168.2.100"'
843f86
+ 'rule forward-port port="99" to-port="999" to-addr="1::2:3:4:7" protocol="dccp" family="ipv6" source address="1:2:3:4:6::"')
843f86
 
843f86
 for (( i=0;i<${#good_rules[@]};i++)); do
843f86
   rule=${good_rules[${i}]}