Bug 966445

Summary: "tc action ipt" broken
Product: [Fedora] Fedora Reporter: redhat
Component: iprouteAssignee: Petr Šabata <psabata>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 18CC: jpopelka, psabata, rvokal, thomas.jarosch, twoerner
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-02-05 23:10:02 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description redhat 2013-05-23 10:03:05 UTC
Description of problem:
I use "tc" for configuring traffic shaping for several years. Since the upgrade to FC17 the netfilter ABI of the kernel seams to have changes and the command "tc" does no longer work.

Version-Release number of selected component (if applicable):
iproute-3.3.0-6.fc17.i686



How reproducible:
always

Steps to Reproduce:
1. tc qdisc  add dev ppp0 handle ffff: ingress
2. tc filter add dev ppp0 parent ffff: protocol ip prio 111 u32 match u32 0 0 flowid :1 action ipt -j MARK --set-mark 20 action continue


Actual results:
Error message from second call to tc
bad action type ipt
Usage: ... gact <ACTION> [RAND] [INDEX]
Where:  ACTION := reclassify | drop | continue | pass
        RAND := random <RANDTYPE> <ACTION> <VAL>
        RANDTYPE := netrand | determ
        VAL : = value not exceeding 10000
        INDEX := index value used

bad action parsing
parse_action: bad value (7:ipt)!
Illegal "action"



Expected results:
no error


Additional info:
I did some research on the Web and with strace.

tc filter add dev ppp0 parent ffff: protocol ip prio 111 u32 match u32 0 0 flowid :1 action ipt -j MARK --set-mark 20 action continue

gives me 

19948 open("/usr/share//tc//f_u32.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
19948 open("/usr/share//tc//m_ipt.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
19948 open("/usr/share//tc//m_gact.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)

some of the missing files are located in /usr/share/tc, so I did

 # cd /usr/share/tc
 # ln -s ../../lib/tc/* .

which gives me

20259 open("/usr/share//tc//f_u32.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
20259 open("/usr/share//tc//m_ipt.so", O_RDONLY|O_CLOEXEC) = 4
19999 open("/usr/share//tc//m_gact.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)

I was no able the find the missing modules in any FC17 packet.

Then I found a bug report for SuSE Linux that is similar to mine

https://bugzilla.novell.com/show_bug.cgi?id=679172

It states: "ipt" is obsolete, do use the "xt" action instead.

# tc filter add dev ppp0 parent ffff: protocol ip prio 111 u32 match u32 0 0 flowid :1 action xt -j MARK --set-mark 20 action continue
xt: unrecognized option '--set-mark'
Speicherzugriffsfehler

which resulted in segfault!

tc filter add dev ppp0 parent ffff: protocol ip prio 111 u32 match u32 0 0 flowid :1 action xt -j MARK  action continue
tablename: mangle hook: NF_IP_PRE_ROUTING
        target:  MARK and 0xffffffff index 0
RTNETLINK answers: No such file or directory
We have an error talking to the kernel

us.generation-nt.com/answer/bug-677873-xt-unrecognized-option-set-mark-invalid-option-help-208004961.html

explains that one should us a custom netfilter chain and do the correct marking there. But it does not find the chain although it exists.

Comment 1 Petr Šabata 2013-05-24 13:02:09 UTC
(In reply to kunze from comment #0)
> 19948 open("/usr/share//tc//m_ipt.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No
> such file or directory)

This is another issue and was caused by incorrect patching of bug #483484.  That shall be reverted.  Even though those files technically belong into /usr/share, tc would require more patching for them to live there.

Comment 2 Thomas Jarosch 2013-06-28 15:03:06 UTC
I built my iproute package from rawhide and it's also affected.

Easy workaround is to drop the "iproute2-3.4.0-sharepath.patch" from the .spec file.

For users that can't recompile the package:
Another workaround is to copy /usr/lib/tc/*.so to /usr/share/tc.

Comment 3 Petr Šabata 2013-07-01 12:27:32 UTC
(In reply to Thomas Jarosch from comment #2)
> I built my iproute package from rawhide and it's also affected.
> 
> Easy workaround is to drop the "iproute2-3.4.0-sharepath.patch" from the
> .spec file.
> 
> For users that can't recompile the package:
> Another workaround is to copy /usr/lib/tc/*.so to /usr/share/tc.

Yes, this is what I was referring to in Comment #1.

Does it actually solve the issues the reporter mentions at the end of the report for you?

Comment 4 Thomas Jarosch 2013-07-01 12:44:03 UTC
Hi Petr,

> Does it actually solve the issues the reporter mentions at the end of the
> report for you?

yes, works fine. We use "u32" and the "xt" action extensively.
(we have an "autotest" based unit test to ensure it's really working).


I've seen the

"open("/usr/share//tc//f_u32.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)"

message, too, via strace but the u32 match is working fine.
So I guess this could be bogus behaviour of "tc" in upstream.

Thomas

Comment 5 Petr Šabata 2013-07-01 15:03:26 UTC
That's great news, thank you.

Comment 6 redhat 2013-07-02 07:02:02 UTC
(In reply to Thomas Jarosch from comment #2)
> I built my iproute package from rawhide and it's also affected.
> 
> Easy workaround is to drop the "iproute2-3.4.0-sharepath.patch" from the
> .spec file.
> 
> For users that can't recompile the package:
> Another workaround is to copy /usr/lib/tc/*.so to /usr/share/tc.

This only corrects the location of the shared objects. Any other problems
I described in the initial bug report still persist!


# tc filter add dev ppp0  parent ffff: protocol ip prio 111 u32 match u32 0 0 flowid :1  action xt -j MARK action continue
tablename: mangle hook: NF_IP_PRE_ROUTING
        target:  MARK and 0xffffffff index 0
RTNETLINK answers: No such file or directory
We have an error talking to the kernel

Comment 7 Thomas Jarosch 2013-07-02 07:32:09 UTC
> This only corrects the location of the shared objects. Any other problems
> I described in the initial bug report still persist!

yes, this seems to be true for FC17, I did my previous tests with rawhide.
My workstation still runs FC17 and there I get the error, too.

Though we have another problem and now I understand why the /usr/share/tc move was done in the first place: If we drop the "/usr/share" patch, rpmbuid will stuff the .so files in /usr/lib64/tc on x86_64. Yet "tc" still searches for them in "/usr/lib".

Comment 8 Petr Šabata 2013-07-02 10:39:14 UTC
(In reply to Thomas Jarosch from comment #7)
> > This only corrects the location of the shared objects. Any other problems
> > I described in the initial bug report still persist!
> 
> yes, this seems to be true for FC17, I did my previous tests with rawhide.
> My workstation still runs FC17 and there I get the error, too.

It works well on F18.
For F17, maybe some kernel modules are missing?  They keep moving them from kernel to kernel-modules-extra and back...

> Though we have another problem and now I understand why the /usr/share/tc
> move was done in the first place: If we drop the "/usr/share" patch, rpmbuid
> will stuff the .so files in /usr/lib64/tc on x86_64. Yet "tc" still searches
> for them in "/usr/lib".

This is very easy to fix -- sed -i 's/^LIBDIR=/LIBDIR?=/' Makefile
Also, *dist files have to be installed in %{_libdir}/tc, too.

I'll submit patched builds soonish.

Comment 9 redhat 2013-07-02 11:51:48 UTC
I have both kernel and kernel-modules-extra installed.
"yum update" installed kernel 3.9.8-100.fc17 today. Still the same error.

Comment 10 redhat 2013-07-02 16:47:31 UTC
I must qualify my statement. With kernel 3.9.8-100.fc17 the behavior has changed as follows:

# tc filter add dev ppp0 parent ffff: protocol ip prio 111 u32 match u32 0 0 flowid :1 action xt -j MARK action continue
tablename: mangle hook: NF_IP_PRE_ROUTING
        target:  MARK and 0xffffffff index 0

I assume that communication with kernel succeeded. Anyway 'xt -j MARK' behaves differently than 'ipt -j MARK --set-mark 20'. A work-around could be, as suggested in one of the refereed threads, to have a custom chain to to the marking.

iptables -t mangle -N shape-ppp0-mark
iptables -t mangle -A shape-ppp0-mark -j MARK --set--mark 20
tc filter add dev ppp0 parent ffff: protocol ip prio 111 u32 match u32 0 0 flowid :1 action xt -j shape-ppp0-mark action continue
 failed to find target shape-ppp0-mark

bad action parsing
parse_action: bad value (5:xt)!
Illegal "action"


Still no success. The question is, how to configure the mark chain so tc will find it?

Comment 11 Fedora End Of Life 2013-07-04 06:28:22 UTC
This message is a reminder that Fedora 17 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 17. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '17'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 17's end of life.

Bug Reporter:  Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 17 is end of life. If you 
would still like  to see this bug fixed and are able to reproduce it 
against a later version  of Fedora, you are encouraged  change the 
'version' to a later Fedora version prior to Fedora 17's end of life.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 12 Fedora End Of Life 2013-12-21 15:31:42 UTC
This message is a reminder that Fedora 18 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 18. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '18'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 18's end of life.

Thank you for reporting this issue and we are sorry that we may not be 
able to fix it before Fedora 18 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior to Fedora 18's end of life.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 13 Fedora End Of Life 2014-02-05 23:10:02 UTC
Fedora 18 changed to end-of-life (EOL) status on 2014-01-14. Fedora 18 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.