linux/net/netfilter/nf_flow_table_inet.c
<<
>>
Prefs
   1#include <linux/kernel.h>
   2#include <linux/init.h>
   3#include <linux/module.h>
   4#include <linux/netfilter.h>
   5#include <linux/rhashtable.h>
   6#include <net/netfilter/nf_flow_table.h>
   7#include <net/netfilter/nf_tables.h>
   8
   9static unsigned int
  10nf_flow_offload_inet_hook(void *priv, struct sk_buff *skb,
  11                          const struct nf_hook_state *state)
  12{
  13        switch (skb->protocol) {
  14        case htons(ETH_P_IP):
  15                return nf_flow_offload_ip_hook(priv, skb, state);
  16        case htons(ETH_P_IPV6):
  17                return nf_flow_offload_ipv6_hook(priv, skb, state);
  18        }
  19
  20        return NF_ACCEPT;
  21}
  22
  23static struct nf_flowtable_type flowtable_inet = {
  24        .family         = NFPROTO_INET,
  25        .params         = &nf_flow_offload_rhash_params,
  26        .gc             = nf_flow_offload_work_gc,
  27        .free           = nf_flow_table_free,
  28        .hook           = nf_flow_offload_inet_hook,
  29        .owner          = THIS_MODULE,
  30};
  31
  32static int __init nf_flow_inet_module_init(void)
  33{
  34        nft_register_flowtable_type(&flowtable_inet);
  35
  36        return 0;
  37}
  38
  39static void __exit nf_flow_inet_module_exit(void)
  40{
  41        nft_unregister_flowtable_type(&flowtable_inet);
  42}
  43
  44module_init(nf_flow_inet_module_init);
  45module_exit(nf_flow_inet_module_exit);
  46
  47MODULE_LICENSE("GPL");
  48MODULE_AUTHOR("Pablo Neira Ayuso <pablo@netfilter.org>");
  49MODULE_ALIAS_NF_FLOWTABLE(1); /* NFPROTO_INET */
  50