2 * Copyright (c) 2008 Patrick McHardy <kaber@trash.net>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
8 * Development of this code funded by Astaro AG (http://www.astaro.com/)
11 #include <linux/init.h>
12 #include <linux/module.h>
14 #include <linux/netfilter_ipv4.h>
15 #include <net/netfilter/nf_tables.h>
18 static unsigned int nft_ipv4_output(const struct nf_hook_ops *ops,
20 const struct net_device *in,
21 const struct net_device *out,
22 int (*okfn)(struct sk_buff *))
24 if (unlikely(skb->len < sizeof(struct iphdr) ||
25 ip_hdr(skb)->ihl < sizeof(struct iphdr) / 4)) {
27 pr_info("nf_tables_ipv4: ignoring short SOCK_RAW "
32 return nft_do_chain(ops, skb, in, out, okfn);
35 static struct nft_af_info nft_af_ipv4 __read_mostly = {
36 .family = NFPROTO_IPV4,
37 .nhooks = NF_INET_NUMHOOKS,
40 [NF_INET_LOCAL_OUT] = nft_ipv4_output,
44 static int __init nf_tables_ipv4_init(void)
46 return nft_register_afinfo(&nft_af_ipv4);
49 static void __exit nf_tables_ipv4_exit(void)
51 nft_unregister_afinfo(&nft_af_ipv4);
54 module_init(nf_tables_ipv4_init);
55 module_exit(nf_tables_ipv4_exit);
57 MODULE_LICENSE("GPL");
58 MODULE_AUTHOR("Patrick McHardy <kaber@trash.net>");
59 MODULE_ALIAS_NFT_FAMILY(AF_INET);