Release 4.11 net/ipv6/netfilter/ip6t_mh.c
/*
* Copyright (C)2006 USAGI/WIDE Project
*
* 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.
*
* Author:
* Masahide NAKAMURA @USAGI <masahide.nakamura.cz@hitachi.com>
*
* Based on net/netfilter/xt_tcpudp.c
*
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/types.h>
#include <linux/module.h>
#include <net/ip.h>
#include <linux/ipv6.h>
#include <net/ipv6.h>
#include <net/mip6.h>
#include <linux/netfilter/x_tables.h>
#include <linux/netfilter_ipv6/ip6t_mh.h>
MODULE_DESCRIPTION("Xtables: IPv6 Mobility Header match");
MODULE_LICENSE("GPL");
/* Returns 1 if the type is matched by the range, 0 otherwise */
static inline bool
type_match(u_int8_t min, u_int8_t max, u_int8_t type, bool invert)
{
return (type >= min && type <= max) ^ invert;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Masahide Nakamura | 29 | 90.62% | 1 | 50.00% |
Jan Engelhardt | 3 | 9.38% | 1 | 50.00% |
Total | 32 | 100.00% | 2 | 100.00% |
static bool mh_mt6(const struct sk_buff *skb, struct xt_action_param *par)
{
struct ip6_mh _mh;
const struct ip6_mh *mh;
const struct ip6t_mh *mhinfo = par->matchinfo;
/* Must not be a fragment. */
if (par->fragoff != 0)
return false;
mh = skb_header_pointer(skb, par->thoff, sizeof(_mh), &_mh);
if (mh == NULL) {
/* We've been asked to examine this packet, and we
can't. Hence, no choice but to drop. */
pr_debug("Dropping evil MH tinygram.\n");
par->hotdrop = true;
return false;
}
if (mh->ip6mh_proto != IPPROTO_NONE) {
pr_debug("Dropping invalid MH Payload Proto: %u\n",
mh->ip6mh_proto);
par->hotdrop = true;
return false;
}
return type_match(mhinfo->types[0], mhinfo->types[1], mh->ip6mh_type,
!!(mhinfo->invflags & IP6T_MH_INV_TYPE));
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Masahide Nakamura | 122 | 80.79% | 2 | 22.22% |
Jan Engelhardt | 29 | 19.21% | 7 | 77.78% |
Total | 151 | 100.00% | 9 | 100.00% |
static int mh_mt6_check(const struct xt_mtchk_param *par)
{
const struct ip6t_mh *mhinfo = par->matchinfo;
/* Must specify no unknown invflags */
return (mhinfo->invflags & ~IP6T_MH_INV_MASK) ? -EINVAL : 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Masahide Nakamura | 27 | 71.05% | 1 | 20.00% |
Jan Engelhardt | 11 | 28.95% | 4 | 80.00% |
Total | 38 | 100.00% | 5 | 100.00% |
static struct xt_match mh_mt6_reg __read_mostly = {
.name = "mh",
.family = NFPROTO_IPV6,
.checkentry = mh_mt6_check,
.match = mh_mt6,
.matchsize = sizeof(struct ip6t_mh),
.proto = IPPROTO_MH,
.me = THIS_MODULE,
};
static int __init mh_mt6_init(void)
{
return xt_register_match(&mh_mt6_reg);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Masahide Nakamura | 14 | 87.50% | 1 | 50.00% |
Jan Engelhardt | 2 | 12.50% | 1 | 50.00% |
Total | 16 | 100.00% | 2 | 100.00% |
static void __exit mh_mt6_exit(void)
{
xt_unregister_match(&mh_mt6_reg);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Masahide Nakamura | 13 | 86.67% | 1 | 50.00% |
Jan Engelhardt | 2 | 13.33% | 1 | 50.00% |
Total | 15 | 100.00% | 2 | 100.00% |
module_init(mh_mt6_init);
module_exit(mh_mt6_exit);
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Masahide Nakamura | 290 | 82.39% | 2 | 13.33% |
Jan Engelhardt | 61 | 17.33% | 12 | 80.00% |
Patrick McHardy | 1 | 0.28% | 1 | 6.67% |
Total | 352 | 100.00% | 15 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.