cregit-Linux how code gets into the kernel

Release 4.11 net/netfilter/xt_length.c

Directory: net/netfilter
/* Kernel module to match packet length. */
/* (C) 1999-2001 James Morris <jmorros@intercode.com.au>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

#include <linux/module.h>
#include <linux/skbuff.h>
#include <linux/ipv6.h>
#include <net/ip.h>

#include <linux/netfilter/xt_length.h>
#include <linux/netfilter/x_tables.h>

MODULE_AUTHOR("James Morris <jmorris@intercode.com.au>");
MODULE_DESCRIPTION("Xtables: Packet length (Layer3,4,5) match");
MODULE_LICENSE("GPL");
MODULE_ALIAS("ipt_length");
MODULE_ALIAS("ip6t_length");


static bool length_mt(const struct sk_buff *skb, struct xt_action_param *par) { const struct xt_length_info *info = par->matchinfo; u_int16_t pktlen = ntohs(ip_hdr(skb)->tot_len); return (pktlen >= info->min && pktlen <= info->max) ^ info->invert; }

Contributors

PersonTokensPropCommitsCommitProp
Pablo Neira Ayuso2847.46%114.29%
Harald Welte2237.29%114.29%
Jan Engelhardt610.17%457.14%
Arnaldo Carvalho de Melo35.08%114.29%
Total59100.00%7100.00%


static bool length_mt6(const struct sk_buff *skb, struct xt_action_param *par) { const struct xt_length_info *info = par->matchinfo; const u_int16_t pktlen = ntohs(ipv6_hdr(skb)->payload_len) + sizeof(struct ipv6hdr); return (pktlen >= info->min && pktlen <= info->max) ^ info->invert; }

Contributors

PersonTokensPropCommitsCommitProp
Harald Welte3146.97%114.29%
Pablo Neira Ayuso2537.88%114.29%
Jan Engelhardt69.09%457.14%
Arnaldo Carvalho de Melo46.06%114.29%
Total66100.00%7100.00%

static struct xt_match length_mt_reg[] __read_mostly = { { .name = "length", .family = NFPROTO_IPV4, .match = length_mt, .matchsize = sizeof(struct xt_length_info), .me = THIS_MODULE, }, { .name = "length", .family = NFPROTO_IPV6, .match = length_mt6, .matchsize = sizeof(struct xt_length_info), .me = THIS_MODULE, }, };
static int __init length_mt_init(void) { return xt_register_matches(length_mt_reg, ARRAY_SIZE(length_mt_reg)); }

Contributors

PersonTokensPropCommitsCommitProp
Pablo Neira Ayuso1260.00%125.00%
Patrick McHardy420.00%125.00%
Jan Engelhardt315.00%125.00%
Harald Welte15.00%125.00%
Total20100.00%4100.00%


static void __exit length_mt_exit(void) { xt_unregister_matches(length_mt_reg, ARRAY_SIZE(length_mt_reg)); }

Contributors

PersonTokensPropCommitsCommitProp
Pablo Neira Ayuso1157.89%125.00%
Patrick McHardy421.05%125.00%
Jan Engelhardt315.79%125.00%
Harald Welte15.26%125.00%
Total19100.00%4100.00%

module_init(length_mt_init); module_exit(length_mt_exit);

Overall Contributors

PersonTokensPropCommitsCommitProp
Pablo Neira Ayuso13245.52%17.14%
Harald Welte8830.34%17.14%
Patrick McHardy3411.72%321.43%
Jan Engelhardt268.97%642.86%
Arnaldo Carvalho de Melo72.41%214.29%
David S. Miller31.03%17.14%
Total290100.00%14100.00%
Directory: net/netfilter
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.