get rid of skb->nf_bridge pointer
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest14 patches 4 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/14 | netfilter: bridge: really save frag_max_size between PRE and POST_ROUTINGnet/ | +15 | 2 replies | |
| 2/14 | net: untangle ip_fragment and bridge netfilterinclude/ include/ net/ +1 more | +53 | 2 replies | |
| 3/14 | netfilter: bridge: don't use nf_bridge_info data to store mac headernet/ | +32 | 0 replies | |
| 4/14 | netfilter: bridge: start splitting mask into public/private chunksinclude/ include/ net/ | +17 | 0 replies | |
| 5/14 | netfilter: bridge: make BRNF_PKT_TYPE flag a boolinclude/ include/ net/ | +10 | 0 replies | |
| 6/14 | netfilter: bridge: rename and resize 'data' fieldinclude/ net/ | +7 | 0 replies | |
| 7/14 | netfilter: bridge: add helpers for fetching physin/outdevinclude/ net/ net/ +5 more | +97 | 0 replies | |
| 8/14 | netfilter: physdev: use helpersnet/ | +22 | 0 replies | |
| 9/14 | netfilter: bridge: add and use nf_bridge_info_get helpernet/ | +16 | 0 replies | |
| 10/14 | netfilter: bridge: move bridge netfilter state into sk_buffinclude/ include/ net/ +11 more | +75 | 0 replies | |
| 11/14 | netfilter: bridge: remove skb->nf_bridgeinclude/ include/ include/ +3 more | +289 | 0 replies | |
| 12/14 | netfilter: bridge: discard nf_bridge info on xmitnet/ | +14 | 0 replies | |
| 13/14 | netfilter: bridge: neigh_head and physoutdev can't be used at same timeinclude/ net/ | +7 | 0 replies | |
| 14/14 | netfilter: bridge: hold physinport ref during neigh resolutioninclude/ net/ | +16 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH nf-next 00/14] get rid of skb->nf_bridge pointer
[ netdev hackers are encouraged to look at patches #2 and #11 specifically,
those are the ones with largest impact outside netfilter land ]
Remove skb->nf_bridge pointer.
Unfortunately we still need some way to decide if skb is bridged or not, else kfree_skb, skb_clone etc. would have to do costly lookups in bridge netfilter.
We use a 2 bit state field in the skb for this purpose. If its zero, skb is not bridged (same as skb->nf_bridge == NULL in current kernel).
nf_bridge_info is stored in an rhashtable; bridge netfilter and the few other places (nfqueue, nflog, physdev match) that need to access bridge netfilter data do on-demand lookups in an rhashtable to access the data associated with a bridged skb.
skb_clone and skb_copy will call into netfilter core helpers for bridged skbs to duplicate the information if needed. Likewise, kfree_skb removes and frees the bridge netfilter meta data as well if needed.
In order to avoid those lookups where we're dealing with non-bridged skbs, we store 2 bit state field in the skb.
Tested, on host connected to kvm-bridge:
ping -s $bignum $ip_behind_bridge
on bridge:
-j REDIRECT
-j DNAT --to-destination $ip_behind_bridge
-m physdev match with in/outdev match in FORWARD and INPUT (indev only)
- same w. active -j NFQUEUE.
Patch 11 substitutes the pointer for on-demand lookups, most of the other patches prepare for this change by adding helpers and splitting state information into 'public' and 'bridge netfilter private'.
The alternative to the rhashtable is to store the bridge netfilter metadata in skb->cb[], but there are some caveats since we need such metadata to survive local delivery too (else we'd break use of physdev match in INPUT).
This is why external store was chosen.
Feedback and suggestions welcome.
include/linux/netfilter.h | 8 include/linux/netfilter_bridge.h | 104 +++++- include/linux/skbuff.h | 87 ++--- include/net/ip.h | 4 net/bridge/br_device.c | 19 - net/bridge/br_netfilter.c | 482 ++++++++++++++++++++--------- net/bridge/br_private.h | 2 net/core/skbuff.c | 5 net/ipv4/ip_output.c | 30 + net/ipv4/netfilter/nf_defrag_ipv4.c | 3 net/ipv4/netfilter/nf_reject_ipv4.c | 6 net/ipv6/netfilter/nf_defrag_ipv6_hooks.c | 3 net/ipv6/netfilter/nf_reject_ipv6.c | 6 net/netfilter/core.c | 49 ++ net/netfilter/ipset/ip_set_hash_netiface.c | 32 + net/netfilter/nf_log_common.c | 7 net/netfilter/nf_queue.c | 22 - net/netfilter/nfnetlink_log.c | 17 - net/netfilter/nfnetlink_queue_core.c | 34 +- net/netfilter/xt_physdev.c | 36 +- 20 files changed, 670 insertions(+), 286 deletions(-)