Release 4.11 net/ipv4/netfilter/arpt_mangle.c
/* module that allows mangling of the arp payload */
#include <linux/module.h>
#include <linux/netfilter.h>
#include <linux/netfilter_arp/arpt_mangle.h>
#include <net/sock.h>
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Bart De Schuymer <bdschuym@pandora.be>");
MODULE_DESCRIPTION("arptables arp payload mangle target");
static unsigned int
target(struct sk_buff *skb, const struct xt_action_param *par)
{
const struct arpt_mangle *mangle = par->targinfo;
const struct arphdr *arp;
unsigned char *arpptr;
int pln, hln;
if (!skb_make_writable(skb, skb->len))
return NF_DROP;
arp = arp_hdr(skb);
arpptr = skb_network_header(skb) + sizeof(*arp);
pln = arp->ar_pln;
hln = arp->ar_hln;
/* We assume that pln and hln were checked in the match */
if (mangle->flags & ARPT_MANGLE_SDEV) {
if (ARPT_DEV_ADDR_LEN_MAX < hln ||
(arpptr + hln > skb_tail_pointer(skb)))
return NF_DROP;
memcpy(arpptr, mangle->src_devaddr, hln);
}
arpptr += hln;
if (mangle->flags & ARPT_MANGLE_SIP) {
if (ARPT_MANGLE_ADDR_LEN_MAX < pln ||
(arpptr + pln > skb_tail_pointer(skb)))
return NF_DROP;
memcpy(arpptr, &mangle->u_s.src_ip, pln);
}
arpptr += pln;
if (mangle->flags & ARPT_MANGLE_TDEV) {
if (ARPT_DEV_ADDR_LEN_MAX < hln ||
(arpptr + hln > skb_tail_pointer(skb)))
return NF_DROP;
memcpy(arpptr, mangle->tgt_devaddr, hln);
}
arpptr += hln;
if (mangle->flags & ARPT_MANGLE_TIP) {
if (ARPT_MANGLE_ADDR_LEN_MAX < pln ||
(arpptr + pln > skb_tail_pointer(skb)))
return NF_DROP;
memcpy(arpptr, &mangle->u_t.tgt_ip, pln);
}
return mangle->target;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Bart De Schuymer | 240 | 86.02% | 1 | 10.00% |
Arnaldo Carvalho de Melo | 18 | 6.45% | 3 | 30.00% |
Herbert Xu | 15 | 5.38% | 2 | 20.00% |
Jan Engelhardt | 5 | 1.79% | 3 | 30.00% |
Joonwoo Park | 1 | 0.36% | 1 | 10.00% |
Total | 279 | 100.00% | 10 | 100.00% |
static int checkentry(const struct xt_tgchk_param *par)
{
const struct arpt_mangle *mangle = par->targinfo;
if (mangle->flags & ~ARPT_MANGLE_MASK ||
!(mangle->flags & ARPT_MANGLE_MASK))
return -EINVAL;
if (mangle->target != NF_DROP && mangle->target != NF_ACCEPT &&
mangle->target != XT_CONTINUE)
return -EINVAL;
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Bart De Schuymer | 58 | 81.69% | 1 | 16.67% |
Jan Engelhardt | 6 | 8.45% | 3 | 50.00% |
Pablo Neira Ayuso | 5 | 7.04% | 1 | 16.67% |
Patrick McHardy | 2 | 2.82% | 1 | 16.67% |
Total | 71 | 100.00% | 6 | 100.00% |
static struct xt_target arpt_mangle_reg __read_mostly = {
.name = "mangle",
.family = NFPROTO_ARP,
.target = target,
.targetsize = sizeof(struct arpt_mangle),
.checkentry = checkentry,
.me = THIS_MODULE,
};
static int __init arpt_mangle_init(void)
{
return xt_register_target(&arpt_mangle_reg);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Bart De Schuymer | 13 | 81.25% | 1 | 33.33% |
Jan Engelhardt | 2 | 12.50% | 1 | 33.33% |
Andrew Morton | 1 | 6.25% | 1 | 33.33% |
Total | 16 | 100.00% | 3 | 100.00% |
static void __exit arpt_mangle_fini(void)
{
xt_unregister_target(&arpt_mangle_reg);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Bart De Schuymer | 13 | 86.67% | 1 | 33.33% |
Jan Engelhardt | 1 | 6.67% | 1 | 33.33% |
Andrew Morton | 1 | 6.67% | 1 | 33.33% |
Total | 15 | 100.00% | 3 | 100.00% |
module_init(arpt_mangle_init);
module_exit(arpt_mangle_fini);
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Bart De Schuymer | 370 | 80.26% | 2 | 8.70% |
Jan Engelhardt | 20 | 4.34% | 9 | 39.13% |
Arnaldo Carvalho de Melo | 18 | 3.90% | 3 | 13.04% |
Herbert Xu | 18 | 3.90% | 2 | 8.70% |
Harald Welte | 13 | 2.82% | 1 | 4.35% |
Patrick McHardy | 12 | 2.60% | 3 | 13.04% |
Pablo Neira Ayuso | 5 | 1.08% | 1 | 4.35% |
Andrew Morton | 4 | 0.87% | 1 | 4.35% |
Joonwoo Park | 1 | 0.22% | 1 | 4.35% |
Total | 461 | 100.00% | 23 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.