route.c (188933ac139a6f8ab06cad369bd0200af947b00d) route.c (b6a7719aedd7e5c0f2df7641aa47386111682df4)
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * ROUTE - implementation of the IP router.
7 *
8 * Authors: Ross Biro

--- 138 unchanged lines hidden (view full) ---

147}
148
149static struct neighbour *ipv4_neigh_lookup(const struct dst_entry *dst,
150 struct sk_buff *skb,
151 const void *daddr);
152
153static struct dst_ops ipv4_dst_ops = {
154 .family = AF_INET,
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * ROUTE - implementation of the IP router.
7 *
8 * Authors: Ross Biro

--- 138 unchanged lines hidden (view full) ---

147}
148
149static struct neighbour *ipv4_neigh_lookup(const struct dst_entry *dst,
150 struct sk_buff *skb,
151 const void *daddr);
152
153static struct dst_ops ipv4_dst_ops = {
154 .family = AF_INET,
155 .protocol = cpu_to_be16(ETH_P_IP),
156 .check = ipv4_dst_check,
157 .default_advmss = ipv4_default_advmss,
158 .mtu = ipv4_mtu,
159 .cow_metrics = ipv4_cow_metrics,
160 .destroy = ipv4_dst_destroy,
161 .negative_advice = ipv4_negative_advice,
162 .link_failure = ipv4_link_failure,
163 .update_pmtu = ip_rt_update_pmtu,

--- 314 unchanged lines hidden (view full) ---

478
479 if (old != now && cmpxchg(&bucket->stamp32, old, now) == old)
480 delta = prandom_u32_max(now - old);
481
482 return atomic_add_return(segs + delta, &bucket->id) - segs;
483}
484EXPORT_SYMBOL(ip_idents_reserve);
485
155 .check = ipv4_dst_check,
156 .default_advmss = ipv4_default_advmss,
157 .mtu = ipv4_mtu,
158 .cow_metrics = ipv4_cow_metrics,
159 .destroy = ipv4_dst_destroy,
160 .negative_advice = ipv4_negative_advice,
161 .link_failure = ipv4_link_failure,
162 .update_pmtu = ip_rt_update_pmtu,

--- 314 unchanged lines hidden (view full) ---

477
478 if (old != now && cmpxchg(&bucket->stamp32, old, now) == old)
479 delta = prandom_u32_max(now - old);
480
481 return atomic_add_return(segs + delta, &bucket->id) - segs;
482}
483EXPORT_SYMBOL(ip_idents_reserve);
484
486void __ip_select_ident(struct iphdr *iph, int segs)
485void __ip_select_ident(struct net *net, struct iphdr *iph, int segs)
487{
488 static u32 ip_idents_hashrnd __read_mostly;
489 u32 hash, id;
490
491 net_get_random_once(&ip_idents_hashrnd, sizeof(ip_idents_hashrnd));
492
493 hash = jhash_3words((__force u32)iph->daddr,
494 (__force u32)iph->saddr,
486{
487 static u32 ip_idents_hashrnd __read_mostly;
488 u32 hash, id;
489
490 net_get_random_once(&ip_idents_hashrnd, sizeof(ip_idents_hashrnd));
491
492 hash = jhash_3words((__force u32)iph->daddr,
493 (__force u32)iph->saddr,
495 iph->protocol,
494 iph->protocol ^ net_hash_mix(net),
496 ip_idents_hashrnd);
497 id = ip_idents_reserve(hash, segs);
498 iph->id = htons(id);
499}
500EXPORT_SYMBOL(__ip_select_ident);
501
502static void __build_flow_key(struct flowi4 *fl4, const struct sock *sk,
503 const struct iphdr *iph,

--- 1716 unchanged lines hidden (view full) ---

2220static u32 *ipv4_rt_blackhole_cow_metrics(struct dst_entry *dst,
2221 unsigned long old)
2222{
2223 return NULL;
2224}
2225
2226static struct dst_ops ipv4_dst_blackhole_ops = {
2227 .family = AF_INET,
495 ip_idents_hashrnd);
496 id = ip_idents_reserve(hash, segs);
497 iph->id = htons(id);
498}
499EXPORT_SYMBOL(__ip_select_ident);
500
501static void __build_flow_key(struct flowi4 *fl4, const struct sock *sk,
502 const struct iphdr *iph,

--- 1716 unchanged lines hidden (view full) ---

2219static u32 *ipv4_rt_blackhole_cow_metrics(struct dst_entry *dst,
2220 unsigned long old)
2221{
2222 return NULL;
2223}
2224
2225static struct dst_ops ipv4_dst_blackhole_ops = {
2226 .family = AF_INET,
2228 .protocol = cpu_to_be16(ETH_P_IP),
2229 .check = ipv4_blackhole_dst_check,
2230 .mtu = ipv4_blackhole_mtu,
2231 .default_advmss = ipv4_default_advmss,
2232 .update_pmtu = ipv4_rt_blackhole_update_pmtu,
2233 .redirect = ipv4_rt_blackhole_redirect,
2234 .cow_metrics = ipv4_rt_blackhole_cow_metrics,
2235 .neigh_lookup = ipv4_neigh_lookup,
2236};

--- 565 unchanged lines hidden ---
2227 .check = ipv4_blackhole_dst_check,
2228 .mtu = ipv4_blackhole_mtu,
2229 .default_advmss = ipv4_default_advmss,
2230 .update_pmtu = ipv4_rt_blackhole_update_pmtu,
2231 .redirect = ipv4_rt_blackhole_redirect,
2232 .cow_metrics = ipv4_rt_blackhole_cow_metrics,
2233 .neigh_lookup = ipv4_neigh_lookup,
2234};

--- 565 unchanged lines hidden ---