Commit 369609f
tc: Ensure we have enough buffer space when sending filter netlink notifications
The tfilter_notify() and tfilter_del_notify() functions assume that
NLMSG_GOODSIZE is always enough to dump the filter chain. This is not
always the case, which can lead to silent notify failures (because the
return code of tfilter_notify() is not always checked). In particular,
this can lead to NLM_F_ECHO not being honoured even though an action
succeeds, which forces userspace to create workarounds[0].
Fix this by increasing the message size if dumping the filter chain into
the allocated skb fails. Use the size of the incoming skb as a size hint
if set, so we can start at a larger value when appropriate.
To trigger this, run the following commands:
# ip link add type veth
# tc qdisc replace dev veth0 root handle 1: fq_codel
# tc -echo filter add dev veth0 parent 1: u32 match u32 0 0 $(for i in $(seq 32); do echo action pedit munge ip dport set 22; done)
Before this fix, tc just returns:
Not a filter(cmd 2)
After the fix, we get the correct echo:
added filter dev veth0 parent 1: protocol all pref 49152 u32 chain 0 fh 800::800 order 2048 key ht 800 bkt 0 terminal flowid not_in_hw
match 00000000/00000000 at 0
action order 1: pedit action pass keys 1
index 1 ref 1 bind 1
key #0 at 20: val 00000016 mask ffff0000
[repeated 32 times]
[0] openvswitch/ovs@106ef21
Fixes: 1da177e ("Linux-2.6.12-rc2")
Reported-by: Frode Nordahl <[email protected]>
Closes: https://bugs.launchpad.net/ubuntu/+source/openvswitch/+bug/2018500
Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
Reviewed-by: Jiri Pirko <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Paolo Abeni <[email protected]>1 parent 13e7d72 commit 369609f
1 file changed
+45
-21
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2057 | 2057 | | |
2058 | 2058 | | |
2059 | 2059 | | |
| 2060 | + | |
2060 | 2061 | | |
2061 | 2062 | | |
2062 | 2063 | | |
| |||
2101 | 2102 | | |
2102 | 2103 | | |
2103 | 2104 | | |
| 2105 | + | |
| 2106 | + | |
2104 | 2107 | | |
2105 | 2108 | | |
2106 | | - | |
2107 | 2109 | | |
2108 | | - | |
| 2110 | + | |
| 2111 | + | |
| 2112 | + | |
| 2113 | + | |
| 2114 | + | |
| 2115 | + | |
| 2116 | + | |
| 2117 | + | |
| 2118 | + | |
| 2119 | + | |
| 2120 | + | |
| 2121 | + | |
| 2122 | + | |
| 2123 | + | |
| 2124 | + | |
| 2125 | + | |
| 2126 | + | |
| 2127 | + | |
| 2128 | + | |
| 2129 | + | |
| 2130 | + | |
| 2131 | + | |
| 2132 | + | |
| 2133 | + | |
| 2134 | + | |
| 2135 | + | |
| 2136 | + | |
| 2137 | + | |
| 2138 | + | |
| 2139 | + | |
| 2140 | + | |
| 2141 | + | |
| 2142 | + | |
| 2143 | + | |
2109 | 2144 | | |
2110 | 2145 | | |
2111 | 2146 | | |
| |||
2121 | 2156 | | |
2122 | 2157 | | |
2123 | 2158 | | |
2124 | | - | |
2125 | | - | |
2126 | | - | |
2127 | | - | |
2128 | | - | |
2129 | | - | |
2130 | | - | |
2131 | | - | |
2132 | | - | |
2133 | | - | |
| 2159 | + | |
| 2160 | + | |
| 2161 | + | |
| 2162 | + | |
2134 | 2163 | | |
2135 | 2164 | | |
2136 | 2165 | | |
| |||
2153 | 2182 | | |
2154 | 2183 | | |
2155 | 2184 | | |
2156 | | - | |
2157 | | - | |
2158 | | - | |
2159 | | - | |
2160 | | - | |
2161 | | - | |
2162 | | - | |
| 2185 | + | |
| 2186 | + | |
| 2187 | + | |
2163 | 2188 | | |
2164 | | - | |
2165 | | - | |
| 2189 | + | |
2166 | 2190 | | |
2167 | 2191 | | |
2168 | 2192 | | |
| |||
0 commit comments