cregit-Linux how code gets into the kernel

Release 4.7 net/bridge/netfilter/ebtable_broute.c

/*
 *  ebtable_broute
 *
 *      Authors:
 *      Bart De Schuymer <bdschuym@pandora.be>
 *
 *  April, 2002
 *
 *  This table lets you choose between routing and bridging for frames
 *  entering on a bridge enslaved nic. This table is traversed before any
 *  other ebtables table. See net/bridge/br_input.c.
 */

#include <linux/netfilter_bridge/ebtables.h>
#include <linux/module.h>
#include <linux/if_bridge.h>

/* EBT_ACCEPT means the frame will be bridged
 * EBT_DROP means the frame will be routed
 */

static struct ebt_entries initial_chain = {
	.name		= "BROUTING",
	.policy		= EBT_ACCEPT,
};


static struct ebt_replace_kernel initial_table = {
	.name		= "broute",
	.valid_hooks	= 1 << NF_BR_BROUTING,
	.entries_size	= sizeof(struct ebt_entries),
	.hook_entry	= {
		[NF_BR_BROUTING]	= &initial_chain,
        },
	.entries	= (char *)&initial_chain,
};


static int check(const struct ebt_table_info *info, unsigned int valid_hooks) { if (valid_hooks & ~(1 << NF_BR_BROUTING)) return -EINVAL; return 0; }

Contributors

PersonTokensPropCommitsCommitProp
bart de schuymerbart de schuymer34100.00%1100.00%
Total34100.00%1100.00%

static const struct ebt_table broute_table = { .name = "broute", .table = &initial_table, .valid_hooks = 1 << NF_BR_BROUTING, .check = check, .me = THIS_MODULE, };
static int ebt_broute(struct sk_buff *skb) { struct nf_hook_state state; int ret; nf_hook_state_init(&state, NULL, NF_BR_BROUTING, INT_MIN, NFPROTO_BRIDGE, skb->dev, NULL, NULL, dev_net(skb->dev), NULL); ret = ebt_do_table(skb, &state, state.net->xt.broute_table); if (ret == NF_DROP) return 1; /* route it */ return 0; /* bridge it */ }

Contributors

PersonTokensPropCommitsCommitProp
bart de schuymerbart de schuymer3948.15%240.00%
eric w. biedermaneric w. biederman3138.27%120.00%
alexey dobriyanalexey dobriyan911.11%120.00%
herbert xuherbert xu22.47%120.00%
Total81100.00%5100.00%


static int __net_init broute_net_init(struct net *net) { net->xt.broute_table = ebt_register_table(net, &broute_table); return PTR_ERR_OR_ZERO(net->xt.broute_table); }

Contributors

PersonTokensPropCommitsCommitProp
alexey dobriyanalexey dobriyan2466.67%360.00%
bart de schuymerbart de schuymer1130.56%120.00%
rusty russellrusty russell12.78%120.00%
Total36100.00%5100.00%


static void __net_exit broute_net_exit(struct net *net) { ebt_unregister_table(net, net->xt.broute_table); }

Contributors

PersonTokensPropCommitsCommitProp
alexey dobriyanalexey dobriyan23100.00%3100.00%
Total23100.00%3100.00%

static struct pernet_operations broute_net_ops = { .init = broute_net_init, .exit = broute_net_exit, };
static int __init ebtable_broute_init(void) { int ret; ret = register_pernet_subsys(&broute_net_ops); if (ret < 0) return ret; /* see br_input.c */ RCU_INIT_POINTER(br_should_route_hook, (br_should_route_hook_t *)ebt_broute); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
alexey dobriyanalexey dobriyan2863.64%228.57%
bart de schuymerbart de schuymer818.18%228.57%
eric dumazeteric dumazet49.09%114.29%
pavel emelianovpavel emelianov36.82%114.29%
stephen hemmingerstephen hemminger12.27%114.29%
Total44100.00%7100.00%


static void __exit ebtable_broute_fini(void) { RCU_INIT_POINTER(br_should_route_hook, NULL); synchronize_net(); unregister_pernet_subsys(&broute_net_ops); }

Contributors

PersonTokensPropCommitsCommitProp
bart de schuymerbart de schuymer1560.00%116.67%
pavel emelianovpavel emelianov312.00%116.67%
alexey dobriyanalexey dobriyan312.00%116.67%
stephen hemmingerstephen hemminger312.00%233.33%
andrew mortonandrew morton14.00%116.67%
Total25100.00%6100.00%

module_init(ebtable_broute_init); module_exit(ebtable_broute_fini); MODULE_LICENSE("GPL");

Overall Contributors

PersonTokensPropCommitsCommitProp
bart de schuymerbart de schuymer19449.87%316.67%
alexey dobriyanalexey dobriyan10526.99%422.22%
art haasart haas379.51%15.56%
eric w. biedermaneric w. biederman317.97%15.56%
pavel emelianovpavel emelianov61.54%15.56%
eric dumazeteric dumazet41.03%15.56%
stephen hemmingerstephen hemminger41.03%211.11%
andrew mortonandrew morton30.77%15.56%
herbert xuherbert xu20.51%15.56%
al viroal viro10.26%15.56%
jan engelhardtjan engelhardt10.26%15.56%
rusty russellrusty russell10.26%15.56%
Total389100.00%18100.00%
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
{% endraw %}