diff --git a/doc/ChangeLog b/doc/ChangeLog index 2f9ee6c62..a7965c200 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,9 +1,11 @@ 2008-07-05 Vadim Kurland + * PolicyCompiler_PrintRule.cpp (PrintRule::_printIP): Support for + TOS and DSCP matching in compiler for iptables. + * IPServiceDialog.cpp (IPServiceDialog::loadFWObject): Added - support for attriutes "tos" and "dscp" in IPService object. No - support in compilers just yet. FR #1948944: "support for TOS - matching". + support for attriutes "tos" and "dscp" in IPService object. FR + #1948944: "support for TOS matching". * PolicyCompiler_PrintRule.cpp (PrintRule::_printModules): Implemented support for combinations of srcip, dstip, srcport, diff --git a/src/ipt/PolicyCompiler_PrintRule.cpp b/src/ipt/PolicyCompiler_PrintRule.cpp index d1297229b..67bb1f85b 100644 --- a/src/ipt/PolicyCompiler_PrintRule.cpp +++ b/src/ipt/PolicyCompiler_PrintRule.cpp @@ -729,7 +729,8 @@ string PolicyCompiler_ipt::PrintRule::_printIP(IPService *srv) { PolicyCompiler_ipt *ipt_comp=dynamic_cast(compiler); std::ostringstream str; - if (IPService::isA(srv) ) + IPService *ip; + if ((ip=IPService::cast(srv))!=NULL) { if (srv->getBool("fragm") || srv->getBool("short_fragm")) { @@ -737,6 +738,23 @@ string PolicyCompiler_ipt::PrintRule::_printIP(IPService *srv) else str << " -f "; } + string tos = ip->getTOSCode(); + string dscp = ip->getDSCPCode(); + if (!tos.empty()) + str << " -m tos --tos " << tos; + else + if (!dscp.empty()) + { + if (dscp.find("BE")==0 || + dscp.find("EF")==0 || + dscp.find("AF")==0 || + dscp.find("CS")==0) + str << " -m dscp --dscp-class " << dscp; + else + str << " -m dscp --dscp " << dscp; + } + + if (!ipt_comp->ipv6) { if (srv->getBool("lsrr") || diff --git a/test/ipt/objects-for-regression-tests.fwb b/test/ipt/objects-for-regression-tests.fwb index b91f73842..aa922760a 100644 --- a/test/ipt/objects-for-regression-tests.fwb +++ b/test/ipt/objects-for-regression-tests.fwb @@ -1,6 +1,6 @@ - + @@ -581,6 +581,16 @@ + + + + + + + + + + @@ -1539,6 +1549,9 @@ + + + @@ -26865,6 +26878,164 @@ echo '%FWBPROMPT%'; sh /tmp/%FWSCRIPT% + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -26989,11 +27160,11 @@ echo '%FWBPROMPT%'; sh /tmp/%FWSCRIPT% - - + +