]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - net/bridge/br_netfilter.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
[net-next-2.6.git] / net / bridge / br_netfilter.c
index 77f7b5fda45a534dfb9c81c9d58324beff3a073e..865fd7634b673d4233c8a6758e2426db55696514 100644 (file)
@@ -64,22 +64,24 @@ static int brnf_filter_pppoe_tagged __read_mostly = 0;
 
 static inline __be16 vlan_proto(const struct sk_buff *skb)
 {
-       return vlan_eth_hdr(skb)->h_vlan_encapsulated_proto;
+       if (vlan_tx_tag_present(skb))
+               return skb->protocol;
+       else if (skb->protocol == htons(ETH_P_8021Q))
+               return vlan_eth_hdr(skb)->h_vlan_encapsulated_proto;
+       else
+               return 0;
 }
 
 #define IS_VLAN_IP(skb) \
-       (skb->protocol == htons(ETH_P_8021Q) && \
-        vlan_proto(skb) == htons(ETH_P_IP) &&  \
+       (vlan_proto(skb) == htons(ETH_P_IP) && \
         brnf_filter_vlan_tagged)
 
 #define IS_VLAN_IPV6(skb) \
-       (skb->protocol == htons(ETH_P_8021Q) && \
-        vlan_proto(skb) == htons(ETH_P_IPV6) &&\
+       (vlan_proto(skb) == htons(ETH_P_IPV6) && \
         brnf_filter_vlan_tagged)
 
 #define IS_VLAN_ARP(skb) \
-       (skb->protocol == htons(ETH_P_8021Q) && \
-        vlan_proto(skb) == htons(ETH_P_ARP) && \
+       (vlan_proto(skb) == htons(ETH_P_ARP) && \
         brnf_filter_vlan_tagged)
 
 static inline __be16 pppoe_proto(const struct sk_buff *skb)
@@ -106,7 +108,6 @@ static struct dst_ops fake_dst_ops = {
        .family =               AF_INET,
        .protocol =             cpu_to_be16(ETH_P_IP),
        .update_pmtu =          fake_update_pmtu,
-       .entries =              ATOMIC_INIT(0),
 };
 
 /*
@@ -214,7 +215,7 @@ static inline void nf_bridge_update_protocol(struct sk_buff *skb)
  * expected format
  */
 
-int br_parse_ip_options(struct sk_buff *skb)
+static int br_parse_ip_options(struct sk_buff *skb)
 {
        struct ip_options *opt;
        struct iphdr *iph;
@@ -1003,15 +1004,22 @@ int __init br_netfilter_init(void)
 {
        int ret;
 
-       ret = nf_register_hooks(br_nf_ops, ARRAY_SIZE(br_nf_ops));
+       ret = dst_entries_init(&fake_dst_ops);
        if (ret < 0)
                return ret;
+
+       ret = nf_register_hooks(br_nf_ops, ARRAY_SIZE(br_nf_ops));
+       if (ret < 0) {
+               dst_entries_destroy(&fake_dst_ops);
+               return ret;
+       }
 #ifdef CONFIG_SYSCTL
        brnf_sysctl_header = register_sysctl_paths(brnf_path, brnf_table);
        if (brnf_sysctl_header == NULL) {
                printk(KERN_WARNING
                       "br_netfilter: can't register to sysctl.\n");
                nf_unregister_hooks(br_nf_ops, ARRAY_SIZE(br_nf_ops));
+               dst_entries_destroy(&fake_dst_ops);
                return -ENOMEM;
        }
 #endif
@@ -1025,4 +1033,5 @@ void br_netfilter_fini(void)
 #ifdef CONFIG_SYSCTL
        unregister_sysctl_table(brnf_sysctl_header);
 #endif
+       dst_entries_destroy(&fake_dst_ops);
 }