#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/ip.h>
#include <linux/netdevice.h>
#include <linux/skbuff.h>
#include <linux/if_arp.h>
#include <linux/if_ether.h>
#include <linux/if_vlan.h>
#include <linux/if_pppox.h>
#include <linux/ppp_defs.h>
#include <linux/netfilter_bridge.h>
#include <uapi/linux/netfilter_bridge.h>
#include <linux/netfilter_ipv4.h>
#include <linux/netfilter_ipv6.h>
#include <linux/netfilter_arp.h>
#include <linux/in_route.h>
#include <linux/rculist.h>
#include <linux/inetdevice.h>
#include <net/ip.h>
#include <net/ipv6.h>
#include <net/addrconf.h>
#include <net/dst_metadata.h>
#include <net/route.h>
#include <net/netfilter/br_netfilter.h>
#include <net/netns/generic.h>
#include <net/inet_dscp.h>
#include <linux/uaccess.h>
#include "br_private.h"
#ifdef CONFIG_SYSCTL
#include <linux/sysctl.h>
#endif
#if IS_ENABLED(CONFIG_NF_CONNTRACK)
#include <net/netfilter/nf_conntrack_core.h>
#endif
static unsigned int brnf_net_id __read_mostly;
struct brnf_net { … };
#define IS_IP(skb) …
#define IS_IPV6(skb) …
#define IS_ARP(skb) …
static inline __be16 vlan_proto(const struct sk_buff *skb)
{ … }
static inline bool is_vlan_ip(const struct sk_buff *skb, const struct net *net)
{ … }
static inline bool is_vlan_ipv6(const struct sk_buff *skb,
const struct net *net)
{ … }
static inline bool is_vlan_arp(const struct sk_buff *skb, const struct net *net)
{ … }
static inline __be16 pppoe_proto(const struct sk_buff *skb)
{ … }
static inline bool is_pppoe_ip(const struct sk_buff *skb, const struct net *net)
{ … }
static inline bool is_pppoe_ipv6(const struct sk_buff *skb,
const struct net *net)
{ … }
#define NF_BRIDGE_MAX_MAC_HEADER_LENGTH …
struct brnf_frag_data { … };
static DEFINE_PER_CPU(struct brnf_frag_data, brnf_frag_data_storage) = …;
static void nf_bridge_info_free(struct sk_buff *skb)
{ … }
static inline struct net_device *bridge_parent(const struct net_device *dev)
{ … }
static inline struct nf_bridge_info *nf_bridge_unshare(struct sk_buff *skb)
{ … }
unsigned int nf_bridge_encap_header_len(const struct sk_buff *skb)
{ … }
static inline void nf_bridge_pull_encap_header(struct sk_buff *skb)
{ … }
static inline void nf_bridge_pull_encap_header_rcsum(struct sk_buff *skb)
{ … }
static int br_validate_ipv4(struct net *net, struct sk_buff *skb)
{ … }
void nf_bridge_update_protocol(struct sk_buff *skb)
{ … }
int br_nf_pre_routing_finish_bridge(struct net *net, struct sock *sk, struct sk_buff *skb)
{ … }
static inline bool
br_nf_ipv4_daddr_was_changed(const struct sk_buff *skb,
const struct nf_bridge_info *nf_bridge)
{ … }
static int br_nf_pre_routing_finish(struct net *net, struct sock *sk, struct sk_buff *skb)
{ … }
static struct net_device *brnf_get_logical_dev(struct sk_buff *skb,
const struct net_device *dev,
const struct net *net)
{ … }
struct net_device *setup_pre_routing(struct sk_buff *skb, const struct net *net)
{ … }
static unsigned int br_nf_pre_routing(void *priv,
struct sk_buff *skb,
const struct nf_hook_state *state)
{ … }
#if IS_ENABLED(CONFIG_NF_CONNTRACK)
static unsigned int br_nf_local_in(void *priv,
struct sk_buff *skb,
const struct nf_hook_state *state)
{ … }
#endif
static int br_nf_forward_finish(struct net *net, struct sock *sk, struct sk_buff *skb)
{ … }
static unsigned int br_nf_forward_ip(struct sk_buff *skb,
const struct nf_hook_state *state,
u8 pf)
{ … }
static unsigned int br_nf_forward_arp(struct sk_buff *skb,
const struct nf_hook_state *state)
{ … }
static unsigned int br_nf_forward(void *priv,
struct sk_buff *skb,
const struct nf_hook_state *state)
{ … }
static int br_nf_push_frag_xmit(struct net *net, struct sock *sk, struct sk_buff *skb)
{ … }
static int
br_nf_ip_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
int (*output)(struct net *, struct sock *, struct sk_buff *))
{ … }
static unsigned int nf_bridge_mtu_reduction(const struct sk_buff *skb)
{ … }
static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buff *skb)
{ … }
static unsigned int br_nf_post_routing(void *priv,
struct sk_buff *skb,
const struct nf_hook_state *state)
{ … }
static unsigned int ip_sabotage_in(void *priv,
struct sk_buff *skb,
const struct nf_hook_state *state)
{ … }
static void br_nf_pre_routing_finish_bridge_slow(struct sk_buff *skb)
{ … }
static int br_nf_dev_xmit(struct sk_buff *skb)
{ … }
static const struct nf_br_ops br_ops = …;
static const struct nf_hook_ops br_nf_ops[] = …;
static int brnf_device_event(struct notifier_block *unused, unsigned long event,
void *ptr)
{ … }
static struct notifier_block brnf_notifier __read_mostly = …;
int br_nf_hook_thresh(unsigned int hook, struct net *net,
struct sock *sk, struct sk_buff *skb,
struct net_device *indev,
struct net_device *outdev,
int (*okfn)(struct net *, struct sock *,
struct sk_buff *))
{ … }
#ifdef CONFIG_SYSCTL
static
int brnf_sysctl_call_tables(const struct ctl_table *ctl, int write,
void *buffer, size_t *lenp, loff_t *ppos)
{ … }
static struct ctl_table brnf_table[] = …;
static inline void br_netfilter_sysctl_default(struct brnf_net *brnf)
{ … }
static int br_netfilter_sysctl_init_net(struct net *net)
{ … }
static void br_netfilter_sysctl_exit_net(struct net *net,
struct brnf_net *brnet)
{ … }
static int __net_init brnf_init_net(struct net *net)
{ … }
#endif
static void __net_exit brnf_exit_net(struct net *net)
{ … }
static struct pernet_operations brnf_net_ops __read_mostly = …;
static int __init br_netfilter_init(void)
{ … }
static void __exit br_netfilter_fini(void)
{ … }
module_init(…) …;
module_exit(br_netfilter_fini);
MODULE_LICENSE(…) …;
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;