aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2007-05-03 06:36:16 -0400
committerDavid S. Miller <davem@davemloft.net>2007-05-03 06:36:16 -0400
commitfc38582db98533066f4ba64f948720483fbfe7b2 (patch)
tree350d7e725e4dedfbf41b3ee54d585ed2d609b607 /include
parentcfd6c38096d75c8b86782683c5f45c415a505b78 (diff)
[NETFILTER]: bridge netfilter: consolidate header pushing/pulling code
Consolidate the common push/pull sequences into a few helper functions. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/linux/netfilter_bridge.h25
1 files changed, 16 insertions, 9 deletions
diff --git a/include/linux/netfilter_bridge.h b/include/linux/netfilter_bridge.h
index 19060030bac9..533ee351a273 100644
--- a/include/linux/netfilter_bridge.h
+++ b/include/linux/netfilter_bridge.h
@@ -55,18 +55,25 @@ static inline int nf_bridge_maybe_copy_header(struct sk_buff *skb)
55 return 0; 55 return 0;
56} 56}
57 57
58static inline unsigned int nf_bridge_encap_header_len(const struct sk_buff *skb)
59{
60 switch (skb->protocol) {
61 case __constant_htons(ETH_P_8021Q):
62 return VLAN_HLEN;
63 case __constant_htons(ETH_P_PPP_SES):
64 return PPPOE_SES_HLEN;
65 default:
66 return 0;
67 }
68}
69
58/* This is called by the IP fragmenting code and it ensures there is 70/* This is called by the IP fragmenting code and it ensures there is
59 * enough room for the encapsulating header (if there is one). */ 71 * enough room for the encapsulating header (if there is one). */
60static inline int nf_bridge_pad(const struct sk_buff *skb) 72static inline unsigned int nf_bridge_pad(const struct sk_buff *skb)
61{ 73{
62 int padding = 0; 74 if (skb->nf_bridge)
63 75 return nf_bridge_encap_header_len(skb);
64 if (skb->nf_bridge && skb->protocol == htons(ETH_P_8021Q)) 76 return 0;
65 padding = VLAN_HLEN;
66 else if (skb->nf_bridge && skb->protocol == htons(ETH_P_PPP_SES))
67 padding = PPPOE_SES_HLEN;
68
69 return padding;
70} 77}
71 78
72struct bridge_skb_cb { 79struct bridge_skb_cb {