Net / IPv4 / route.c
Author: Elvis
table of Contents
Introducing the background of Route.c
ROUTING process
Related information structure
Route.c related function detailed
Introducing the background of Route.c LINUX with two mechanisms in setting Route, one is FIB, one is the routing generated by Dynamic
FIB is Route
(Man 8 Route) Specify static Route Table
The NET / IPv4 / Route.c is made to generate ROUTING HASH to speed up the speed of Route Decision.
example:
Static Route Table # route -f kernel ip routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.3 * 255.255.255.255 UH 0 0 0 Eth0
140.123.103.156 * 255.255.255.255 UH 0 0 0 Eth1
192.168.1.0 * 255.255.255.0 U 0 0 0 Eth0
140.123.0.0 * 255.255.0.0 U 0 0 0 Eth1
127.0.0.0 * 255.0.0.0 U 0 0 0 LO
DEFAULT CSIE-C5505 0.0.0.0 UG 0 0 0 Eth1
Dynamic Route Table # route -c kernel ip routing cache
Source Destination Gateway Flags Metric Ref USE IFACE
Infomedia.cs.cc 140.123.103.255 140.123.103.255 ri 0 6 0 Eth1
CSIE-C5505 NOT-A-Legal-Add Not-A-Legal-Add IBL 0 796989 0 LO
Fish.cs.ccu.edu 140.123.103.255 140.123.103.255 ri 0 2 0 Eth1
Didi.cs.ccu.edu 140.123.103.255 140.123.103.255 ri 0 31 0 Eth1
Lena.cs.ccu.edu 140.123.103.255 140.123.103.255 ri 0 2438 0 Eth1
Filter.cs.ccu.e 140.123.103.255 140.123.103.255 ri 0 265 0 Eth1
CSIE-C5505 All-Systems.MCA All-Systems.MCA ML 0 7273 0 LO
Vivi.cs.ccu.edu 140.123.103.255 140.123.103.255 ri 0 7 0 Eth1
Gigi.cs.ccu.edu 140.123.103.255 140.123.103.255 ri 0 3 0 Eth1
Scoap.cs.ccu.ed 140.123.103.255 140.123.103.255 ri 0 12 0 Eth1bist.cs.ccu.edu 140.123.103.255 140.123.103.255 RI 0 86 0 Eth1
MacGyver.cs.ccu 140.123.103.255 140.123.103.255 ri 0 11 0 Eth1
Reference:
RFC 1122 is here for IP Layer Routing Here
TABLE
ROUTING process
A SKB wants to decide the path (INPUT)
Will call such as ip_route_input (SKB, ...); to determine his RTABLE
Process is probably
1.ip_route_input to see if there is any existing RTABLE
2. Call IP_ROUTE_INPUT_SLOW Generate RTABLE
3.IP_ROUTE_INPUT_SLOW Call FIB_LOOKUP
4. Fib_lookup finds FIB_RULE from FIB_RULES
5.FIB_lookup call FIB_GET_TABLE to get FIB_TABLE
6.FIB_lookup uses FIB_TABLE Call TB-> TB_LOOKUP to get FIB_RESULT
7.FIB_lookup Sets FIB_RULE to FIB_RESULT
8.IP_ROUTE_INPUT_SLOW to set RTABLE using rt_intern_hash
9. Return IP_ROUTE_INPUT At this time, SKB has set up RTABLE and an Input / Output method.
10. Return to the original call
11. Original calls DST-> INPUT () processing
Route initialization Route flowchart Replenors SKB Process Send SKB Process
TABLE
Related information structure
/ * Ipv4 routing cache flags * /
#define RTCF_DEAD RTNH_F_DEAD
#define rtcf_onlink RTNH_F_ONLINK
/ * Obsolete flag. About to be deleted * /
#define rtcf_nopmtudisc RTM_F_NOPMTUDISC
#define RTCF_Notify 0x00010000
#define RTCF_Directdst 0x00020000
#define RTCF_Redirected 0x00040000
#define rtcf_tproxy 0x00080000
#define RTCF_FAST 0x00200000
#define RTCF_MASQ 0x00400000
#define rtcf_snat 0x00800000
#define rtcf_doredirect 0x01000000
#define rtcf_directsrc 0x04000000
#define rtcf_dnat 0x08000000
#define rtcf_broadcast 0x10000000
#define RTCF_Multicast 0x20000000
#define rtcf_reject 0x40000000
#define rtcf_local 0x80000000
#define rtcf_nat (RTCF_DNAT | RTCF_SNAT)
Routing Type
ENUM
{
RTN_UNSPEC,
RTN_UNICAST, / * GATEWAY or DIRECT ROUTE * /
RTN_LOCAL, / * accept locally * /
RTN_Broadcast, / * Accept Locally as Broadcast,
Send as Broadcast * /
RTN_Anycast, / * accept locally as Broadcast, But send as unicast * /
RTN_MULTICAST, / * MULTICAST ROUTE * /
RTN_BLACKHOLE, / * DROP * /
RTN_UNREACHABLE, / * DESTINATION IS unreachable * /
RTN_PROHIBIT, / * Administratively Prohibited * /
RTN_THROW, / * NOT IN THIS TABLE * /
RTN_NAT, / * Translate this Address * /
RTN_XRESOLVE, / * USE EXTERNAL resolver * /
}
SCOPE value
ENUM RT_SCOPE_T
{
Rt_scope_universe = 0,
/ * User defined values * /
RT_SCOPE_SITE = 200,
RT_SCOPE_LINK = 253,
RT_SCOPE_HOST = 254,
RT_SCOPE_NOWHERE = 255
}
● Used to query the key value of the FIB TABLE
Struct RT_Key @ include / net / route.h
{
__U32 DST; Destination IP address
__U32 SRC; Source IP Address
INT IIF; Input Interface
Int Oif; Output Interface
__U8 TOS; TYPE OF SERVICE
__U8 scope; unknown
}
● Route Table the most important structure
Some macro to determine the location
#define loopback (x) ((x) & htonl (0xff000000)) == HTONL (0x7f000000))
127.0.0.0/255.0.0.0 Loopback
#define multicast (x) ((x) & HTONL (0xf0000000)) == HTONL (0xE0000000))
Class D
At the beginning of 1110
#define badclass (x) ((x) & htonl (0xf0000000)) == HTONL (0xf0000000))
Class E retains the segment, should not be used
At the beginning of 11110
#define zeronet (x) ((x) & htonl (0xff000000)) == HTONL (0x00000000)))
Class A and Netid is 0000000 (seven 0)
#define local_mcast (x) (((x) & HTONL (0xffffff00)) == HTONL (0xe0000000))
Class D MultiCast IP
And only the smallest 8bit
Struct RTable @ include / net / route.h
{
union
{
Struct DST_ENTRY DST;
Struct RTable * RT_Next;
} u;
Unsigned RT_Flags; RTCF_Multicast, Flag
Unsigned RT_TYPE; RTN_UNICAST, which is used to indicate which type of this route rule is
__U32 RT_DST; / * PATH DESTINATION * /
__U32 rt_src; / * path source * /
INT RT_IIF; incoming interface
/ * Info on neighbour * /
__U32 rt_gateeway;
/ * Cache lookup keys * / struct rt_Key Key;
/ * Miscellaneous Cached Information * /
__U32 RT_SPEC_DST; / * RFC122 Specific Destination * /
The structure of INET_PEER is an avl tree to record the information of each peer.
Detailed import in inetpeer.h and inetpeer.c
Struct inet_peer * peer; / * long-limited peer info * /
}
● The structure used by RT_Hash_Table
Struct RT_Hash_Bucket {@ Net / IPv4 / Route.c
Struct RTable * chain
RWLOCK_T LOCK; Lock State
} __ATtribute __ (__ aligned __ (8)))))
● Route Table The main operation structure, configure space in IP_RT_INIT and initialize
Route Rules is stringing according to Hash, where RT_HASH_TABLE [HASH] is a string
Static struct rt_hash_bucket * rt_haash_table;
TABLE
Route.c related function detailed
rt_hash_code rt_cache_get_info rt_cache_stat_get_info rt_free rt_drop rt_fast_clean rt_valuable rt_may_expire rt_check_expire rt_run_flush rt_cache_flush rt_garbage_collect rt_intern_hash rt_bind_peer ip_select_fb_ident __ip_select_ident rt_del ip_rt_redirect ipv4_negative_advice ip_rt_send_redirect ip_error guess_mtu ip_rt_frag_needed ip_rt_update_pmtu ipv4_dst_check ipv4_dst_reroute ipv4_dst_destroy ipv4_link_failure ip_rt_bug ip_rt_get_source rt_set_nexthop ip_route_input_mc ip_route_input_slow ip_route_input ip_route_output_slow ip_route_output_key ip_rt_multicast_event ip_rt_init
Static __inline__ unsigned
RT_HASH_CODE (U32 Daddr, U32 Saddr, U8 TOS)
Function: Generate HASH value parameters: Address and Service Type Back to: HASH Value Description: RT_HASH_TABLE [Hash] Static Int
RT_Cache_GET_INFO (Char * Buffer, Char ** Start, Off_T Offset, Int Length)
Function: Funct INT for Proc FS
RT_CACHE_STAT_GET_INFO (Char * Buffer, Char ** Start, Off_T Offset, Int Length)
Function: Give the PROC FS STATIC __INLINE__VOID
RT_Free (struct RTable * RT)
Function: Release RTABLE-> DST parameters: RTable Recycling: None Description: DST_FREE ((& RT-> u.dst) static __inline__void
RT_DROP (Struct RTable * RT)
Function: Discard RTABLE Parameters: RTABLE Return: None Description:
IP_RT_PUT (); // DST_RELEASE (RT) Reduces the number of times DST_FREE ((& RT-> u.dst) static __inline__ int
RT_FAST_CLEAN (Struct RTable * RTH)
Function: Check is Broadcast / Multicast Description: Broadcast / multicast's RTABLE should be given up Static __inline__ int
RT_VALUABLE (Struct RTable * RTH)
Function: Check is redirect / notify rtable static __inline__ int
RT_MAY_EXPIRE (Struct RTable * Rth, Int TMO1, INT TMO2)
Function: Check if RTABLE expires should be discarded: TMO1, TMO2 (TMO2> TMO1, TMO2 HARDER THAN TMO1) Recycling: Has expired description:
349: Also in use (__refcnt is not 0), return whether there is 353: This RTABLE is reached, the return is 359: age = The time used in the last time, if the age <= tmo1 is not belonging to Broadcast or Multicast RTABLE returns to whether Broadcast / Multicast's RTABLE (RT_FAST_CLEAN) if Age <= TMO2 and RTABLE are REDIRECTED or NOTIFY, although it has exceeded TMO1, whether it is also back, whether it is (more important) (using RT_VALUABLE) 362: Preset is Expire static void Smp_timer_name
RT_CHECK_EXPIRE) (unsigned long dummy)
Function: Forced RT_FREE drop RT_HASH_TABLE [] CHAIN EXPIRE ENTRIES Description: This function is Timer's Timer Function to call STATIC VOID SMP_TIMER_NAME per IP_RT_GC_INTERVAL (
RT_RUN_FLUSH) (unsigned long dummy)
Features:
Clear all RTable RT_Flush_Timer Timer Functional Functional Functional Functionalso Called By RT_Cache_Flush () Description: RTABLE RT_FREE in RT_HASH_TABLE [] is sequentially
RT_Cache_Flush (int ")
Function: DELAY Several Jiffies After Call RT_Flush_timer () Description:
449: Remove RT_FLUSH_TIMER, repeated DELAY 472: RT_DEADLINE 475: Plus RT_FLUSH_TIMER The first RT_FLUSH_TIMER is hanging here Note: DELAY is not 0, how to call rt_run_flush (), it seems to use only 0, -1 Call Static Int
RT_GARBAGE_COLLECT (VOID)
Function: Maintain routing cache dynamically adjusts the effective time of the Routing Cache to generate / expire the RTABLE rate.
506: Check the last execution time, Garbage Collection does not need to be too often do it (very expensive) (Too small time is too small or there is not enough things, do not do) 511-527: Computing now to clear the expiration RTABLE Number 529: Record the time of this Garbage Collection 537-585: Start Garbage Collection
540-559: ROVER 541: RT_MAY_EXPIRE Check if Expires are used to halve TMO to increase the cost of EXPIRE ENTRIES (because it is possible because traffic is too high, you need to make fast Expire 583: To clear the maximum of RTABLE, you don't need to do it 577: expire >> = 1 If traffic is too high, it is possible to make a Hash chain to reduce the size of the EXPIRE to limit the size of the Routing Cache 585: Call from Interrupt This Function has only ran over and enforces 589: Net_RATELIMIT () Limits the rate of Garbage Collection 594: Re-set Expire Static Int
Rt_intern_hash (unsigned hash, struct RTable * RT, Struct RTable ** rp)
Function: Add RTABLE to CHAIN:
616: From RT_Hash_Table [Hash] to find the same key's RTABLE use 1 and turn the incoming RT RT_DROP 638: Can't find the existing RTable, if the RTable Type is Unicast Forwarding Path or the Output Route generates a DST - arp_bind_neighbour () to bind arp when output route or unicast forward, because it is out of 653: arp_bind_neighbour failed to do rt_garbage_collect to narrow route table and then re-executed once again 670: the rtable newly generated hang rt_hash_table [hash] .chain void
RT_BIND_PEER (Struct RTable * RT, INT CREATE)
Function: Create RT-> Peer Description:
692: inet_getpeer (); definition in NET / IPv4 / INETPEER.C 700: If there is already RT-> Peer, take the generated peer (inet_putpeer ()) Note: peer is points (each IPv4 addess) information Static void
IP_SELECT_FB_IDENT (Struct iPhDR * iPh)
Function: Force Generation IP ID Description: Only in __ip_select_ident fails to execute this function to Johnson Random's IP ID original annotation: / ** Peer Allocation May Fail Only In Serious Out-of-Memory Conditions. HOWEVER * WE STILL can generate some output. * Random ID selection looks a bit dangerous because we have no chances to * select ID being unique in a reasonable period of time. * But broken packet identifier may be better than no packet at all. * / void__ip_select_ident (struct iPhdr * iPh, Struct DST_ENTRY * DST)
Function Description:
730: RT_BIND_PEER 735: RT_BIND_PEER Success or RT-> Peer Or INET_GETID () gives IP ID 742: RT_BIND_PEER FAILIP_SELECT_FB_IDENT () static void
RT_DEL (unsigned hash, struct RTable * RT)
Function: Remove the RTABLE parameters in the specified HASH: Hash, RTable Recycling: Description: Find the RT_HASH_TABLE [Hash] to find it Void, RT_Free ()
IP_RT_REDIRECT (U32 OLD_GW, U32 Daddr, U32 New_GW, U32 Saddr, U8 TOS, STRUCT NET_DEVICE * DEV)
Function: redirect, set new RTABLE instructions: Find the original RTABLE, modify the original information to change the information to change to the transfer to change, remove the original RTABLE: NET / IPv4 / ICMP.c icmp_redirect () Static Struct DST_ENTRY *
IPv4_negative_advice (Struct DST_ENTRY * DST)
Function: Processing DST Description:
891: OBSOLETE, IP_RT_PUT () IT 894: RT_DEL off the DST or EXPIRE
IP_RT_SEND_REDIRECT (Struct Sk_buff * SKB)
Function: Transfer SKB Description: Called by ip_forward ()
942: After IP_RT_REDIRECT_SILENCE long time did not transfer SKB RESET Status 948: Too many redirect packets, ignored (assuming Host ignored our Redirect packet, ip_forward () has to help him send -_- ") last time_last set to Time 956: Check Load 958: Transfer ICMP Packet Static Int
IP_ERROR (Struct SK_Buff * SKB)
Function: Check RT-> u.dst.error and then use ICMP_send () to send a corresponding error message description: 1001: The last time IP_ERROR () is too short, no static __inline__ unsigned Short
Guess_mtu (unsigned short old_mtu) identifying the MTU value of less than and closest to Old_mut from MTU_PLATEAU [] is 68 unsigned short
IP_RT_FRAG_NEEDED (STRUCT IPHDR * iPH, Unsigned Short new_mtu)
Function: Unpacking the package, you need to recalculate the MTU description:
1045: Find this ipheader RTABLE 1056-1079: Calculating new MTU VoID
IP_RT_UPDATE_PMTU (STRUCT DST_ENTRY * DST, UNSIGNED MTU)
Function: Set new MTU description:
1096: Set DST Effective Time DST_SET_EXPIRES () Defines in include / net / dst.h static struct dst_entry *
IPv4_dst_check (Struct DST_ENTRY * DST, U32 cookie)
Function: Usage Unknown Description: IPv4_DST_OPS CHECK FUNTIONRELEASE passes DST // DST_RELEASE (); Static Struct DST_ENTRY *
IPV4_DST_REROUTE (Struct DST_ENTRY * DST, STRUCT SK_BUFF * SKB)
Function: Usage Unknown Description: IPv4_dst_ops REROUTE FUNCTION NOTE: Linux at 2.2 / 2.4 Kernel does not realize it Static Void
IPv4_DST_DESTROY (STRUCT DST_ENTRY * DST)
Function: Recycle DST peer description:
1118: RT-> peer = null; 1119: inet_putpeer (peer); definition in include / net / inetpeer.h will put RT-> Peer in Unused List Static Void
IPv4_link_failure (struct SK_Buff * SKB)
Function: Use ICMP to inform the location where the address is unable to connect: SKB Description:
1127: Send the address of ICMP notification to the site unable to connect 1130: Set this path immediately failed (Expire Time == 0) static int int
IP_RT_BUG (STRUCT SK_BUFF * SKB)
Function: Output SKB information, and kfree_skb () ip_route_input_mc () specifies output function (rth-> u.dst.output = IP_RT_BUG;) VOID
IP_RT_GET_SOURCE (U8 * Addr, Struct RTable * RT)
Function: Source Address, which interface is out, IP address is set to it: because there is no cache outgoing route Source Address so use this function
1157: IIF == 0, directly specify RT-> RT_SRC to him 1159: Find 1169 from FIB 1169: Use inet_select_addr () to find Static Void
RT_SET_NEXTHOP (Struct RTable * RT, STRUCT FIB_RESULT * RES, U32 ITAG)
Function: According to FIB_RESULT information, the next hop information intip_route_input (Struct Sk_buff * SKB, U32 Daddr, U32 Saddr, U8 TOS, STRUCT NET_DEVICE * DEV)
Function: Use RT_Key to find out the rtable description:
1633-1655: Find the RTABLE (OIF == 0) 1505: actually generate rt_intern_hash () actually generate rt_intern_hash () does not check TOS (because TOS is different ..rt_hash_code () will not be the same) 1668- 1686: If it is multicast address, IP_ROUTE_INPUT_MC () is called in the demiicast list of DEV to generate Entry 1687: not Multicast, did not find the Entry used IP_ROUTE_INPUT_SLOW () new Entry Note: Called By
net / ipv4 / arp.carp_rcv () net / ipv4 / ipip.cipip_err () net / ipv4 / ip_gre.cipgre_err () net / ipv4 / ip_input.cip_rcv_finish () net / ipv4 / ip_options.cip_options_rcv_srr () net / ipv4 / netfilter /ip_fw_compat.cfw_in()int
IP_ROUTE_INPUT_SLOW (Struct Sk_buff * SKB, U32 Daddr, U32 Saddr, U8 TOS, STRUCT NET_DEVICE * DEV)
Function: Determine the skb of SKB from the outside:
Front work
1336-1346: Initializing Key, calculating HASH
key.dstdaddrkey.srcsaddrkey.tostoskey.iifdev-> ifindexkey.oif0 no output devkey.scopeRT_SCOPE_UNIVERSE1352: Check saddr, is not multicast (class D address), badclass (class E address), loopback address 1355-1365: addition of zeronet 0xffffffff Saddr is Bad Source1355: If Broadcast (Daddr is 0xffffffffff or Saddr / Daddr is 0x0), jump to BRD_INPUT processing, these are Broadcast 1364: Check Daddr, not for Badclass (Class E Address), Zeronet, Loopback 1370: FIB_LOOKUP Find the Res (Result) 1404 based on the key value: for the Broadcast Type Brd_input 1407: Route generated for LOCAL TYPE
I ‧ip_forward () average Route Table (required to transfer)
1437: fib_validate_source Check the source is correct, not broadcast or our local address to determine spec_dst 1445: flags plus RTCF_DOREDIRECT representation is not the best path, redirect host 1458: dst_alloc () a new route table1462-1491: fill in the route table data
out_devin_dev_get (FIB_RES_DEV (res)) spec_dstfib_validate_source () flags | = RTCF_DIRECTSRCif fib_validate_source errflags | = RTCF_DOREDIRECTSRCif the notification transfer rth-> u.dst .__ refcnt1rth-> key.dstdaddrrth-> rt_dstdaddrrth-> key.tostosrth-> key.srcsaddrrth-> rt_srcsaddrrth-> rt_gatewaydaddrrth-> rt_iifdev-> ifindexrth-> key.iifdev-> ifindexrth-> u.dst.devout_dev-> devrth-> u.dst.dev.refcnt key.oif0rth- rth->> rt_spec_dstspec_dstrth-> u.dst.inputip_forwardRTH-> u.dst.outputip_outputrt-> RT_FLAGSFLAGS1485: DST.Input = ip_forward1505: actually generate RT_intern_hash () IIIP_LOCAL_DELIVER () Broadcast Route Table
Set Type / Flags Check Saddr, because notward is required
spec_dstinet_select_addr (dev, 0, RT_SCOPE_LINK) if ZERONETspec_dstfib_validate_source (saddr, 0, tos, 0, dev, & spec_dst, & itag) if not ZERONETflags | = RTCF_DIRECTSRCif fib_validate_source errflags | = RTCF_BROADCASTres.typeRTN_BROADCAST use local input route table part of the code to generate a route table Profile Local Input Route Table
1409: FIB_VALID_SOURCE () 1414: if (result) Flags plus RTCF_DirectSRC Configuring Route Table and filling into information
rth-> u.dst.outputip_rt_bugip_rt_bug () rth-> u.dst .__ refcnt1rth-> key.dstdaddrrth-> rt_dstdaddrrth-> key.tostosrth-> key.srcsaddrrth-> rt_srcsaddrrth-> rt_iifdev-> ifindexrth-> key.iifdev -> ifindexrth-> u.dst.dev & loopback_devrth-> u.dst.dev-> refcnf rth-> key.oif0rth-> rt_gatewaydaddrrth-> rt_spec_dstspec_dst = daddrrth-> u.dst.inputip_local_deliverip_local_deliver () rth-> rt_flags | = RTCF_LOCALRTH-> RT_RYPERES.TYPE if res.type == rtn_unreachable
Rth-> u.dst.inputip_ERRORIP_ERRORRRTH-> u.dst.error-errrth-> rt_flags & = ~ RTCF_LOCAL put the just set off 1563: INPUT normal words for IP_LOCAL_DELIVER () Top 1566: Unreachable is IP_ERROR () Process 1505: actually generate RT_Intern_hash () III 200no routeroute type = unreachable the DO III qocal_input static int int
IP_ROUTE_INPUT_MC (Struct Sk_buff * SKB, U32 Daddr, U32 Saddr, U8 TOS, STRUCT NET_DEVICE * DEV, INT OUR)
Function: INPUT RTABLE instructions generated by MultiCast Address:
1238-1248: Check the correctness of Saddr / Daddr 1250-1285: Fill in information, if in Device's multicast list, the input function is ip_local_deliver () 1294: rt_intern_hash () int
IP_ROUTE_OUTPUT_KEY (Struct RTable ** RP, Const Struct RT_Key * Key)
Function: Use RT_Key to find output RTABLE parameters: RTABLE instructions:
1993-2017: Looking in RT_HASH_TABLE [] RTABLE 2019: Can't find it, use ip_route_output_slow () to generate Entry
Note: 2.2 version of the relative function is ip_route_output () (struct RTable ** RP, Const Struct RT_Key * Key)
Function: Use RT_Key to find output RTABLE parameters: RTABLE instructions:
1993-2017: Looking in RT_HASH_TABLE [] RTABLE 2019: Can't find it, use ip_route_output_slow () to generate Entry Note: 2.2 version of the relative function for IP_ROUTE_OUTPUT () INT
IP_ROUTE_OUTPUT_SLOW (Struct RTable ** RP, Const Struct RT_Key * Oldkey)
Function: Produces Output Routing Cache / RTABLE instructions:
1722: IF (Oldkey-GTSRC)
1724: Check Oldkey-> SRC address (multicast / badclass / zeronet return error) 1730: Using SRC to find the first device ip_frontend () net / ipv4 / fib_frontend.c 1742-1761: oldkey-> OIF == 0 and Oldkey-> DST is multicast or 0xffffffffkey.Oif = dev_out-> ifindex, direct Make Route 1762-1764: After the check is finished, DEV_OUT does not need 1766-1790: if (Oldkey-> OIF) according to Oldkey-> DST type finds the key.src 1792-1804: No key.dst, set to loopback, make route 1806: if (Fib_lookup ()) if (find Fib Entry) There is Oldkey-> OIF, then type = unicast, no After Gateway Make_route, Error 1843-1856: Loopback, set DEV, OIF Make Route 1863-1873: All the above is not in line with, preset data setting
1864: fib_select_default () 1867: FIB_RES_PREFSRC () include / net / ip_fib.h # define FIB_RES_PREFSRC (res) ((res) .fi-> fib_prefsrc:? __Fib_res_prefsrc (& res)) 1869: canceled previously identified dev_outdev_out = FIB_RES_DEVinlcude / Net / ip_fib.h # define fib_res_dev (res) (FIB_RES_NH (RES) .NH_DEV) 1872: dev_hold () dev_out-> refcnt 1875: make_route:
1876: No loopback src address error 1879-1884: According to DST location type set res.typeno badclass / zeronet dst address error 1889-1894: Handling BroadcastFIB_INFO_PUT () include / net / ip_fib.h fi is not used, don't know To Broadcast, DEC Fi 1912-1965: Configure DST and fill in RTH / RTH-> DST Information 1967: RT_SET_NEXTHOP 1972: RT_INTERN_HASH VOID
IP_RT_MULTICAST_EVENT (STRUCT IN_DEVICE * IN_DEV)
Function: Cachecalled by Net / IPv4 / IGMP.c # 451 ip_mc_inc_group () # 471 ip_mc_dec_group () # 775 ip_mroute_setsockopt () Parameters: in_Device Recycling: Description:
2230: Force RT_Cache_Flush (0); Clear Routing Table Cache No Delayvoid __init
IP_RT_INIT (VOID)
Function: Kernel initial function parameters: back: Description: Initialization process 2474: kmem_cache_create () established kernel cache for ip dst cache 2482-2497: Configuring RT_HASH_TABLE Memory 2506: RT_HASH_TABLE INITIAL 2512, 2513: Initialization ipv4_dst_ops.gc_thresh ip_rt_max_size 2515: devinet_init (); 2516: ip_fib_init (); 2517: rt_flush_timer although declared, but also specify the timer function has never been initialized only in first call over rt_cache_flush () will really be after the start 2519-2526: add_timer (& rt_periodic_timer); Timer Function is rt_check_expire 2528,2529: Proc FS related information
TABLE
problem
Rtcf_directsrc doesn't know what
Unique place
ICMP.C ICMP_ADDRESS_REPLY ()
IF (SKB-> Len <4 ||! (RT-> RT_FLAGS & RTCF_DIRECTSRC))
Return;