Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1065738 - firewalld.direct can not handle complex iptables args
Summary: firewalld.direct can not handle complex iptables args
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: firewalld
Version: rawhide
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Thomas Woerner
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-02-16 13:37 UTC by ayanamist
Modified: 2014-06-19 22:58 UTC (History)
2 users (show)

Fixed In Version: firewalld-0.3.10-1.fc20
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-06-19 22:58:31 UTC


Attachments (Terms of Use)
direct.patch (deleted)
2014-02-16 13:37 UTC, ayanamist
no flags Details | Diff

Description ayanamist 2014-02-16 13:37:19 UTC
Created attachment 863732 [details]
direct.patch

Description of problem:
If you add a permanent direct rule with complex iptables args, it can not be loaded when firewalld starts.

Version-Release number of selected component (if applicable):
0.3.9.3-1

How reproducible:
Stable

Steps to Reproduce:
1. `sudo firewall-cmd --permanent --direct --add-rule ipv4 mangle PREROUTING 0 -p udp --sport 53 -m u32 --u32 "0&0x0F000000=0x05000000 && 22&0xFFFF@16=0x01020304" -j DROP`
2. Restart firewalld
3. `sudo iptables -t mangle -L`

Actual results:
There is no corresponding rules about u32.

Expected results:
There will be a u32 rule.

Additional info:
I just resolve the problem, here is the patch

Comment 1 ayanamist 2014-02-17 01:28:22 UTC
Now i have some time to give details.
There are two issues related to this bug:
1. When using firewall-cmd --permanent to write rules to direct.xml, the rule args are not escaped, so when args contain ampersand, it will become an invalid xml. So i use sax.saxutils.escape.
2. When firewalld read and parse direct.xml, it uses sax.handler.ContentHandler. When the value in a element is very long like in my case, method `characters()` will be called several times with chunks of the data, which overwrites self._element. So i use append in characters(), and add startElement() to reset self._element.

Comment 3 Jiri Popelka 2014-04-03 13:20:26 UTC
If you're willing to help testing the fix, grab one of .repo files from
https://copr.fedoraproject.org/coprs/jpopelka/FirewallD/
copy it into /etc/yum.repos.d/ and run 'yum update'.

If you're not happy with the testing package, downgrade back with
# yum distro-sync 'firewall*'

In any case, I'll be glad if can leave a note here.

Thanks !

Comment 4 ayanamist 2014-04-04 03:28:30 UTC
I have just installed firewalld-0.3.9.3-1.140401git4ff31ab.fc20.3.noarch, it works under both cli and gui as expected.

(In reply to Jiri Popelka from comment #3)
> If you're willing to help testing the fix, grab one of .repo files from
> https://copr.fedoraproject.org/coprs/jpopelka/FirewallD/
> copy it into /etc/yum.repos.d/ and run 'yum update'.
> 
> If you're not happy with the testing package, downgrade back with
> # yum distro-sync 'firewall*'
> 
> In any case, I'll be glad if can leave a note here.
> 
> Thanks !

Comment 5 Fedora Update System 2014-05-29 09:08:39 UTC
firewalld-0.3.10-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/firewalld-0.3.10-1.fc20

Comment 6 Fedora Update System 2014-05-29 23:23:24 UTC
Package firewalld-0.3.10-1.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing firewalld-0.3.10-1.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-6834/firewalld-0.3.10-1.fc20
then log in and leave karma (feedback).

Comment 7 Fedora Update System 2014-06-19 22:58:31 UTC
firewalld-0.3.10-1.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.