--- linux-2.4.19/net/ipv4/netfilter/ipt_dontfrag.c 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.4.19.dontfrag/net/ipv4/netfilter/ipt_dontfrag.c 2003-04-02 21:52:49.000000000 +0200 @@ -0,0 +1,61 @@ +/* + This is a module which is used to match the ipv4 DF bit. + This file is distributed under the terms of the GNU General Public + License (GPL). Copies of the GPL can be obtained from: + ftp://prep.ai.mit.edu/pub/gnu/GPL + + 01 apr 2003 Martijn Lievaart : No joke, initial development +*/ + +#include +#include +#include + +#include + +MODULE_AUTHOR("Martijn Lievaart "); +MODULE_DESCRIPTION("IP tables dont-frag bit matching module "); +MODULE_LICENSE("GPL"); + +static int +match(const struct sk_buff *skb, + const struct net_device *in, + const struct net_device *out, + const void *matchinfo, + int offset, + const void *hdr, + u_int16_t datalen, + int *hotdrop) +{ + const struct iphdr *iph = skb->nh.iph; + const __u16 frag_off = __constant_htons(iph->frag_off); + return (frag_off & IP_DF) != 0; +} + +static int +checkentry(const char *tablename, + const struct ipt_ip *ip, + void *matchinfo, + unsigned int matchsize, + unsigned int hook_mask) +{ + return 1; +} + +static struct ipt_match dontfrag_match += { { NULL, NULL }, "dontfrag", &match, &checkentry, NULL, THIS_MODULE }; + +static int __init init(void) +{ +/* printk("ipt_dontfrag loading\n"); */ + return ipt_register_match(&dontfrag_match); +} + +static void __exit fini(void) +{ + ipt_unregister_match(&dontfrag_match); +/* printk("ipt_dontfrag unloaded\n"); */ +} + +module_init(init); +module_exit(fini);