cregit-Linux how code gets into the kernel

Release 4.8 net/decnet/dn_route.c

Directory: net/decnet
/*
 * DECnet       An implementation of the DECnet protocol suite for the LINUX
 *              operating system.  DECnet is implemented using the  BSD Socket
 *              interface as the means of communication with the user level.
 *
 *              DECnet Routing Functions (Endnode and Router)
 *
 * Authors:     Steve Whitehouse <SteveW@ACM.org>
 *              Eduardo Marcelo Serrat <emserrat@geocities.com>
 *
 * Changes:
 *              Steve Whitehouse : Fixes to allow "intra-ethernet" and
 *                                 "return-to-sender" bits on outgoing
 *                                 packets.
 *              Steve Whitehouse : Timeouts for cached routes.
 *              Steve Whitehouse : Use dst cache for input routes too.
 *              Steve Whitehouse : Fixed error values in dn_send_skb.
 *              Steve Whitehouse : Rework routing functions to better fit
 *                                 DECnet routing design
 *              Alexey Kuznetsov : New SMP locking
 *              Steve Whitehouse : More SMP locking changes & dn_cache_dump()
 *              Steve Whitehouse : Prerouting NF hook, now really is prerouting.
 *                                 Fixed possible skb leak in rtnetlink funcs.
 *              Steve Whitehouse : Dave Miller's dynamic hash table sizing and
 *                                 Alexey Kuznetsov's finer grained locking
 *                                 from ipv4/route.c.
 *              Steve Whitehouse : Routing is now starting to look like a
 *                                 sensible set of code now, mainly due to
 *                                 my copying the IPv4 routing code. The
 *                                 hooks here are modified and will continue
 *                                 to evolve for a while.
 *              Steve Whitehouse : Real SMP at last :-) Also new netfilter
 *                                 stuff. Look out raw sockets your days
 *                                 are numbered!
 *              Steve Whitehouse : Added return-to-sender functions. Added
 *                                 backlog congestion level return codes.
 *              Steve Whitehouse : Fixed bug where routes were set up with
 *                                 no ref count on net devices.
 *              Steve Whitehouse : RCU for the route cache
 *              Steve Whitehouse : Preparations for the flow cache
 *              Steve Whitehouse : Prepare for nonlinear skbs
 */

/******************************************************************************
    (c) 1995-1998 E.M. Serrat           emserrat@geocities.com

    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
    any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
*******************************************************************************/

#include <linux/errno.h>
#include <linux/types.h>
#include <linux/socket.h>
#include <linux/in.h>
#include <linux/kernel.h>
#include <linux/sockios.h>
#include <linux/net.h>
#include <linux/netdevice.h>
#include <linux/inet.h>
#include <linux/route.h>
#include <linux/in_route.h>
#include <linux/slab.h>
#include <net/sock.h>
#include <linux/mm.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/init.h>
#include <linux/rtnetlink.h>
#include <linux/string.h>
#include <linux/netfilter_decnet.h>
#include <linux/rcupdate.h>
#include <linux/times.h>
#include <linux/export.h>
#include <asm/errno.h>
#include <net/net_namespace.h>
#include <net/netlink.h>
#include <net/neighbour.h>
#include <net/dst.h>
#include <net/flow.h>
#include <net/fib_rules.h>
#include <net/dn.h>
#include <net/dn_dev.h>
#include <net/dn_nsp.h>
#include <net/dn_route.h>
#include <net/dn_neigh.h>
#include <net/dn_fib.h>


struct dn_rt_hash_bucket
{
	
struct dn_route __rcu *chain;
	
spinlock_t lock;
};

extern struct neigh_table dn_neigh_table;



static unsigned char dn_hiord_addr[6] = {0xAA,0x00,0x04,0x00,0x00,0x00};


static const int dn_rt_min_delay = 2 * HZ;

static const int dn_rt_max_delay = 10 * HZ;

static const int dn_rt_mtu_expires = 10 * 60 * HZ;


static unsigned long dn_rt_deadline;

static int dn_dst_gc(struct dst_ops *ops);
static struct dst_entry *dn_dst_check(struct dst_entry *, __u32);
static unsigned int dn_dst_default_advmss(const struct dst_entry *dst);
static unsigned int dn_dst_mtu(const struct dst_entry *dst);
static void dn_dst_destroy(struct dst_entry *);
static void dn_dst_ifdown(struct dst_entry *, struct net_device *dev, int how);
static struct dst_entry *dn_dst_negative_advice(struct dst_entry *);
static void dn_dst_link_failure(struct sk_buff *);
static void dn_dst_update_pmtu(struct dst_entry *dst, struct sock *sk,
			       struct sk_buff *skb , u32 mtu);
static void dn_dst_redirect(struct dst_entry *dst, struct sock *sk,
			    struct sk_buff *skb);
static struct neighbour *dn_dst_neigh_lookup(const struct dst_entry *dst,
					     struct sk_buff *skb,
					     const void *daddr);
static int dn_route_input(struct sk_buff *);
static void dn_run_flush(unsigned long dummy);


static struct dn_rt_hash_bucket *dn_rt_hash_table;

static unsigned int dn_rt_hash_mask;


static struct timer_list dn_route_timer;
static DEFINE_TIMER(dn_rt_flush_timer, dn_run_flush, 0, 0);

int decnet_dst_gc_interval = 2;


static struct dst_ops dn_dst_ops = {
	.family =		PF_DECnet,
	.gc_thresh =		128,
	.gc =			dn_dst_gc,
	.check =		dn_dst_check,
	.default_advmss =	dn_dst_default_advmss,
	.mtu =			dn_dst_mtu,
	.cow_metrics =		dst_cow_metrics_generic,
	.destroy =		dn_dst_destroy,
	.ifdown =		dn_dst_ifdown,
	.negative_advice =	dn_dst_negative_advice,
	.link_failure =		dn_dst_link_failure,
	.update_pmtu =		dn_dst_update_pmtu,
	.redirect =		dn_dst_redirect,
	.neigh_lookup =		dn_dst_neigh_lookup,
};


static void dn_dst_destroy(struct dst_entry *dst) { struct dn_route *rt = (struct dn_route *) dst; if (rt->n) neigh_release(rt->n); dst_destroy_metrics_generic(dst); }

Contributors

PersonTokensPropCommitsCommitProp
david s. millerdavid s. miller41100.00%2100.00%
Total41100.00%2100.00%


static void dn_dst_ifdown(struct dst_entry *dst, struct net_device *dev, int how) { if (how) { struct dn_route *rt = (struct dn_route *) dst; struct neighbour *n = rt->n; if (n && n->dev == dev) { n->dev = dev_net(dev)->loopback_dev; dev_hold(n->dev); dev_put(dev); } } }

Contributors

PersonTokensPropCommitsCommitProp
david s. millerdavid s. miller81100.00%1100.00%
Total81100.00%1100.00%


static __inline__ unsigned int dn_hash(__le16 src, __le16 dst) { __u16 tmp = (__u16 __force)(src ^ dst); tmp ^= (tmp >> 3); tmp ^= (tmp >> 5); tmp ^= (tmp >> 10); return dn_rt_hash_mask & (unsigned int)tmp; }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git4981.67%360.00%
steven whitehousesteven whitehouse915.00%120.00%
eric dumazeteric dumazet23.33%120.00%
Total60100.00%5100.00%


static inline void dnrt_free(struct dn_route *rt) { call_rcu_bh(&rt->dst.rcu_head, dst_rcu_free); }

Contributors

PersonTokensPropCommitsCommitProp
steven whitehousesteven whitehouse2291.67%133.33%
andrew mortonandrew morton14.17%133.33%
dipankar sarmadipankar sarma14.17%133.33%
Total24100.00%3100.00%


static inline void dnrt_drop(struct dn_route *rt) { dst_release(&rt->dst); call_rcu_bh(&rt->dst.rcu_head, dst_rcu_free); }

Contributors

PersonTokensPropCommitsCommitProp
steven whitehousesteven whitehouse3093.75%133.33%
andrew mortonandrew morton13.12%133.33%
dipankar sarmadipankar sarma13.12%133.33%
Total32100.00%3100.00%


static void dn_dst_check_expire(unsigned long dummy) { int i; struct dn_route *rt; struct dn_route __rcu **rtp; unsigned long now = jiffies; unsigned long expire = 120 * HZ; for (i = 0; i <= dn_rt_hash_mask; i++) { rtp = &dn_rt_hash_table[i].chain; spin_lock(&dn_rt_hash_table[i].lock); while ((rt = rcu_dereference_protected(*rtp, lockdep_is_held(&dn_rt_hash_table[i].lock))) != NULL) { if (atomic_read(&rt->dst.__refcnt) || (now - rt->dst.lastuse) < expire) { rtp = &rt->dst.dn_next; continue; } *rtp = rt->dst.dn_next; rt->dst.dn_next = NULL; dnrt_free(rt); } spin_unlock(&dn_rt_hash_table[i].lock); if ((jiffies - now) > 0) break; } mod_timer(&dn_route_timer, now + decnet_dst_gc_interval * HZ); }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git16484.54%457.14%
eric dumazeteric dumazet2713.92%228.57%
steven whitehousesteven whitehouse31.55%114.29%
Total194100.00%7100.00%


static int dn_dst_gc(struct dst_ops *ops) { struct dn_route *rt; struct dn_route __rcu **rtp; int i; unsigned long now = jiffies; unsigned long expire = 10 * HZ; for (i = 0; i <= dn_rt_hash_mask; i++) { spin_lock_bh(&dn_rt_hash_table[i].lock); rtp = &dn_rt_hash_table[i].chain; while ((rt = rcu_dereference_protected(*rtp, lockdep_is_held(&dn_rt_hash_table[i].lock))) != NULL) { if (atomic_read(&rt->dst.__refcnt) || (now - rt->dst.lastuse) < expire) { rtp = &rt->dst.dn_next; continue; } *rtp = rt->dst.dn_next; rt->dst.dn_next = NULL; dnrt_drop(rt); break; } spin_unlock_bh(&dn_rt_hash_table[i].lock); } return 0; }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git14280.68%450.00%
eric dumazeteric dumazet2715.34%225.00%
daniel lezcanodaniel lezcano42.27%112.50%
steven whitehousesteven whitehouse31.70%112.50%
Total176100.00%8100.00%

/* * The decnet standards don't impose a particular minimum mtu, what they * do insist on is that the routing layer accepts a datagram of at least * 230 bytes long. Here we have to subtract the routing header length from * 230 to get the minimum acceptable mtu. If there is no neighbour, then we * assume the worst and use a long header size. * * We update both the mtu and the advertised mss (i.e. the segment size we * advertise to the other end). */
static void dn_dst_update_pmtu(struct dst_entry *dst, struct sock *sk, struct sk_buff *skb, u32 mtu) { struct dn_route *rt = (struct dn_route *) dst; struct neighbour *n = rt->n; u32 min_mtu = 230; struct dn_dev *dn; dn = n ? rcu_dereference_raw(n->dev->dn_ptr) : NULL; if (dn && dn->use_long == 0) min_mtu -= 6; else min_mtu -= 21; if (dst_metric(dst, RTAX_MTU) > mtu && mtu >= min_mtu) { if (!(dst_metric_locked(dst, RTAX_MTU))) { dst_metric_set(dst, RTAX_MTU, mtu); dst_set_expires(dst, dn_rt_mtu_expires); } if (!(dst_metric_locked(dst, RTAX_ADVMSS))) { u32 mss = mtu - DN_MAX_NSP_DATA_HEADER; u32 existing_mss = dst_metric_raw(dst, RTAX_ADVMSS); if (!existing_mss || existing_mss > mss) dst_metric_set(dst, RTAX_ADVMSS, mss); } } }

Contributors

PersonTokensPropCommitsCommitProp
steven whitehousesteven whitehouse11763.24%112.50%
david s. millerdavid s. miller5831.35%562.50%
satoru satohsatoru satoh73.78%112.50%
eric dumazeteric dumazet31.62%112.50%
Total185100.00%8100.00%


static void dn_dst_redirect(struct dst_entry *dst, struct sock *sk, struct sk_buff *skb) { }

Contributors

PersonTokensPropCommitsCommitProp
david s. millerdavid s. miller20100.00%2100.00%
Total20100.00%2100.00%

/* * When a route has been marked obsolete. (e.g. routing cache flush) */
static struct dst_entry *dn_dst_check(struct dst_entry *dst, __u32 cookie) { return NULL; }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git19100.00%1100.00%
Total19100.00%1100.00%


static struct dst_entry *dn_dst_negative_advice(struct dst_entry *dst) { dst_release(dst); return NULL; }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git21100.00%1100.00%
Total21100.00%1100.00%


static void dn_dst_link_failure(struct sk_buff *skb) { }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git990.00%150.00%
joe perchesjoe perches110.00%150.00%
Total10100.00%2100.00%


static inline int compare_keys(struct flowidn *fl1, struct flowidn *fl2) { return ((fl1->daddr ^ fl2->daddr) | (fl1->saddr ^ fl2->saddr) | (fl1->flowidn_mark ^ fl2->flowidn_mark) | (fl1->flowidn_scope ^ fl2->flowidn_scope) | (fl1->flowidn_oif ^ fl2->flowidn_oif) | (fl1->flowidn_iif ^ fl2->flowidn_iif)) == 0; }

Contributors

PersonTokensPropCommitsCommitProp
david s. millerdavid s. miller5162.20%266.67%
steven whitehousesteven whitehouse3137.80%133.33%
Total82100.00%3100.00%


static int dn_insert_route(struct dn_route *rt, unsigned int hash, struct dn_route **rp) { struct dn_route *rth; struct dn_route __rcu **rthp; unsigned long now = jiffies; rthp = &dn_rt_hash_table[hash].chain; spin_lock_bh(&dn_rt_hash_table[hash].lock); while ((rth = rcu_dereference_protected(*rthp, lockdep_is_held(&dn_rt_hash_table[hash].lock))) != NULL) { if (compare_keys(&rth->fld, &rt->fld)) { /* Put it first */ *rthp = rth->dst.dn_next; rcu_assign_pointer(rth->dst.dn_next, dn_rt_hash_table[hash].chain); rcu_assign_pointer(dn_rt_hash_table[hash].chain, rth); dst_use(&rth->dst, now); spin_unlock_bh(&dn_rt_hash_table[hash].lock); dnrt_drop(rt); *rp = rth; return 0; } rthp = &rth->dst.dn_next; } rcu_assign_pointer(rt->dst.dn_next, dn_rt_hash_table[hash].chain); rcu_assign_pointer(dn_rt_hash_table[hash].chain, rt); dst_use(&rt->dst, now); spin_unlock_bh(&dn_rt_hash_table[hash].lock); *rp = rt; return 0; }

Contributors

PersonTokensPropCommitsCommitProp
steven whitehousesteven whitehouse12852.89%19.09%
pre-gitpre-git5924.38%436.36%
eric dumazeteric dumazet3112.81%327.27%
paul e. mckenneypaul e. mckenney166.61%19.09%
pavel emelianovpavel emelianov62.48%19.09%
david s. millerdavid s. miller20.83%19.09%
Total242100.00%11100.00%


static void dn_run_flush(unsigned long dummy) { int i; struct dn_route *rt, *next; for (i = 0; i < dn_rt_hash_mask; i++) { spin_lock_bh(&dn_rt_hash_table[i].lock); if ((rt = xchg((struct dn_route **)&dn_rt_hash_table[i].chain, NULL)) == NULL) goto nothing_to_declare; for(; rt; rt = next) { next = rcu_dereference_raw(rt->dst.dn_next); RCU_INIT_POINTER(rt->dst.dn_next, NULL); dst_free((struct dst_entry *)rt); } nothing_to_declare: spin_unlock_bh(&dn_rt_hash_table[i].lock); } }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git11082.71%342.86%
eric dumazeteric dumazet1914.29%228.57%
steven whitehousesteven whitehouse32.26%114.29%
roel kluinroel kluin10.75%114.29%
Total133100.00%7100.00%

static DEFINE_SPINLOCK(dn_rt_flush_lock);
void dn_rt_cache_flush(int delay) { unsigned long now = jiffies; int user_mode = !in_interrupt(); if (delay < 0) delay = dn_rt_min_delay; spin_lock_bh(&dn_rt_flush_lock); if (del_timer(&dn_rt_flush_timer) && delay > 0 && dn_rt_deadline) { long tmo = (long)(dn_rt_deadline - now); if (user_mode && tmo < dn_rt_max_delay - dn_rt_min_delay) tmo = 0; if (delay > tmo) delay = tmo; } if (delay <= 0) { spin_unlock_bh(&dn_rt_flush_lock); dn_run_flush(0); return; } if (dn_rt_deadline == 0) dn_rt_deadline = now + dn_rt_max_delay; dn_rt_flush_timer.expires = now + delay; add_timer(&dn_rt_flush_timer); spin_unlock_bh(&dn_rt_flush_lock); }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git13696.45%150.00%
linus torvaldslinus torvalds53.55%150.00%
Total141100.00%2100.00%

/** * dn_return_short - Return a short packet to its sender * @skb: The packet to return * */
static int dn_return_short(struct sk_buff *skb) { struct dn_skb_cb *cb; unsigned char *ptr; __le16 *src; __le16 *dst; /* Add back headers */ skb_push(skb, skb->data - skb_network_header(skb)); if ((skb = skb_unshare(skb, GFP_ATOMIC)) == NULL) return NET_RX_DROP; cb = DN_SKB_CB(skb); /* Skip packet length and point to flags */ ptr = skb->data + 2; *ptr++ = (cb->rt_flags & ~DN_RT_F_RQR) | DN_RT_F_RTS; dst = (__le16 *)ptr; ptr += 2; src = (__le16 *)ptr; ptr += 2; *ptr = 0; /* Zero hop count */ swap(*src, *dst); skb->pkt_type = PACKET_OUTGOING; dn_rt_finish_output(skb, NULL, NULL); return NET_RX_SUCCESS; }

Contributors

PersonTokensPropCommitsCommitProp
linus torvaldslinus torvalds13791.33%120.00%
steven whitehousesteven whitehouse64.00%240.00%
ilpo jarvinenilpo jarvinen42.67%120.00%
arnaldo carvalho de meloarnaldo carvalho de melo32.00%120.00%
Total150100.00%5100.00%

/** * dn_return_long - Return a long packet to its sender * @skb: The long format packet to return * */
static int dn_return_long(struct sk_buff *skb) { struct dn_skb_cb *cb; unsigned char *ptr; unsigned char *src_addr, *dst_addr; unsigned char tmp[ETH_ALEN]; /* Add back all headers */ skb_push(skb, skb->data - skb_network_header(skb)); if ((skb = skb_unshare(skb, GFP_ATOMIC)) == NULL) return NET_RX_DROP; cb = DN_SKB_CB(skb); /* Ignore packet length and point to flags */ ptr = skb->data + 2; /* Skip padding */ if (*ptr & DN_RT_F_PF) { char padlen = (*ptr & ~DN_RT_F_PF); ptr += padlen; } *ptr++ = (cb->rt_flags & ~DN_RT_F_RQR) | DN_RT_F_RTS; ptr += 2; dst_addr = ptr; ptr += 8; src_addr = ptr; ptr += 6; *ptr = 0; /* Zero hop count */ /* Swap source and destination */ memcpy(tmp, src_addr, ETH_ALEN); memcpy(src_addr, dst_addr, ETH_ALEN); memcpy(dst_addr, tmp, ETH_ALEN); skb->pkt_type = PACKET_OUTGOING; dn_rt_finish_output(skb, dst_addr, src_addr); return NET_RX_SUCCESS; }

Contributors

PersonTokensPropCommitsCommitProp
linus torvaldslinus torvalds18895.43%125.00%
steven whitehousesteven whitehouse31.52%125.00%
arnaldo carvalho de meloarnaldo carvalho de melo31.52%125.00%
pre-gitpre-git31.52%125.00%
Total197100.00%4100.00%

/** * dn_route_rx_packet - Try and find a route for an incoming packet * @skb: The packet to find a route for * * Returns: result of input function if route is found, error code otherwise */
static int dn_route_rx_packet(struct net *net, struct sock *sk, struct sk_buff *skb) { struct dn_skb_cb *cb; int err; if ((err = dn_route_input(skb)) == 0) return dst_input(skb); cb = DN_SKB_CB(skb); if (decnet_debug_level & 4) { char *devname = skb->dev ? skb->dev->name : "???"; printk(KERN_DEBUG "DECnet: dn_route_rx_packet: rt_flags=0x%02x dev=%s len=%d src=0x%04hx dst=0x%04hx err=%d type=%d\n", (int)cb->rt_flags, devname, skb->len, le16_to_cpu(cb->src), le16_to_cpu(cb->dst), err, skb->pkt_type); } if ((skb->pkt_type == PACKET_HOST) && (cb->rt_flags & DN_RT_F_RQR)) { switch (cb->rt_flags & DN_RT_PKT_MSK) { case DN_RT_PKT_SHORT: return dn_return_short(skb); case DN_RT_PKT_LONG: return dn_return_long(skb); } } kfree_skb(skb); return NET_RX_DROP; }

Contributors

PersonTokensPropCommitsCommitProp
linus torvaldslinus torvalds11163.79%111.11%
pre-gitpre-git3922.41%222.22%
eric dumazeteric dumazet74.02%111.11%
eric w. biedermaneric w. biederman52.87%111.11%
david s. millerdavid s. miller52.87%111.11%
steven whitehousesteven whitehouse42.30%111.11%
harvey harrisonharvey harrison21.15%111.11%
hideaki yoshifujihideaki yoshifuji10.57%111.11%
Total174100.00%9100.00%


static int dn_route_rx_long(struct sk_buff *skb) { struct dn_skb_cb *cb = DN_SKB_CB(skb); unsigned char *ptr = skb->data; if (!pskb_may_pull(skb, 21)) /* 20 for long header, 1 for shortest nsp */ goto drop_it; skb_pull(skb, 20); skb_reset_transport_header(skb); /* Destination info */ ptr += 2; cb->dst = dn_eth2dn(ptr); if (memcmp(ptr, dn_hiord_addr, 4) != 0) goto drop_it; ptr += 6; /* Source info */ ptr += 2; cb->src = dn_eth2dn(ptr); if (memcmp(ptr, dn_hiord_addr, 4) != 0) goto drop_it; ptr += 6; /* Other junk */ ptr++; cb->hops = *ptr++; /* Visit Count */ return NF_HOOK(NFPROTO_DECNET, NF_DN_PRE_ROUTING, &init_net, NULL, skb, skb->dev, NULL, dn_route_rx_packet); drop_it: kfree_skb(skb); return NET_RX_DROP; }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git15289.41%333.33%
steven whitehousesteven whitehouse52.94%111.11%
linus torvaldslinus torvalds42.35%111.11%
arnaldo carvalho de meloarnaldo carvalho de melo31.76%111.11%
eric w. biedermaneric w. biederman31.76%111.11%
david s. millerdavid s. miller21.18%111.11%
jan engelhardtjan engelhardt10.59%111.11%
Total170100.00%9100.00%


static int dn_route_rx_short(struct sk_buff *skb) { struct dn_skb_cb *cb = DN_SKB_CB(skb); unsigned char *ptr = skb->data; if (!pskb_may_pull(skb, 6)) /* 5 for short header + 1 for shortest nsp */ goto drop_it; skb_pull(skb, 5); skb_reset_transport_header(skb); cb->dst = *(__le16 *)ptr; ptr += 2; cb->src = *(__le16 *)ptr; ptr += 2; cb->hops = *ptr & 0x3f; return NF_HOOK(NFPROTO_DECNET, NF_DN_PRE_ROUTING, &init_net, NULL, skb, skb->dev, NULL, dn_route_rx_packet); drop_it: kfree_skb(skb); return NET_RX_DROP; }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git10884.38%330.00%
steven whitehousesteven whitehouse75.47%220.00%
linus torvaldslinus torvalds43.12%110.00%
eric w. biedermaneric w. biederman32.34%110.00%
arnaldo carvalho de meloarnaldo carvalho de melo32.34%110.00%
david s. millerdavid s. miller21.56%110.00%
jan engelhardtjan engelhardt10.78%110.00%
Total128100.00%10100.00%


static int dn_route_discard(struct net *net, struct sock *sk, struct sk_buff *skb) { /* * I know we drop the packet here, but thats considered success in * this case */ kfree_skb(skb); return NET_RX_SUCCESS; }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git1860.00%125.00%
david s. millerdavid s. miller516.67%125.00%
eric w. biedermaneric w. biederman516.67%125.00%
linus torvaldslinus torvalds26.67%125.00%
Total30100.00%4100.00%


static int dn_route_ptp_hello(struct net *net, struct sock *sk, struct sk_buff *skb) { dn_dev_hello(skb); dn_neigh_pointopoint_hello(skb); return NET_RX_SUCCESS; }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git2367.65%125.00%
david s. millerdavid s. miller514.71%125.00%
eric w. biedermaneric w. biederman514.71%125.00%
linus torvaldslinus torvalds12.94%125.00%
Total34100.00%4100.00%


int dn_route_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev) { struct dn_skb_cb *cb; unsigned char flags = 0; __u16 len = le16_to_cpu(*(__le16 *)skb->data); struct dn_dev *dn = rcu_dereference(dev->dn_ptr); unsigned char padlen = 0; if (!net_eq(dev_net(dev), &init_net)) goto dump_it; if (dn == NULL) goto dump_it; if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) goto out; if (!pskb_may_pull(skb, 3)) goto dump_it; skb_pull(skb, 2); if (len > skb->len) goto dump_it; skb_trim(skb, len); flags = *skb->data; cb = DN_SKB_CB(skb); cb->stamp = jiffies; cb->iif = dev->ifindex; /* * If we have padding, remove it. */ if (flags & DN_RT_F_PF) { padlen = flags & ~DN_RT_F_PF; if (!pskb_may_pull(skb, padlen + 1)) goto dump_it; skb_pull(skb, padlen); flags =