Release 4.11 net/ipv6/reassembly.c
/*
* IPv6 fragment reassembly
* Linux INET6 implementation
*
* Authors:
* Pedro Roque <roque@di.fc.ul.pt>
*
* Based on: net/ipv4/ip_fragment.c
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
/*
* Fixes:
* Andi Kleen Make it work with multiple hosts.
* More RFC compliance.
*
* Horst von Brand Add missing #include <linux/string.h>
* Alexey Kuznetsov SMP races, threading, cleanup.
* Patrick McHardy LRU queue of frag heads for evictor.
* Mitsuru KANDA @USAGI Register inet6_protocol{}.
* David Stevens and
* YOSHIFUJI,H. @USAGI Always remove fragment header to
* calculate ICV correctly.
*/
#define pr_fmt(fmt) "IPv6: " fmt
#include <linux/errno.h>
#include <linux/types.h>
#include <linux/string.h>
#include <linux/socket.h>
#include <linux/sockios.h>
#include <linux/jiffies.h>
#include <linux/net.h>
#include <linux/list.h>
#include <linux/netdevice.h>
#include <linux/in6.h>
#include <linux/ipv6.h>
#include <linux/icmpv6.h>
#include <linux/random.h>
#include <linux/jhash.h>
#include <linux/skbuff.h>
#include <linux/slab.h>
#include <linux/export.h>
#include <net/sock.h>
#include <net/snmp.h>
#include <net/ipv6.h>
#include <net/ip6_route.h>
#include <net/protocol.h>
#include <net/transp_v6.h>
#include <net/rawv6.h>
#include <net/ndisc.h>
#include <net/addrconf.h>
#include <net/inet_frag.h>
#include <net/inet_ecn.h>
static const char ip6_frag_cache_name[] = "ip6-frags";
struct ip6frag_skb_cb {
struct inet6_skb_parm h;
int offset;
};
#define FRAG6_CB(skb) ((struct ip6frag_skb_cb *)((skb)->cb))
static u8 ip6_frag_ecn(const struct ipv6hdr *ipv6h)
{
return 1 << (ipv6_get_dsfield(ipv6h) & INET_ECN_MASK);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Hannes Frederic Sowa | 24 | 100.00% | 1 | 100.00% |
Total | 24 | 100.00% | 1 | 100.00% |
static struct inet_frags ip6_frags;
static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff *prev,
struct net_device *dev);
/*
* callers should be careful not to use the hash value outside the ipfrag_lock
* as doing so could race with ipfrag_hash_rnd being recalculated.
*/
static unsigned int inet6_hash_frag(__be32 id, const struct in6_addr *saddr,
const struct in6_addr *daddr)
{
net_get_random_once(&ip6_frags.rnd, sizeof(ip6_frags.rnd));
return jhash_3words(ipv6_addr_hash(saddr), ipv6_addr_hash(daddr),
(__force u32)id, ip6_frags.rnd);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 21 | 34.43% | 1 | 11.11% |
Hannes Frederic Sowa | 18 | 29.51% | 1 | 11.11% |
Eric Dumazet | 9 | 14.75% | 2 | 22.22% |
Jozsef Kadlecsik | 5 | 8.20% | 1 | 11.11% |
David S. Miller | 3 | 4.92% | 1 | 11.11% |
Ilpo Järvinen | 3 | 4.92% | 1 | 11.11% |
Al Viro | 1 | 1.64% | 1 | 11.11% |
Florian Westphal | 1 | 1.64% | 1 | 11.11% |
Total | 61 | 100.00% | 9 | 100.00% |
static unsigned int ip6_hashfn(const struct inet_frag_queue *q)
{
const struct frag_queue *fq;
fq = container_of(q, struct frag_queue, q);
return inet6_hash_frag(fq->id, &fq->saddr, &fq->daddr);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
David S. Miller | 21 | 42.86% | 1 | 20.00% |
Pavel Emelyanov | 20 | 40.82% | 1 | 20.00% |
Yasuyuki Kozakai | 5 | 10.20% | 1 | 20.00% |
Florian Westphal | 2 | 4.08% | 1 | 20.00% |
Ilpo Järvinen | 1 | 2.04% | 1 | 20.00% |
Total | 49 | 100.00% | 5 | 100.00% |
bool ip6_frag_match(const struct inet_frag_queue *q, const void *a)
{
const struct frag_queue *fq;
const struct ip6_create_arg *arg = a;
fq = container_of(q, struct frag_queue, q);
return fq->id == arg->id &&
fq->user == arg->user &&
ipv6_addr_equal(&fq->saddr, arg->src) &&
ipv6_addr_equal(&fq->daddr, arg->dst) &&
(arg->iif == fq->iif ||
!(ipv6_addr_type(arg->dst) & (IPV6_ADDR_MULTICAST |
IPV6_ADDR_LINKLOCAL)));
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Pavel Emelyanov | 70 | 64.22% | 1 | 20.00% |
Michal Kubeček | 26 | 23.85% | 1 | 20.00% |
Patrick McHardy | 8 | 7.34% | 1 | 20.00% |
Florian Westphal | 4 | 3.67% | 1 | 20.00% |
Eric Dumazet | 1 | 0.92% | 1 | 20.00% |
Total | 109 | 100.00% | 5 | 100.00% |
EXPORT_SYMBOL(ip6_frag_match);
void ip6_frag_init(struct inet_frag_queue *q, const void *a)
{
struct frag_queue *fq = container_of(q, struct frag_queue, q);
const struct ip6_create_arg *arg = a;
fq->id = arg->id;
fq->user = arg->user;
fq->saddr = *arg->src;
fq->daddr = *arg->dst;
fq->ecn = arg->ecn;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Pavel Emelyanov | 45 | 56.25% | 2 | 25.00% |
Linus Torvalds (pre-git) | 13 | 16.25% | 2 | 25.00% |
Patrick McHardy | 8 | 10.00% | 1 | 12.50% |
Hannes Frederic Sowa | 8 | 10.00% | 1 | 12.50% |
Alexey Dobriyan | 4 | 5.00% | 1 | 12.50% |
Florian Westphal | 2 | 2.50% | 1 | 12.50% |
Total | 80 | 100.00% | 8 | 100.00% |
EXPORT_SYMBOL(ip6_frag_init);
void ip6_expire_frag_queue(struct net *net, struct frag_queue *fq,
struct inet_frags *frags)
{
struct net_device *dev = NULL;
spin_lock(&fq->q.lock);
if (fq->q.flags & INET_FRAG_COMPLETE)
goto out;
inet_frag_kill(&fq->q, frags);
rcu_read_lock();
dev = dev_get_by_index_rcu(net, fq->iif);
if (!dev)
goto out_rcu_unlock;
__IP6_INC_STATS(net, __in6_dev_get(dev), IPSTATS_MIB_REASMFAILS);
if (inet_frag_evicting(&fq->q))
goto out_rcu_unlock;
__IP6_INC_STATS(net, __in6_dev_get(dev), IPSTATS_MIB_REASMTIMEOUT);
/* Don't send error if the first segment did not arrive. */
if (!(fq->q.flags & INET_FRAG_FIRST_IN) || !fq->q.fragments)
goto out_rcu_unlock;
/* But use as source device on which LAST ARRIVED
* segment was received. And do not use fq->dev
* pointer directly, device might already disappeared.
*/
fq->q.fragments->dev = dev;
icmpv6_send(fq->q.fragments, ICMPV6_TIME_EXCEED, ICMPV6_EXC_FRAGTIME, 0);
out_rcu_unlock:
rcu_read_unlock();
out:
spin_unlock(&fq->q.lock);
inet_frag_put(&fq->q, frags);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 70 | 35.71% | 5 | 27.78% |
Hideaki Yoshifuji / 吉藤英明 | 28 | 14.29% | 1 | 5.56% |
Américo Wang | 24 | 12.24% | 1 | 5.56% |
Nikolay Aleksandrov | 18 | 9.18% | 3 | 16.67% |
Pavel Emelyanov | 14 | 7.14% | 1 | 5.56% |
Ingo Oeser | 13 | 6.63% | 1 | 5.56% |
Eric Dumazet | 13 | 6.63% | 2 | 11.11% |
Daniel Lezcano | 9 | 4.59% | 1 | 5.56% |
Denis V. Lunev | 4 | 2.04% | 1 | 5.56% |
Joe Perches | 2 | 1.02% | 1 | 5.56% |
Eric W. Biedermann | 1 | 0.51% | 1 | 5.56% |
Total | 196 | 100.00% | 18 | 100.00% |
EXPORT_SYMBOL(ip6_expire_frag_queue);
static void ip6_frag_expire(unsigned long data)
{
struct frag_queue *fq;
struct net *net;
fq = container_of((struct inet_frag_queue *)data, struct frag_queue, q);
net = container_of(fq->q.net, struct net, ipv6.frags);
ip6_expire_frag_queue(net, fq, &ip6_frags);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Américo Wang | 62 | 95.38% | 1 | 50.00% |
Linus Torvalds (pre-git) | 3 | 4.62% | 1 | 50.00% |
Total | 65 | 100.00% | 2 | 100.00% |
static struct frag_queue *
fq_find(struct net *net, __be32 id, const struct in6_addr *src,
const struct in6_addr *dst, int iif, u8 ecn)
{
struct inet_frag_queue *q;
struct ip6_create_arg arg;
unsigned int hash;
arg.id = id;
arg.user = IP6_DEFRAG_LOCAL_DELIVER;
arg.src = src;
arg.dst = dst;
arg.iif = iif;
arg.ecn = ecn;
hash = inet6_hash_frag(id, src, dst);
q = inet_frag_find(&net->ipv6.frags, &ip6_frags, &arg, hash);
if (IS_ERR_OR_NULL(q)) {
inet_frag_maybe_warn_overflow(q, pr_fmt());
return NULL;
}
return container_of(q, struct frag_queue, q);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Pavel Emelyanov | 54 | 37.24% | 4 | 30.77% |
Fabian Frederick | 41 | 28.28% | 1 | 7.69% |
Hannes Frederic Sowa | 18 | 12.41% | 2 | 15.38% |
Linus Torvalds (pre-git) | 14 | 9.66% | 2 | 15.38% |
Michal Kubeček | 9 | 6.21% | 1 | 7.69% |
Patrick McHardy | 5 | 3.45% | 1 | 7.69% |
Shan Wei | 3 | 2.07% | 1 | 7.69% |
Ilpo Järvinen | 1 | 0.69% | 1 | 7.69% |
Total | 145 | 100.00% | 13 | 100.00% |
static int ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb,
struct frag_hdr *fhdr, int nhoff)
{
struct sk_buff *prev, *next;
struct net_device *dev;
int offset, end, fragsize;
struct net *net = dev_net(skb_dst(skb)->dev);
u8 ecn;
if (fq->q.flags & INET_FRAG_COMPLETE)
goto err;
offset = ntohs(fhdr->frag_off) & ~0x7;
end = offset + (ntohs(ipv6_hdr(skb)->payload_len) -
((u8 *)(fhdr + 1) - (u8 *)(ipv6_hdr(skb) + 1)));
if ((unsigned int)end > IPV6_MAXPLEN) {
__IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)),
IPSTATS_MIB_INHDRERRORS);
icmpv6_param_prob(skb, ICMPV6_HDR_FIELD,
((u8 *)&fhdr->frag_off -
skb_network_header(skb)));
return -1;
}
ecn = ip6_frag_ecn(ipv6_hdr(skb));
if (skb->ip_summed == CHECKSUM_COMPLETE) {
const unsigned char *nh = skb_network_header(skb);
skb->csum = csum_sub(skb->csum,
csum_partial(nh, (u8 *)(fhdr + 1) - nh,
0));
}
/* Is this the final fragment? */
if (!(fhdr->frag_off & htons(IP6_MF))) {
/* If we already have some bits beyond end
* or have different end, the segment is corrupted.
*/
if (end < fq->q.len ||
((fq->q.flags & INET_FRAG_LAST_IN) && end != fq->q.len))
goto err;
fq->q.flags |= INET_FRAG_LAST_IN;
fq->q.len = end;
} else {
/* Check if the fragment is rounded to 8 bytes.
* Required by the RFC.
*/
if (end & 0x7) {
/* RFC2460 says always send parameter problem in
* this case. -DaveM
*/
__IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)),
IPSTATS_MIB_INHDRERRORS);
icmpv6_param_prob(skb, ICMPV6_HDR_FIELD,
offsetof(struct ipv6hdr, payload_len));
return -1;
}
if (end > fq->q.len) {
/* Some bits beyond end -> corruption. */
if (fq->q.flags & INET_FRAG_LAST_IN)
goto err;
fq->q.len = end;
}
}
if (end == offset)
goto err;
/* Point into the IP datagram 'data' part. */
if (!pskb_pull(skb, (u8 *) (fhdr + 1) - skb->data))
goto err;
if (pskb_trim_rcsum(skb, end - offset))
goto err;
/* Find out which fragments are in front and at the back of us
* in the chain of fragments so far. We must know where to put
* this fragment, right?
*/
prev = fq->q.fragments_tail;
if (!prev || FRAG6_CB(prev)->offset < offset) {
next = NULL;
goto found;
}
prev = NULL;
for (next = fq->q.fragments; next != NULL; next = next->next) {
if (FRAG6_CB(next)->offset >= offset)
break; /* bingo! */
prev = next;
}
found:
/* RFC5722, Section 4, amended by Errata ID : 3089
* When reassembling an IPv6 datagram, if
* one or more its constituent fragments is determined to be an
* overlapping fragment, the entire datagram (and any constituent
* fragments) MUST be silently discarded.
*/
/* Check for overlap with preceding fragment. */
if (prev &&
(FRAG6_CB(prev)->offset + prev->len) > offset)
goto discard_fq;
/* Look for overlap with succeeding segment. */
if (next && FRAG6_CB(next)->offset < end)
goto discard_fq;
FRAG6_CB(skb)->offset = offset;
/* Insert this fragment in the chain of fragments. */
skb->next = next;
if (!next)
fq->q.fragments_tail = skb;
if (prev)
prev->next = skb;
else
fq->q.fragments = skb;
dev = skb->dev;
if (dev) {
fq->iif = dev->ifindex;
skb->dev = NULL;
}
fq->q.stamp = skb->tstamp;
fq->q.meat += skb->len;
fq->ecn |= ecn;
add_frag_mem_limit(fq->q.net, skb->truesize);
fragsize = -skb_network_offset(skb) + skb->len;
if (fragsize > fq->q.max_size)
fq->q.max_size = fragsize;
/* The first fragment.
* nhoffset is obtained from the first fragment, of course.
*/
if (offset == 0) {
fq->nhoffset = nhoff;
fq->q.flags |= INET_FRAG_FIRST_IN;
}
if (fq->q.flags == (INET_FRAG_FIRST_IN | INET_FRAG_LAST_IN) &&
fq->q.meat == fq->q.len) {
int res;
unsigned long orefdst = skb->_skb_refdst;
skb->_skb_refdst = 0UL;
res = ip6_frag_reasm(fq, prev, dev);
skb->_skb_refdst = orefdst;
return res;
}
skb_dst_drop(skb);
return -1;
discard_fq:
inet_frag_kill(&fq->q, &ip6_frags);
err:
__IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)),
IPSTATS_MIB_REASMFAILS);
kfree_skb(skb);
return -1;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 396 | 47.31% | 5 | 12.82% |
Linus Torvalds | 80 | 9.56% | 2 | 5.13% |
Herbert Xu | 56 | 6.69% | 1 | 2.56% |
Eric Dumazet | 55 | 6.57% | 5 | 12.82% |
Changli Gao | 46 | 5.50% | 1 | 2.56% |
Pavel Emelyanov | 38 | 4.54% | 2 | 5.13% |
Willem de Bruijn | 32 | 3.82% | 1 | 2.56% |
Arnaldo Carvalho de Melo | 24 | 2.87% | 2 | 5.13% |
Hideaki Yoshifuji / 吉藤英明 | 22 | 2.63% | 5 | 12.82% |
Hannes Frederic Sowa | 19 | 2.27% | 1 | 2.56% |
Denis V. Lunev | 18 | 2.15% | 2 | 5.13% |
Nicolas Dichtel | 11 | 1.31% | 1 | 2.56% |
Shirley Ma | 9 | 1.08% | 1 | 2.56% |
Américo Wang | 7 | 0.84% | 1 | 2.56% |
Joe Perches | 7 | 0.84% | 1 | 2.56% |
Nikolay Aleksandrov | 6 | 0.72% | 1 | 2.56% |
Jesper Dangaard Brouer | 4 | 0.48% | 1 | 2.56% |
Florian Westphal | 2 | 0.24% | 1 | 2.56% |
Patrick McHardy | 2 | 0.24% | 2 | 5.13% |
Fabian Frederick | 1 | 0.12% | 1 | 2.56% |
Shan Wei | 1 | 0.12% | 1 | 2.56% |
Stephen Hemminger | 1 | 0.12% | 1 | 2.56% |
Total | 837 | 100.00% | 39 | 100.00% |
/*
* Check if this packet is complete.
* Returns NULL on failure by any reason, and pointer
* to current nexthdr field in reassembled frame.
*
* It is called with locked fq, and caller must check that
* queue is eligible for reassembly i.e. it is not COMPLETE,
* the last and the first frames arrived and all the bits are here.
*/
static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff *prev,
struct net_device *dev)
{
struct net *net = container_of(fq->q.net, struct net, ipv6.frags);
struct sk_buff *fp, *head = fq->q.fragments;
int payload_len;
unsigned int nhoff;
int sum_truesize;
u8 ecn;
inet_frag_kill(&fq->q, &ip6_frags);
ecn = ip_frag_ecn_table[fq->ecn];
if (unlikely(ecn == 0xff))
goto out_fail;
/* Make the one we just received the head. */
if (prev) {
head = prev->next;
fp = skb_clone(head, GFP_ATOMIC);
if (!fp)
goto out_oom;
fp->next = head->next;
if (!fp->next)
fq->q.fragments_tail = fp;
prev->next = fp;
skb_morph(head, fq->q.fragments);
head->next = fq->q.fragments->next;
consume_skb(fq->q.fragments);
fq->q.fragments = head;
}
WARN_ON(head == NULL);
WARN_ON(FRAG6_CB(head)->offset != 0);
/* Unfragmented part is taken from the first segment. */
payload_len = ((head->data - skb_network_header(head)) -
sizeof(struct ipv6hdr) + fq->q.len -
sizeof(struct frag_hdr));
if (payload_len > IPV6_MAXPLEN)
goto out_oversize;
/* Head of list must not be cloned. */
if (skb_unclone(head, GFP_ATOMIC))
goto out_oom;
/* If the first fragment is fragmented itself, we split
* it to two chunks: the first with data and paged part
* and the second, holding only fragments. */
if (skb_has_frag_list(head)) {
struct sk_buff *clone;
int i, plen = 0;
clone = alloc_skb(0, GFP_ATOMIC);
if (!clone)
goto out_oom;
clone->next = head->next;
head->next = clone;
skb_shinfo(clone)->frag_list = skb_shinfo(head)->frag_list;
skb_frag_list_init(head);
for (i = 0; i < skb_shinfo(head)->nr_frags; i++)
plen += skb_frag_size(&skb_shinfo(head)->frags[i]);
clone->len = clone->data_len = head->data_len - plen;
head->data_len -= clone->len;
head->len -= clone->len;
clone->csum = 0;
clone->ip_summed = head->ip_summed;
add_frag_mem_limit(fq->q.net, clone->truesize);
}
/* We have to remove fragment header from datagram and to relocate
* header in order to calculate ICV correctly. */
nhoff = fq->nhoffset;
skb_network_header(head)[nhoff] = skb_transport_header(head)[0];
memmove(head->head + sizeof(struct frag_hdr), head->head,
(head->data - head->head) - sizeof(struct frag_hdr));
if (skb_mac_header_was_set(head))
head->mac_header += sizeof(struct frag_hdr);
head->network_header += sizeof(struct frag_hdr);
skb_reset_transport_header(head);
skb_push(head, head->data - skb_network_header(head));
sum_truesize = head->truesize;
for (fp = head->next; fp;) {
bool headstolen;
int delta;
struct sk_buff *next = fp->next;
sum_truesize += fp->truesize;
if (head->ip_summed != fp->ip_summed)
head->ip_summed = CHECKSUM_NONE;
else if (head->ip_summed == CHECKSUM_COMPLETE)
head->csum = csum_add(head->csum, fp->csum);
if (skb_try_coalesce(head, fp, &headstolen, &delta)) {
kfree_skb_partial(fp, headstolen);
} else {
if (!skb_shinfo(head)->frag_list)
skb_shinfo(head)->frag_list = fp;
head->data_len += fp->len;
head->len += fp->len;
head->truesize += fp->truesize;
}
fp = next;
}
sub_frag_mem_limit(fq->q.net, sum_truesize);
head->next = NULL;
head->dev = dev;
head->tstamp = fq->q.stamp;
ipv6_hdr(head)->payload_len = htons(payload_len);
ipv6_change_dsfield(ipv6_hdr(head), 0xff, ecn);
IP6CB(head)->nhoff = nhoff;
IP6CB(head)->flags |= IP6SKB_FRAGMENTED;
IP6CB(head)->frag_max_size = fq->q.max_size;
/* Yes, and fold redundant checksum back. 8) */
skb_postpush_rcsum(head, skb_network_header(head),
skb_network_header_len(head));
rcu_read_lock();
__IP6_INC_STATS(net, __in6_dev_get(dev), IPSTATS_MIB_REASMOKS);
rcu_read_unlock();
fq->q.fragments = NULL;
fq->q.fragments_tail = NULL;
return 1;
out_oversize:
net_dbg_ratelimited("ip6_frag_reasm: payload len = %d\n", payload_len);
goto out_fail;
out_oom:
net_dbg_ratelimited("ip6_frag_reasm: no memory for reassembly\n");
out_fail:
rcu_read_lock();
__IP6_INC_STATS(net, __in6_dev_get(dev), IPSTATS_MIB_REASMFAILS);
rcu_read_unlock();
return -1;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds | 283 | 32.23% | 1 | 2.17% |
Linus Torvalds (pre-git) | 153 | 17.43% | 4 | 8.70% |
Eric Dumazet | 101 | 11.50% | 6 | 13.04% |
Herbert Xu | 76 | 8.66% | 1 | 2.17% |
Hideaki Yoshifuji / 吉藤英明 | 55 | 6.26% | 6 | 13.04% |
Hannes Frederic Sowa | 45 | 5.13% | 2 | 4.35% |
Arnaldo Carvalho de Melo | 28 | 3.19% | 5 | 10.87% |
Changli Gao | 23 | 2.62% | 1 | 2.17% |
Jorge Boncompte | 23 | 2.62% | 1 | 2.17% |
Pavel Emelyanov | 23 | 2.62% | 2 | 4.35% |
Willem de Bruijn | 13 | 1.48% | 1 | 2.17% |
Patrick McHardy | 10 | 1.14% | 2 | 4.35% |
Jason A. Donenfeld | 7 | 0.80% | 1 | 2.17% |
Jesper Dangaard Brouer | 7 | 0.80% | 1 | 2.17% |
Américo Wang | 7 | 0.80% | 1 | 2.17% |
Ian Morris | 5 | 0.57% | 2 | 4.35% |
Florian Westphal | 4 | 0.46% | 1 | 2.17% |
Ilpo Järvinen | 4 | 0.46% | 1 | 2.17% |
Daniel Borkmann | 3 | 0.34% | 1 | 2.17% |
David S. Miller | 2 | 0.23% | 2 | 4.35% |
Denis V. Lunev | 2 | 0.23% | 1 | 2.17% |
Joe Perches | 2 | 0.23% | 1 | 2.17% |
Yasuyuki Kozakai | 1 | 0.11% | 1 | 2.17% |
Pravin B Shelar | 1 | 0.11% | 1 | 2.17% |
Total | 878 | 100.00% | 46 | 100.00% |
static int ipv6_frag_rcv(struct sk_buff *skb)
{
struct frag_hdr *fhdr;
struct frag_queue *fq;
const struct ipv6hdr *hdr = ipv6_hdr(skb);
struct net *net = dev_net(skb_dst(skb)->dev);
if (IP6CB(skb)->flags & IP6SKB_FRAGMENTED)
goto fail_hdr;
__IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)), IPSTATS_MIB_REASMREQDS);
/* Jumbo payload inhibits frag. header */
if (hdr->payload_len == 0)
goto fail_hdr;
if (!pskb_may_pull(skb, (skb_transport_offset(skb) +
sizeof(struct frag_hdr))))
goto fail_hdr;
hdr = ipv6_hdr(skb);
fhdr = (struct frag_hdr *)skb_transport_header(skb);
if (!(fhdr->frag_off & htons(0xFFF9))) {
/* It is not a fragmented frame */
skb->transport_header += sizeof(struct frag_hdr);
__IP6_INC_STATS(net,
ip6_dst_idev(skb_dst(skb)), IPSTATS_MIB_REASMOKS);
IP6CB(skb)->nhoff = (u8 *)fhdr - skb_network_header(skb);
IP6CB(skb)->flags |= IP6SKB_FRAGMENTED;
return 1;
}
fq = fq_find(net, fhdr->identification, &hdr->saddr, &hdr->daddr,
skb->dev ? skb->dev->ifindex : 0, ip6_frag_ecn(hdr));
if (fq) {
int ret;
spin_lock(&fq->q.lock);
ret = ip6_frag_queue(fq, skb, fhdr, IP6CB(skb)->nhoff);
spin_unlock(&fq->q.lock);
inet_frag_put(&fq->q, &ip6_frags);
return ret;
}
__IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)), IPSTATS_MIB_REASMFAILS);
kfree_skb(skb);
return -1;
fail_hdr:
__IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)),
IPSTATS_MIB_INHDRERRORS);
icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, skb_network_header_len(skb));
return -1;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 129 | 35.93% | 4 | 12.90% |
Denis V. Lunev | 48 | 13.37% | 3 | 9.68% |
Linus Torvalds | 38 | 10.58% | 1 | 3.23% |
Hannes Frederic Sowa | 28 | 7.80% | 2 | 6.45% |
Hideaki Yoshifuji / 吉藤英明 | 26 | 7.24% | 4 | 12.90% |
Eric Dumazet | 20 | 5.57% | 3 | 9.68% |
Arnaldo Carvalho de Melo | 19 | 5.29% | 5 | 16.13% |
Patrick McHardy | 12 | 3.34% | 1 | 3.23% |
Michal Kubeček | 12 | 3.34% | 1 | 3.23% |
Pavel Emelyanov | 11 | 3.06% | 2 | 6.45% |
Américo Wang | 7 | 1.95% | 1 | 3.23% |
Shan Wei | 4 | 1.11% | 1 | 3.23% |
Herbert Xu | 3 | 0.84% | 2 | 6.45% |
Mitsuru Kanda | 2 | 0.56% | 1 | 3.23% |
Total | 359 | 100.00% | 31 | 100.00% |
static const struct inet6_protocol frag_protocol = {
.handler = ipv6_frag_rcv,
.flags = INET6_PROTO_NOPOLICY,
};
#ifdef CONFIG_SYSCTL
static int zero;
static struct ctl_table ip6_frags_ns_ctl_table[] = {
{
.procname = "ip6frag_high_thresh",
.data = &init_net.ipv6.frags.high_thresh,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec_minmax,
.extra1 = &init_net.ipv6.frags.low_thresh
},
{
.procname = "ip6frag_low_thresh",
.data = &init_net.ipv6.frags.low_thresh,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec_minmax,
.extra1 = &zero,
.extra2 = &init_net.ipv6.frags.high_thresh
},
{
.procname = "ip6frag_time",
.data = &init_net.ipv6.frags.timeout,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec_jiffies,
},
{ }
};
/* secret interval has been deprecated */
static int ip6_frags_secret_interval_unused;
static struct ctl_table ip6_frags_ctl_table[] = {
{
.procname = "ip6frag_secret_interval",
.data = &ip6_frags_secret_interval_unused,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec_jiffies,
},
{ }
};
static int __net_init ip6_frags_ns_sysctl_register(struct net *net)
{
struct ctl_table *table;
struct ctl_table_header *hdr;
table = ip6_frags_ns_ctl_table;
if (!net_eq(net, &init_net)) {
table = kmemdup(table, sizeof(ip6_frags_ns_ctl_table), GFP_KERNEL);
if (!table)
goto err_alloc;
table[0].data = &net->ipv6.frags.high_thresh;
table[0].extra1 = &net->ipv6.frags.low_thresh;
table[0].extra2 = &init_net.ipv6.frags.high_thresh;
table[1].data = &net->ipv6.frags.low_thresh;
table[1].extra2 = &net->ipv6.frags.high_thresh;
table[2].data = &net->ipv6.frags.timeout;
/* Don't export sysctls to unprivileged users */
if (net->user_ns != &init_user_ns)
table[0].procname = NULL;
}
hdr = register_net_sysctl(net, "net/ipv6", table);
if (!hdr)
goto err_reg;
net->ipv6.sysctl.frags_hdr = hdr;
return 0;
err_reg:
if (!net_eq(net, &init_net))
kfree(table);
err_alloc:
return -ENOMEM;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Pavel Emelyanov | 142 | 61.21% | 5 | 38.46% |
Nikolay Aleksandrov | 48 | 20.69% | 1 | 7.69% |
Eric W. Biedermann | 21 | 9.05% | 2 | 15.38% |
Octavian Purdila | 10 | 4.31% | 1 | 7.69% |
Daniel Lezcano | 8 | 3.45% | 2 | 15.38% |
Ian Morris | 2 | 0.86% | 1 | 7.69% |
Alexey Dobriyan | 1 | 0.43% | 1 | 7.69% |
Total | 232 | 100.00% | 13 | 100.00% |
static void __net_exit ip6_frags_ns_sysctl_unregister(struct net *net)
{
struct ctl_table *table;
table = net->ipv6.sysctl.frags_hdr->ctl_table_arg;
unregister_net_sysctl_table(net->ipv6.sysctl.frags_hdr);
if (!net_eq(net, &init_net))
kfree(table);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Pavel Emelyanov | 44 | 78.57% | 2 | 50.00% |
Yang Hongyang | 11 | 19.64% | 1 | 25.00% |
Alexey Dobriyan | 1 | 1.79% | 1 | 25.00% |
Total | 56 | 100.00% | 4 | 100.00% |
static struct ctl_table_header *ip6_ctl_header;
static int ip6_frags_sysctl_register(void)
{
ip6_ctl_header = register_net_sysctl(&init_net, "net/ipv6",
ip6_frags_ctl_table);
return ip6_ctl_header == NULL ? -ENOMEM : 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Pavel Emelyanov | 25 | 83.33% | 1 | 50.00% |
Eric W. Biedermann | 5 | 16.67% | 1 | 50.00% |
Total | 30 | 100.00% | 2 | 100.00% |
static void ip6_frags_sysctl_unregister(void)
{
unregister_net_sysctl_table(ip6_ctl_header);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Pavel Emelyanov | 13 | 100.00% | 1 | 100.00% |
Total | 13 | 100.00% | 1 | 100.00% |
#else
static int ip6_frags_ns_sysctl_register(struct net *net)
{
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Pavel Emelyanov | 14 | 100.00% | 2 | 100.00% |
Total | 14 | 100.00% | 2 | 100.00% |
static void ip6_frags_ns_sysctl_unregister(struct net *net)
{
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Pavel Emelyanov | 10 | 100.00% | 2 | 100.00% |
Total | 10 | 100.00% | 2 | 100.00% |
static int ip6_frags_sysctl_register(void)
{
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Pavel Emelyanov | 11 | 100.00% | 1 | 100.00% |
Total | 11 | 100.00% | 1 | 100.00% |
static void ip6_frags_sysctl_unregister(void)
{
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Pavel Emelyanov | 7 | 100.00% | 1 | 100.00% |
Total | 7 | 100.00% | 1 | 100.00% |
#endif
static int __net_init ipv6_frags_init_net(struct net *net)
{
int res;
net->ipv6.frags.high_thresh = IPV6_FRAG_HIGH_THRESH;
net->ipv6.frags.low_thresh = IPV6_FRAG_LOW_THRESH;
net->ipv6.frags.timeout = IPV6_FRAG_TIMEOUT;
res = inet_frags_init_net(&net->ipv6.frags);
if (res)
return res;
res = ip6_frags_ns_sysctl_register(net);
if (res)
inet_frags_uninit_net(&net->ipv6.frags);
return res;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Pavel Emelyanov | 54 | 61.36% | 3 | 42.86% |
Eric Dumazet | 30 | 34.09% | 1 | 14.29% |
Shan Wei | 2 | 2.27% | 1 | 14.29% |
Daniel Lezcano | 1 | 1.14% | 1 | 14.29% |
Alexey Dobriyan | 1 | 1.14% | 1 | 14.29% |
Total | 88 | 100.00% | 7 | 100.00% |
static void __net_exit ipv6_frags_exit_net(struct net *net)
{
ip6_frags_ns_sysctl_unregister(net);
inet_frags_exit_net(&net->ipv6.frags, &ip6_frags);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Pavel Emelyanov | 29 | 96.67% | 2 | 66.67% |
Alexey Dobriyan | 1 | 3.33% | 1 | 33.33% |
Total | 30 | 100.00% | 3 | 100.00% |
static struct pernet_operations ip6_frags_ops = {
.init = ipv6_frags_init_net,
.exit = ipv6_frags_exit_net,
};
int __init ipv6_frag_init(void)
{
int ret;
ret = inet6_add_protocol(&frag_protocol, IPPROTO_FRAGMENT);
if (ret)
goto out;
ret = ip6_frags_sysctl_register();
if (ret)
goto err_sysctl;
ret = register_pernet_subsys(&ip6_frags_ops);
if (ret)
goto err_pernet;
ip6_frags.hashfn = ip6_hashfn;
ip6_frags.constructor = ip6_frag_init;
ip6_frags.destructor = NULL;
ip6_frags.qsize = sizeof(struct frag_queue);
ip6_frags.match = ip6_frag_match;
ip6_frags.frag_expire = ip6_frag_expire;
ip6_frags.frags_cache_name = ip6_frag_cache_name;
ret = inet_frags_init(&ip6_frags);
if (ret)
goto err_pernet;
out:
return ret;
err_pernet:
ip6_frags_sysctl_unregister();
err_sysctl:
inet6_del_protocol(&frag_protocol, IPPROTO_FRAGMENT);
goto out;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Pavel Emelyanov | 89 | 64.03% | 13 | 76.47% |
Daniel Lezcano | 19 | 13.67% | 1 | 5.88% |
Nikolay Aleksandrov | 15 | 10.79% | 1 | 5.88% |
Mitsuru Kanda | 14 | 10.07% | 1 | 5.88% |
David S. Miller | 2 | 1.44% | 1 | 5.88% |
Total | 139 | 100.00% | 17 | 100.00% |
void ipv6_frag_exit(void)
{
inet_frags_fini(&ip6_frags);
ip6_frags_sysctl_unregister();
unregister_pernet_subsys(&ip6_frags_ops);
inet6_del_protocol(&frag_protocol, IPPROTO_FRAGMENT);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Daniel Lezcano | 20 | 66.67% | 1 | 25.00% |
Pavel Emelyanov | 9 | 30.00% | 2 | 50.00% |
Mitsuru Kanda | 1 | 3.33% | 1 | 25.00% |
Total | 30 | 100.00% | 4 | 100.00% |
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Pavel Emelyanov | 925 | 23.88% | 22 | 16.18% |
Linus Torvalds (pre-git) | 876 | 22.61% | 7 | 5.15% |
Linus Torvalds | 401 | 10.35% | 2 | 1.47% |
Eric Dumazet | 229 | 5.91% | 15 | 11.03% |
Hannes Frederic Sowa | 170 | 4.39% | 4 | 2.94% |
Herbert Xu | 158 | 4.08% | 2 | 1.47% |
Hideaki Yoshifuji / 吉藤英明 | 140 | 3.61% | 9 | 6.62% |
Nikolay Aleksandrov | 131 | 3.38% | 5 | 3.68% |
Américo Wang | 112 | 2.89% | 1 | 0.74% |
Denis V. Lunev | 72 | 1.86% | 3 | 2.21% |
Arnaldo Carvalho de Melo | 71 | 1.83% | 7 | 5.15% |
Changli Gao | 69 | 1.78% | 1 | 0.74% |
Daniel Lezcano | 57 | 1.47% | 4 | 2.94% |
Patrick McHardy | 48 | 1.24% | 5 | 3.68% |
Michal Kubeček | 47 | 1.21% | 1 | 0.74% |
Willem de Bruijn | 45 | 1.16% | 1 | 0.74% |
Fabian Frederick | 42 | 1.08% | 1 | 0.74% |
David S. Miller | 35 | 0.90% | 3 | 2.21% |
Mitsuru Kanda | 29 | 0.75% | 1 | 0.74% |
Eric W. Biedermann | 28 | 0.72% | 5 | 3.68% |
Jorge Boncompte | 23 | 0.59% | 1 | 0.74% |
Florian Westphal | 21 | 0.54% | 4 | 2.94% |
Ingo Oeser | 13 | 0.34% | 1 | 0.74% |
Jesper Dangaard Brouer | 11 | 0.28% | 1 | 0.74% |
Yang Hongyang | 11 | 0.28% | 1 | 0.74% |
Nicolas Dichtel | 11 | 0.28% | 1 | 0.74% |
Joe Perches | 11 | 0.28% | 2 | 1.47% |
Shan Wei | 10 | 0.26% | 3 | 2.21% |
Octavian Purdila | 10 | 0.26% | 1 | 0.74% |
Shirley Ma | 9 | 0.23% | 1 | 0.74% |
Ilpo Järvinen | 9 | 0.23% | 2 | 1.47% |
Alexey Dobriyan | 9 | 0.23% | 3 | 2.21% |
Ian Morris | 8 | 0.21% | 3 | 2.21% |
Jason A. Donenfeld | 7 | 0.18% | 1 | 0.74% |
Yasuyuki Kozakai | 6 | 0.15% | 2 | 1.47% |
Jozsef Kadlecsik | 5 | 0.13% | 1 | 0.74% |
Tejun Heo | 3 | 0.08% | 1 | 0.74% |
Paul Gortmaker | 3 | 0.08% | 1 | 0.74% |
Daniel Borkmann | 3 | 0.08% | 1 | 0.74% |
Stephen Hemminger | 1 | 0.03% | 1 | 0.74% |
Pravin B Shelar | 1 | 0.03% | 1 | 0.74% |
Adrian Bunk | 1 | 0.03% | 1 | 0.74% |
Rusty Russell | 1 | 0.03% | 1 | 0.74% |
Zach Brown | 1 | 0.03% | 1 | 0.74% |
Al Viro | 1 | 0.03% | 1 | 0.74% |
Total | 3874 | 100.00% | 136 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.