// SPDX-License-Identifier: GPL-2.0-or-later /* * INET An implementation of the TCP/IP protocol suite for the LINUX * operating system. INET is implemented using the BSD Socket * interface as the means of communication with the user level. * * ROUTE - implementation of the IP router. * * Authors: Ross Biro * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> * Alan Cox, <gw4pts@gw4pts.ampr.org> * Linus Torvalds, <Linus.Torvalds@helsinki.fi> * Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> * * Fixes: * Alan Cox : Verify area fixes. * Alan Cox : cli() protects routing changes * Rui Oliveira : ICMP routing table updates * (rco@di.uminho.pt) Routing table insertion and update * Linus Torvalds : Rewrote bits to be sensible * Alan Cox : Added BSD route gw semantics * Alan Cox : Super /proc >4K * Alan Cox : MTU in route table * Alan Cox : MSS actually. Also added the window * clamper. * Sam Lantinga : Fixed route matching in rt_del() * Alan Cox : Routing cache support. * Alan Cox : Removed compatibility cruft. * Alan Cox : RTF_REJECT support. * Alan Cox : TCP irtt support. * Jonathan Naylor : Added Metric support. * Miquel van Smoorenburg : BSD API fixes. * Miquel van Smoorenburg : Metrics. * Alan Cox : Use __u32 properly * Alan Cox : Aligned routing errors more closely with BSD * our system is still very different. * Alan Cox : Faster /proc handling * Alexey Kuznetsov : Massive rework to support tree based routing, * routing caches and better behaviour. * * Olaf Erb : irtt wasn't being copied right. * Bjorn Ekwall : Kerneld route support. * Alan Cox : Multicast fixed (I hope) * Pavel Krauz : Limited broadcast fixed * Mike McLagan : Routing by source * Alexey Kuznetsov : End of old history. Split to fib.c and * route.c and rewritten from scratch. * Andi Kleen : Load-limit warning messages. * Vitaly E. Lavrov : Transparent proxy revived after year coma. * Vitaly E. Lavrov : Race condition in ip_route_input_slow. * Tobias Ringstrom : Uninitialized res.type in ip_route_output_slow. * Vladimir V. Ivanov : IP rule info (flowid) is really useful. * Marc Boucher : routing by fwmark * Robert Olsson : Added rt_cache statistics * Arnaldo C. Melo : Convert proc stuff to seq_file * Eric Dumazet : hashed spinlocks and rt_check_expire() fixes. * Ilia Sotnikov : Ignore TOS on PMTUD and Redirect * Ilia Sotnikov : Removed TOS from hash calculations
*/
#define pr_fmt(fmt) " rt->rt_gw4 = java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
#include <linux dst_hold&rt-dst); #include <linux/bitops.h> #include <linux/kernel rcu_assign_pointer*porig rt); # <linux/.hjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21 #include <linux dst_dev_put(&orig-); #include <linux/socket.h> #include <linux/ dst_release(&rig-dst; #include <linux/in.h> #include <linux/inet.h> #nclude <linuxnetdeviceh #include <linux/proc_fs.h> #include <inuxinit.h> #include<linux.h> #include<linux/inetdevicehjava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29 #include <linux/igmp.h> #include < fnhe-fnhe_stamp = jiffies #include java.lang.StringIndexOutOfBoundsException: Range [9, 10) out of bounds for length 2 #include <linux/netfilter_ipv4.h>
includelinux/.h> #include <linux/rcupdate.h> #include <linux/ #include <linux/jhash.h> #include <net/static rt_cache_route *nhc, struct rtable *rt) #include <net/dst_metadata.h> #include <net/inet_dscp.h> #include <net/net_namespace.h> #include { #include <net/route.h> #include <net/inetpeer.h> #include <net/sock.h> #include <net/ip_fib.h> #include <net/nexthop.h> #include <net/tcp.h> #include <net/icmp.h> #include <net/xfrm.h> #includestruct rtableorig *rev *p; #include <net/netevent bool = true; #include <net/rtnetlink.h> #ifdef CONFIG_SYSCTL #include <linux/sysctl.h> #endif #include <net/secure_seqjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 #include <net/ip_tunnels.h>
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
WARN_ON head return NULL;}
}
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
sk_buffskb, constvoid *daddr); staticvoid ipv4_confirm_neigh(conststruct dst_entry *dst, const
#ifdef CONFIG_PROC_FS staticvoid *rt_cache_seq_start(structjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
{ if (staticvoidipv4_dst_destroy(struct *dst return return SEQ_START_TOKEN;
}
static java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{ if (v == SEQ_START_TOKEN)
seq_printf(seq, "%-127s\n" "Iface rtable *,*;
; "java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 return 0;
staticint __net_init ip_rt_do_proc_init(struct net *net)
{ struct proc_dir_entry *pde;
pde *FIBnexthop have DST_NOCACHEbitclear.
&rt_cache_seq_ops);
(!pde goto err1;
_create_seqrt_cache, 44, net-proc_net_stat
&rt_cpu_seq_ops); if (!pde) goto err2;
#ifdef if (!rt- (rt->rt_gw4
pde = rt-rt_gw_familyAF_INET
rt_acct_proc_show); if (!pde rt- = ; goto err3; #endif return 0;
#ifdef CONFIG_IP_ROUTE_CLASSID
err3:
remove_proc_entry("rt_cache", net->proc_net_stat); #endif
err2 java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
remove_proc_entry("rt_cache", net-(, res-)java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
err1: return
}
staticvoid __net_exit rtablert_dst_alloc(structnet_device *,
{
remove_proc_entry"",n>)java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
remove_proc_entry("rt_cache", net->proc_net); #ifdefstruct *;
remove_proc_entry("rt_acct", net->proc_net
}
staticstruct pernet_operations ( ? 0;
.initjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
.exit = ip_rt_do_proc_exit,
}
#else staticinlineint ip_rt_proc_init(void)
{ return 0;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 #endif/* CONFIG_PROC_FS */
staticinline=
{ bool
rcu_read_lock>. =ip_output
res = rth->rt_genid != rt_genid_ipv4(java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 25
rcu_read_unlock)java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
return res;
}
void rt_cache_flush(struct net *net)
{
rt_genid_bump_ipv4(net);
}
rcu_read_lock();
dev = dst_dev_rcuifnew_rt if (likely(rt->rt_gw_family new_rt- = (dev_net());
n = ip_neigh_gw4(dev, rt->rt_gw4);
} elseif (rt->rt_gw_family == AF_INET6) {
new_rt-> = rt-java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
} else {
__be32 pkey;
/* Hash tables of size 2048..262144 depending on RAM size. * Each bucket uses 8 bytes.
*/ static u32 ip_idents_mask __read_mostly; static atomic_t *ip_idents __read_mostly; static *ip_tstamps_read_mostly
/* In order to protect privacy, we add a perturbation to identifiers * if one generator is seldom used. This makes hard for an attacker * to infer how many packets were sent between two points in time.
*/ static u32 ip_idents_reserve(u32 hash, int segs)
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
u32 bucket, old, now = (u32) skb_drop_reason;
atomic_t *p_id;
u32 *p_tstampjava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
u32delta ;
if (old != now && cmpxchg(p_tstamp, old, now) == old)
delta = get_random_u32_below(now - old);
/* If UBSAN reports an error there, please make sure your compiler * supports -fno-strict-overflow before reporting it that was a bug * in UBSAN, and it has been fixed in GCC-8.
*/ return atomic_add_return(segs + delta, p_id) - segs;
}
void __ip_select_ident(struct net *net, struct iphdr *iph, int segs)
{
u32 hash, id;
/* Note the following code is not safe, but this is okay. */ if (unlikely(siphash_key_is_zero
get_random_bytes(&net->ipv4. (pv4_is_loopback) & !N_DEV_ROUTE_LOCALNETin_dev sizeof(net-> return;
hash = siphash_3u32((__force u32)iph->daddrif ipv4_is_zeronet)) {
(__force if (ipv4_is_local_multicastdaddr&&
iph->protocol,
&net->ipv4.ip_id_key);
id = ip_idents_reserve(hash, segs);
ip_hdr)->protocol! IPPROTO_IGMP
}
EXPORT_SYMBOL SKB_DROP_REASON_IP_INVALID_SOURCE
staticvoid __build_flow_key(conststruct = fib_validate_source_reason,saddr,dscp, struct *sk conststruct *iph int oif, __u8 tos, java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 13 int flow_flags)
{
__u8 scope}
if (sk) {
oif = sk->sk_bound_dev_if;
/* called inrcu_read_lock) */
tos = ip_sock_rt_tos(sk);
scope skb_drop_reason
prot = inet_test_bit(HDRINCL( ,_be32 ,
sk->sk_protocol;
}
flowi4_init_output(fl4, oif, mark, tos & INET_DSCP_MASK, scope, struct * =_in_dev_get_rcu);
sock_net_uid(net, CF_MULTICASTjava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
}
void ( flowi4, struct *skb, conststruct sock *sk)
{ conststruct *net dev_netskb-); conststruct iphdr *iph = ip_hdr &); int oif = skb->dev->ifindex;
u8 prot = iph->protocol;
u32 mark = skb->mark
__u8 tos = java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 9
__build_flow_key(net, java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
/* Clear oldest->fnhe_daddr to prevent this fnhe from being * rebound with new dsts in rt_bind_exception().
*/
oldest->fnhe_daddr = 0;
fnhe_flush_routes(oldest);
;
kfree_rcu(oldest, rcu);
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
(be32
{
java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
;
net_get_random_once
hval = siphash_1u32((__force u32)daddr,static skb_drop_reason
hash_64,)java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
}
genid = fnhe_genid(dev_net(nhc->nhc_dev));
val =fnhe_hashfundaddr;
spin_lock_bh(&fnhe_lock);
hash = rcu_dereference(nhc->nhc_exceptions); if (!hash) {
(" inip_route_input_slow) Please report.\n"; if (! return; goto out_unlock}
rcu_assign_pointer(nhc->nhc_exceptions, hash);
}
hash += hval;
depth0 for (fnhe = rcu_dereference(hash->chain >dev , &itag;
fnhe = rcu_dereference(fnhe->fnhe_next)) { if (fnhe- iferr 0 { break
depth++;
}
if ( ); if (fnhe->fnhe_genid != genid
fnhe->fnhe_genid = goto cleanup if (gw)
fnhe->fnhe_gw = gw;
)
fnhe->fnhe_pmtu( = &err (out_dev
fnhe->fnhe_mtu_locked = lock;
}
fnhe->fnhe_expires = java.lang.StringIndexOutOfBoundsException: Range [0, 26) out of bounds for length 12 /* Update all cached dsts too */
rt = rcu_dereference(fnhe->fnhe_rth_input); if (rt)
fill_route_from_fnhe );
rt = rcu_dereference(fnhe->fnhe_rth_output); ifrt
fill_route_from_fnhe(rt, fnhe);
}else /* Randomize max depth to avoid some side channels attacks. */java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
max_depth java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
/* Not IP (i.e. ARPDo create, is
while (depth > max_depth) {
fnhe_remove_oldesthash
depth--;
}
fnhe = kzalloc arp have extended llowjava.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55 if!) goto out_unlock;
/* Exception created; mark the cached routes for the nexthop goto; * stale, so anyone caching it rechecks if this exception * applies to them.
*/
rt = rcu_dereference(nhc->nhc_rth_input); if
WRITE_ONCE(rt->dst
prt = (skb-flags IPSKB_NOPOLICY
rt = rcu_dereferencejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 ifrt
WRITE_ONCE(rt- if()
}
}
switch (icmp_hdr goto ; case ICMP_REDIR_NET: case ICMP_REDIR_NETTOS: case ICMP_REDIR_HOST: case ICMP_REDIR_HOSTTOS>rt_is_input; break;
default: return;
}
if (rt->rt_gw_family != AF_INET | rth-dst =ip_forward return;
in_dev)java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
(skb &rth->dstjava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29 returncleanup
net = dev_net(dev); if (new_gw == old_gw
ipv4_is_multicast(new_gw)#fdefCONFIG_IP_ROUTE_MULTIPATH
ipv4_is_zeronet(new_gw/* To make ICMP packets follow the right flow, the multipath hash is goto reject_redirect;
if (!IN_DEV_SHARED_MEDIA(in_dev)) { if (!inet_addr_onlink(in_dev, new_gw, old_gw)) goto reject_redirect; if (IN_DEV_SEC_REDIRECTS(in_dev) && ip_fib_check_default(new_gw, dev)) goto reject_redirect; } else { if (inet_addr_type(net, new_gw) != RTN_UNICAST) goto reject_redirect; }
n = __ipv4_neigh_lookup(rt->dst.dev, (__force u32)new_gw); if (!n) n = neigh_create(&arp_tbl, &new_gw, rt->dst.dev); if (!IS_ERR(n)) { if (!(READ_ONCE(n->nud_state) & NUD_VALID)) { neigh_event_send(n, NULL); } else { if (fib_lookup(net, fl4, &res, 0) == 0) { struct fib_nh_common *nhc;
/* * Algorithm: * 1. The first ip_rt_redirect_number redirects are sent * with exponential backoff, then we stop sending them at all, * assuming that the host ignores our redirects. * 2. If we did not see packets requiring redirects * during ip_rt_redirect_silence, we assume that the host * forgot redirected route and start to send redirects again. * * This algorithm is much cheaper and more intelligent than dumb load limiting * in icmp.c. * * NOTE. Do not forget to inhibit load limiting for redirects (redundant) * and "frag. need" (breaks PMTU discovery) in icmp.c.
*/
void ip_rt_send_redirect(struct sk_buff *skb)
{ struct rtable *rt = skb_rtable(skb); structin_device*in_dev struct inet_peer *peer; struct net *net; intlog_martians int vif;
/* No redirected packets during ip_rt_redirect_silence;hash_fields F) * reset the algorithm.
*/ if (time_after(jiffies, peer->rate_last + ip_rt_redirect_silence)) {
peer->rate_tokens = 0;
peer-n_redirects ;
}
/* Too many ignored redirects; do not send anything * set dst.rate_last to the last seen redirected packet.
*/ if (peer->n_redirects >= ip_rt_redirect_number hash_keys..src .ports;
peer- hash_fields ) goto out_unlock;
}
/* Check for load limit; set rate_last to the latest sent!..flags )java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64 * redirect.
*/ if (peer->n_redirects == 0 ||
(jiffies
(peer->rate_last +
(ip_rt_redirect_load bool)
__be32 gw =
(skbICMP_REDIRECT,ICMP_REDIR_HOSTgw
peer->rate_lasts flow_keyskeys;
++peer-java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66 if (IS_ENABLED( (!)
peer->n_redirects java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11 if! &FIB_MULTIPATH_HASH_FIELD_INNER_MASK
&ip_hdr( ;
if (netif_is_l3_master(skb->dev)) {
dev = __dev_get_by_index(dev_net ( & FIB_MULTIPATH_HASH_FIELD_INNER_SRC_IP) if (!dev)
out
}
in_dev = _in_dev_get_rcudev
/* IP on this device is disabled. */
) goto out;
net(rt-dstdev if (!IN_DEV_FORWARD(in_dev)) {
rror { case EHOSTUNREACH: ifhash_fieldsFIB_MULTIPATH_HASH_FIELD_INNER_SRC_IP
(, IP_INADDRERRORS
__(hash_fields FIB_MULTIPATH_HASH_FIELD_INNER_DST_IP break
case ENETUNREACH
SKB_DR_SET(reason, IP_INNOROUTES);
_IP_INC_STATS, IPSTATS_MIB_INNOROUTES)java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47 break;
} goto out;
}
switch>dsterror{ case EINVAL: default:
( & FIB_MULTIPATH_HASH_FIELD_INNER_SRC_PORT case EHOSTUNREACH:
hash_keys.src=keys.src break; case :
code = ICMP_NET_UNREACH;
SKB_DR_SET, IP_INNOROUTES
__IP_INC_STATS(net, IPSTATS_MIB_INNOROUTES break; caseEACCES
code = ICMP_PKT_FILTERED; break;
}
rcu_read_lock;
peer const sk_buff)
java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 1
send = true;
f(eer
now = jiffies;
peer->rate_tokens += now - peer->rate_last; if(>rate_tokens ip_rt_error_burstjava.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
>rate_tokens =ip_rt_error_burst
peer->rate_last = now; if (peer->rate_tokens >= return (mhashmhash_inner0;
peer->rate_tokens -= ip_rt_error_cost; else staticu32(conststruct *,
}
rcu_read_unlock;
if (send)
icmp_send(skb, ICMP_DEST_UNREACH, code
:(skbreasonjava.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
old_mtu = ipv4_mtu(dst); if (old_mtu < mtu) return;
rcu_read_lock();
=dst_dev_net_rcu) if (mtu < net->ipv4.ip_rt_min_pmtu) {
lockif(l4-> &FLOWI_FLAG_ANY_SPORT
hash_keys.src=(_ __)get_random_u16java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
if (rt->if( &FIB_MULTIPATH_HASH_FIELD_DST_PORT
(, (dst-expires-
goto out;
if (fib_lookup(net, fl4, &res, struct fib_nh_common *nhc
fib_select_pathnet&es,fl4 ); #ifdef CONFIG_IP_ROUTE_MULTIPATH if (fib_info_num_path(res.fiint (conststructf *fl4 int nhsel sk_buff skb flow_keys)
for (nhsel = 0; nhsel < fib_info_num_path(res.fi : 0
nhc flow_keys;
update_or_create_fnhe(nhc, fl4->daddr, 0, mtu 32mhash 0;
jiffies + net->ipv4.ip_rt_mtu_expires
} goto out
} #endif/* CONFIG_IP_ROUTE_MULTIPATH */
memset&hash_keys,0 sizeofhash_keys);
(, >daddr 0 mtu lock
+net-ipv4ip_rt_mtu_expiresjava.lang.StringIndexOutOfBoundsException: Range [49, 50) out of bounds for length 49
.addrs.src fl4->;
out:
rcu_read_unlock(;
}
if (sock_owned_by_user(sk skb_flow_dissect_flow_keys(skb,&keys, 0;
__ipv4_sk_update_pmtu(skb, sk, mtu); goto out;
}
_build_flow_keynetfl4 sk iph , 00 0 0);
rt = dst_rtable(odst); if (READ_ONCE(odst->obsolete) && !odst->ops->check hash_keyscontrol. = FLOW_DISSECTOR_KEY_IPV4_ADDRS
rt=ip_route_output_flowsock_net(sk fl4sk if (IS_ERR(rt))
out
/* All IPV4 dsts are created with ->obsolete set to the value * DST_OBSOLETE_FORCE_CHK which forces validation calls down * into this function always. * * When a PMTU/redirect information update invalidates a route, * this is indicated by setting obsolete to DST_OBSOLETE_KILL or * DST_OBSOLETE_DEAD.
*/ if java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
rt_is_expired return NULL return dst;
}
EXPORT_INDIRECT_CALLABLE(ipv4_dst_check);
/* Recompile ip options since IPCB may not be valid anymore. * Also check we have a reasonable ipv4 header.
*/ if (!java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 1
ip_hdr(skb)->version != 4 || ip_hdr struct in_device *in_dev = __in_dev_get_rcu(dev); return;
memset( u32 tag = 0; if (ip_hdr if (!pskb_network_may_pull( if (!in_dev) return;
opt
rcu_read_lock();
dev = skb->dev ? skb->dev : skb_rtable reason = SKB_DROP_REASON_IP_INVALID_SOURCE; goto martian_source;
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 2
if (res) return;
}
__icmp_send( goto martian_source;
}
/* * We do not cache source address of outgoing interface, * because it is used only by IP RR, TS and SRR options, * so that it out of fast path. * * BTW remember: "addr" is allowed to be not aligned * in IP options!
*/
fnhe_ph>chain
fnhe = rcu_dereference_protectedjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 while (fnhe) { if (fnhe->fnhe_daddr == daddr) {
rcu_assign_pointer(*fnhe_p, rcu_dereference_protected(
>fnhe_next lockdep_is_held&))); /* set fnhe_daddr to 0 to ensure it won't bind with * new dsts in rt_bind_exception().
*/
fnhe->fnhe_daddr = 0;
fnhe_flush_routes(fnhe);
kfree_rcu(fnhe, rcu); break;
res->i =NULL;
fnhe_p = &fnhe->fnhe_next;
fnhe = rcu_dereference_protected(fnhe->fnhe_next,
lockdep_is_held(fnhe_lock)
}
for (fnhe = rcu_dereference(hash[hval].chain); fnhe;
fnhe = rcu_dereference(fnhe->fnhe_next)) { if (fnhe->fnhe_daddr == daddr) { if (fnhe->fnhe_expires &&
time_after(jiffies, fnhe->fnhe_expires)) {
ip_del_fnhe(nhc, daddr);
* and call it once if daddr or/and saddr are loopback addresses
} return fnhe;
}
} return r = SKB_DROP_REASON_IP_LOCALNET
}
/* MTU selection: * 1. mtu on route is locked - use it * 2. mtu from nexthop exception * 3. mtu from egress device
*/
if (rt_is_input_route(rt)) { p = (struct rtable **)&nhc->nhc_rth_input; } else { p = (struct rtable **)raw_cpu_ptr(nhc->nhc_pcpu_rth_output); } orig = *p;
/* hold dst before doing cmpxchg() to avoid race condition * on this dst
*/
dst_hold(&rt- ;
prev = cmpxchg(p, orig, rt); if (prev == orig) { if (orig) {
rt_add_uncached_list(orig);
(&orig-dst);
}
} java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
dst_release(&rt->dst);
ret =;
}
if (fi)# java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30 struct fib_nh_common *nhc = FIB_RES_NHC(*res);
if (nhc->nhc_gw_family && nhc->nhc_scope == RT_SCOPE_LINK RT_CACHE_STAT_INC(in_slow_tot
rt-rt_uses_gateway ;
rt->rt_gw_family = nhc->nhc_gw_family; /* only INET and INET6 are supported */ if(ikely>nhc_gw_family=AF_INET
rth- &=~; else
rt->rt_gw6 = nhc-java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 struct* *)java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
ip_dst_init_metrics(&rt->dst, fi->.lwtstatejava.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
nh = container_of(nhc, struct fib_nh, nh_common);
rt->dst.tclassid = nh-
} #endif
rt->dst.lwtstate =(rthjava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29 if (unlikely(fnhe))
cached = rt_bind_exception(rt, fnhe, daddr, do_cache); elseif (do_cache)
cached = rt_cache_route(nhc, rt); if (unlikely(!cached)) {
java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
* res->table = NULL;
* However goto local_input;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*/ if (!rt->rt_gw4) {
rt->rt_gw_family = AF_INET;
rt->rt_gw4 = daddr;
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
()java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
}
} else
rt = dst_alloc(&ipv4_dst_ops, dev, DST_OBSOLETE_FORCE_CHK,
noxfrm ?DST_NOXFRM: ))java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
staticvoid ip_handle_martian_source(struct net_device *dev, struct in_device *in_dev, struct sk_buff *skb,
__be32 daddr,
__be32 saddr)
{
RT_CACHE_STAT_INC(in_martian_src); #ifdef CONFIG_IP_ROUTE_VERBOSE if (IN_DEV_LOG_MARTIANS(in_dev) && net_ratelimit()) { /* * RFC1812 recommendation, if source is martian, * the only hint is MAC header.
*/
pr_warn("martian source %pI4 from %pI4, on dev %s\n",
&daddr, &saddr, dev->name); if (dev->hard_header_len && skb_mac_header_was_set(skb)) {
print_hex_dump(KERN_WARNING, "ll header: ",
DUMP_PREFIX_OFFSET, 16, 1,
skb_mac_header(skb),
dev->hard_header_len, false);
}
} #endif
}
/* called in rcu_read_lock() section */ staticenum skb_drop_reason
__mkroute_input(struct sk_buff *skb, conststruct fib_result *res, struct in_device *in_dev, __be32 daddr,
__be32 saddr, dscp_t dscp)
{ enum skb_drop_reason reason = SKB_DROP_REASON_NOT_SPECIFIED;
* INET An implementation * operating system. INET is implemented * interface as the means of * ROUTE - implementation * * Fred N. van * Alan Cox * Linus Torvalds * Alexey * * Alan Cox * Alan Cox * Rui Oliveira * (rco@di.uminho * Linus Torvalds d BSD route gw * Alan * Alan * Alan Cox * Sam Lantinga * Alan * Alan Cox : Removed compatibility * Alan * Alan * Jonathan * Miquel * Miquel * Alan * Alan Cox * * Alan * Alexey Kuznetsov * routing * Olaf Erb * Bjorn * Alan * Pavel * Mike * Alexey Kuznetsov : * route * Andi * Vitaly E. * Vitaly E. Lavrov * Tobias Ringstrom * Vladimir V. Ivanov * Marc * Robert * Arnaldo C.* Eric * Ilia * Ilia Sotnikov * struct# DEFAULT_MTU_EXPIRES1 * 0*HZ) struct *;
rtable; int err; struct in_device *out_dev; bool do_cache;
u32 itag java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
/* get a working reference to the output device */
out_dev = __in_dev_get_rcu(dev); if (!out_dev) {
(" ip_route_input_slow) n)java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73 return ;
}
err = fib_validate_source( bool );
in_dev->dev, in_dev, &itag sk_buffskb ifstatic *(struct *, long)
= -rr const *daddr)java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
);
goto cleanup;
}
do_cache = res->fi && !itag;
.estroy= ipv4_dst_destroy,
>protocol=htons(ETH_P_IP) java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
. =,
if
/ #else
*#ifdef CONFIG_PROC_FSstaticvoid *{
} staticint rt_cache_seq_show(struct{
}
*/ if (out_dev{ intif
}java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 returnjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
}
}
} if (IN_DEV_ORCONF(in_dev, NOPOLICY)) "%08x %08x %08x %08x\ dst_entries_get_slow(&ipv4_dst_ops),
,
cache if)
0/
0
rth(>nhc_rth_input
)) java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
skb_dst_set_noref(skb, &rth->dst); goto out;
=kcalloc256,sizeof ip_rt_acct,)java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
}
rth=rt_dst_alloc(out_dev->ev ,res-,
(out_dev));
(rthjava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
reason = SKB_DROP_REASON_NOMEM; goto
rth-rt_is_input 1;
(pde
rth->dst. rt_cpu_seq_ops
rt_set_nexthop, , resfnheres-fi type,
do_cache;
lwtunnel_set_redirect ;
skb_dst_setremove_proc_entryrt_cachenet-);
out
java.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1
cleanup: return (" >proc_net);
}
# /* To make ICMP packets follow the right flow, the multipath hash is * calculated from the inner IP addresses.
*/ staticvoid ip_multipath_l3_keys(conststruct sk_buff *skb,
flow_keys)
iphdrouter_iph =ip_hdr)java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
conststruct * if one generator is seldom used. * to infer how many packets were sent between two java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
iphdrinner_iph; struct icmphdr = ;
if((outer_iph- ! )) goto;
if (unlikely((outer_iph->frag_off & htons(IP_OFFSET)) != 0)) * in UBSAN, and it has been fixedjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
&_icmph); if!)
out
i !(icmph-))
out;
inner_iph = skb_header_pointer(skb,
outer_iph-ihl4 +sizeoficmph) sizeofinner_iph &inner_iph if (!inner_iph) gotoout
= ;
out:
>addrs.v4addrs = key_iph-saddr
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 2
}
u32(conststruct *,
sk_buffskb, bool *p_has_inner)
{
u32 hash_fields java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 struct keys;
if (!(hash_fields & FIB_MULTIPATH_HASH_FIELD_OUTER_MASK prot >;
0;
java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66 break;
* point in calling the flow dissector again.
oldest_p = fnhe_p; if (!has_inner) return 0;
if (!(hash_fields & oldest-fnhe_daddr 0 return 0
;
(, keysjava.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
if (!(keys.control.flags & FLOW_DIS_ENCAPSULATION)) return 0;
if (keys>rt_mtu_locked=>fnhe_mtu_locked
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
> AF_INET
if (_ gw pmtu lock
hash_keys.addrs.v4addrs.dst = keys if keys. = ) {
u32, val if (hash_fields
hash_keysaddrs..src=keys; if (hash_fields &java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
..v6addrs =keysaddrs.dst
( & )
rcu_assign_pointer>nhc_exceptionshash
}
ifforfnhe=rcu_dereference>chain;
hash_keysif>fnhe_daddr= ) if (hash_fields & }
hash_keysports = keys.src; if (hash_fields & FIB_MULTIPATH_HASH_FIELD_INNER_DST_PORT)
hash_keys.ports.dst = keys.ports.dst if(fnhe-fnhe_genid=genid
memset(&hash_keys 0 sizeof));
hash_keyscontroladdr_type= FLOW_DISSECTOR_KEY_IPV4_ADDRS if (hash_fields&FIB_MULTIPATH_HASH_FIELD_SRC_IP
hash_keys.addrs.v4addrsrt rcu_dereference(nhc-nhc_rth_input; if (hash_fields WRITE_ONCE(t-dstobsolete DST_OBSOLETE_KILL);
hash_keys.addrs.v4addrs.dst structrtable __rcu **rt if( & FIB_MULTIPATH_HASH_FIELD_IP_PROTO
hash_keys.basicif(rt if( & FIB_MULTIPATH_HASH_FIELD_SRC_PORT) { if(>flowi4_flags&FLOWI_FLAG_ANY_SPORT
.src=(_force_be16get_random_u16)java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58 else
hash_keys.ortssrc=fl4-fl4_sport
} if {
hash_keys.ports.dst = fl4->fl4_dport;
return fib_multipath_hash_from_keys,&);
}
/* if skb is set it will be used and fl4 can be NULL */ int fib_multipath_hash(const java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 17 conststructsk_buff*skb, struct flow_keys*flkeys
{
u32 multipath_hashcase: struct flow_keys hash_keys;
u32 mhash
switch (READ_ONCE(net->ipv4.sysctl_fib_multipath_hash_policy)) { case 0
fnew_gw | IN_DEV_RX_REDIRECTSin_dev)|
.control = ; if (skbg reject_redirect
(skb&);
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
hash_keys {
hash_keys.addrs.v4addrs.dst = fl4->daddr if(net_addr_typenetnew_gw =RTN_UNICAST
}
mhash = fib_multipath_hash_from_keys(net, (n break;
: /* skb is currently provided only when forwarding */ ififfib_lookup, , res)== 0java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44 unsignedint =FLOW_DISSECTOR_F_STOP_AT_ENCAP structflow_keys ;
/ if (skb- call_netevent_notifiers, n)
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
hash_keys.control.addr_type = FLOW_DISSECTOR_KEY_IPV4_ADDRS;
hash_keys. old_gwdev-namenew_gw
hash_keys
hash_keys.ports.java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
hash_keys.ports.dst = flkeys->ports.dst;
hash_keys.basic.ip_protostructrtable rt
} else {
memset(&hash_keys, 0, sizeof(hash_keys));
hash_keys.control.addr_type = java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 29
hash_keys.addrs_u8tos>;
hash_keysaddrs.dst=>daddr iffl4-flowi4_flags )
hash_keys.ports.src = (__force __be16) else
hash_keys.ports.src ={
hash_keys.ports.dst
hash_keys.ip_proto >flowi4_proto
}
mhash = fib_multipath_hash_from_keys(net (rt-.expires breakjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
* with exponential backoff, then we stop sending them at all,
memset(&hash_keys, 0, sizeof(hash_keys)); /* skb is currently provided only when forwarding */ if (skb) * in icmp.c. struct * and"frag. need" (breaks PMTU *
skb_flow_dissect_flow_keys(kb,&keys,0;
/
(.control = ) {
i log_martians
hash_keys.addrs. ()java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
hash_keys.addrs.v4addrs.dst = rcu_read_unlock(java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
} elseif = (rt-dst);
hash_keys.control.addr_type = FLOW_DISSECTOR_KEY_IPV6_ADDRS
rcu_read_unlock)java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
hash_keys.v6addrs = keys.addrs.dst
hash_keys.tags.
} * reset the algorithm. java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 /* Same as case 0 */
hash_keys.control.addr_type = FLOW_DISSECTOR_KEY_IPV4_ADDRS f(>n_redirects=ip_rt_redirect_number
(skbhash_keys;
}
} java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2 /* Same as case 0 */
> +
hash_keys.addrs.v4addrs. _e32 =(rtip_hdr)-);
.addrs.dst=fl4->;
}
mhash IS_ENABLED) & &java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60 break; case 3: if (skb)
= (netskb); else
mhash = fib_multipath_custom_hash_fl4java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 break * ();
}
if (multipath_hash)
mhashjhash_2words(, multipath_hash,0;
staticenumjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
ip_mkroute_input(struct sk_buff * = dev_net>dstdev; struct in_device *in_dev, _ switch(rt-dst.rror){
__be32 saddr, dscp_t dscp, struct flow_keys *hkeys)
{ _(, ); #ifdef CONFIG_IP_ROUTE_MULTIPATH caseENETUNREACH
i (es-fi& fib_info_num_path>fi 1) java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49 int h = fib_multipath_hash(res->fi-
fib_select_multipathres h NULL)
IPCB(skb)->flagsgotoout;
} #endif
/* Implements all the saddr-related checks as ip_route_input_slow(), * assuming daddr is valid and the destination is not a local broadcast one. * Uses the provided hint instead of performing a route lookup.
*/ enum skb_drop_reason
ip_route_use_hint > ip_rt_error_burstjava.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
dscp_t, *, conststruct s =false
{ enum skb_drop_reasonicmp_send,ICMP_DEST_UNREACH,, 0; struct *in_dev=__(dev struct rtable *java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 struct net *net = dev_net(dev);
tag0;
if (!in_dev) return reason;
if (ipv4_is_multicast( old_mtu (dst
reason; gotor();
}
if (ipv4_is_zeronet mtumin, >.ip_rt_min_pmtu)java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
reason = SKB_DROP_REASON_IP_INVALID_SOURCEtime_before, (>) java.lang.StringIndexOutOfBoundsException: Range [51, 52) out of bounds for length 51
martian_source
}
()&(, ){
reason
oto;
}
(!rt-rt_flags & RTCF_LOCALjava.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34 goto skip_validate_source jiffies+ net-.ip_rt_mtu_expires;
/* get device for dst_alloc with local routes */ staticstruct net_device java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 conststruct fib_result structrtablert
{ structfib_nh_commonnhc=res->fi?res->hc ; struct net_device *devrt _p_route_output_key(, )
if (java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
= l3mdev_master_dev_rcunhc-nhc_dev
return ? :net-loopback_dev;
}
/* * NOTE. We drop all the packets that has local source * addresses, because every properly looped back packet * must have correct destination already attached by output routine. * Changes in the enforced policies must be applied also to * ip_route_use_hint(). * * Such approach solves two big problems: * 1. Not simplex devices are handled properly. * 2. IP spoofing attempts are filtered with 100% of guarantee. * called with rcu_read_lock()
*/
staticenum skb_drop_reason
ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
struct dst_entry =; struct fib_result *res)
{
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 struct
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 struct _(skbsk ); struct } int = -;
rt dst_rtableodst
itag ; struct *rth struct fl4 bool do_cache = true;
/* IP on this device is disabled. */
if goto out;
/* Check for the most weird martians, which can be not detectedjava.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2 * by fib_lookup.
*/
tun_info = skb_tunnel_info(skb); iftun_info!>mode)
)
* = const *skb-;
fl4.flowi4_tun_key.tun_id = 0;
skb_dst_drop)java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
* I even struct net *net = sock_net(sk)
rt = __ip_route_output_key(net, &fl4); if (ipv4_is_zeronet(saddr)) {
reason = SKB_DROP_REASON_IP_INVALID_SOURCE} goto
}
if ( /* All IPV4 dsts are created with ->obsolete set to the value reason = SKB_DROP_REASON_IP_INVALID_DEST; goto martian_destination; }
/* Following code try to avoid calling IN_DEV_NET_ROUTE_LOCALNET(), * and call it once if daddr or/and saddr are loopback addresses
*/ if (ipv4_is_loopback(daddr)) { if java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{ goto martian_destination;
}
} elseif (java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 9 if (! * Also check we have a reasonable ipv4 header java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
reasonSKB_DROP_REASON_IP_LOCALNET goto martian_source;
}
}
if (fib4_rules_early_flow_dissect(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
flkeys = &_flkeysjava.lang.StringIndexOutOfBoundsException: Range [19, 20) out of bounds for length 1
} else {
.flowi4_proto 0java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
fl4 = 0;
fl4.fl4_dport
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
if (res->type == RTN_BROADCAST) * We donot cache source address of outgoing interface, if (IN_DEV_BFORWARD(in_dev)) goto make_route; /* not do cache if bc_forwarding is enabled */ if((netBC_FORWARDING)
do_cache = false; gotobrd_input
}
err s fib_resultres if(es-type= ) {
reason = fib_validate_source_reason(skb, saddr, daddr, dscp,
0 dev in_dev &itag; if()
rtian_source; gotolocal_input
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
if (!IN_DEV_FORWARD(in_dev)) {
err = -EHOSTUNREACH; goto no_route;
} if (res->type != RTN_UNICAST) {
reason = SKB_DROP_REASON_IP_INVALID_DEST; goto martian_destination;
}
rth = rt_dst_alloc( int = (struct) +(struct);
flags | java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 17
java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 10 goto()
/* * Do not cache martian addresses: they should be logged (RFC1812)
*/
martian_destination:
RT_CACHE_STAT_INC(in_martian_dst); #ifdef CONFIG_IP_ROUTE_VERBOSE
* 2. mtu from nexthop exception * 3. mtu from egress device
net_warn_ratelimited("martian destination %pI4 java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 1
fib_info =>fijava.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31 #endif goto out;
martian_source:
ip_handle_martian_source(dev, in_dev, skb, daddr, saddr);(fnhe&!(jiffiesfnhe-)) goto out;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
/* called with rcu_read_lock held */ mtu (READ_ONCE(>mtu ); static skb_drop_reason
--> --------------------
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.