freebsd-dev/sys/net
Ruslan Ermilov 36fea5de60 rn_walktree*() compute the next leaf before applying a function
to current leaves because function may vanish the current node.

If parent RTA_GENMASK route has a clone (a "cloning clone"), an
rn_walktree_from() starting from parent will cause another walk
starting from clone.  If a function is either rt_fixdelete() or
rt_fixchange(), this recursive walk may vanish the leaf that is
remembered by an outer walk (the "next leaf" above), panicing a
system when it resumes with an outer walk.

The following script paniced my single-user mode booted system:

: sysctl net.inet.ip.forwarding=1
: ipfw add 1 allow ip from any to any
: ifconfig lo0 127.1
: route add -net 10 -genmask 255.255.255.0 127.1
: telnet 10.1			# rt_fixchange() panic
: telnet 10.2
: telnet 10.1
: route delete -net 10		# rt_fixdelete() panic

For the time being, avoid these races by disallowing recursive
walks in rt_fixchange() and rt_fixdelete().

Also, make a slight optimization in the rtrequest(RTM_RESOLVE)
case: there is no reason to call rt_fixchange() in this case.

PR:		kern/37606
MFC after:	5 days
2002-12-23 13:12:41 +00:00
..
bpf_compat.h o Untangle the confusion with the malloc flags {M_WAITOK, M_NOWAIT} and 2002-12-19 22:58:27 +00:00
bpf_filter.c Turn on BPF_ALIGN for all non-i386 platforms, instead of having an 2002-07-05 00:06:08 +00:00
bpf.c correct function declarations of stubs used for building w/o device bpf 2002-11-19 02:50:46 +00:00
bpf.h o add support for multiple link types per interface (e.g. 802.11 and Ethernet) 2002-11-14 23:24:13 +00:00
bpfdesc.h o add support for multiple link types per interface (e.g. 802.11 and Ethernet) 2002-11-14 23:24:13 +00:00
bridge.c SMP locking for ifnet list. 2002-12-22 05:35:03 +00:00
bridge.h network interface and link layer changes: 2002-11-15 00:00:15 +00:00
bsd_comp.c Be consistent about functions being static. 2002-10-16 10:45:53 +00:00
ethernet.h general cleanups mostly aimed at improving portability of drivers 2002-11-14 23:28:47 +00:00
fddi.h network interface and link layer changes: 2002-11-15 00:00:15 +00:00
if_arc.h s/__attribute__((__packed__))/__packed/g 2002-09-23 06:25:08 +00:00
if_arcsubr.c network interface and link layer changes: 2002-11-15 00:00:15 +00:00
if_arp.h bring in ARP support for variable length link level addresses 2001-10-14 20:17:53 +00:00
if_atm.h Remove __P. 2002-03-19 21:54:18 +00:00
if_atmsubr.c network interface and link layer changes: 2002-11-15 00:00:15 +00:00
if_disc.c network interface and link layer changes: 2002-11-15 00:00:15 +00:00
if_dl.h Move ISO88025 source routing information into sockaddr_dl's sdl_data 2002-05-07 22:14:06 +00:00
if_ef.c SMP locking for ifnet list. 2002-12-22 05:35:03 +00:00
if_ethersubr.c o Untangle the confusion with the malloc flags {M_WAITOK, M_NOWAIT} and 2002-12-19 22:58:27 +00:00
if_faith.c network interface and link layer changes: 2002-11-15 00:00:15 +00:00
if_fddisubr.c network interface and link layer changes: 2002-11-15 00:00:15 +00:00
if_gif.c network interface and link layer changes: 2002-11-15 00:00:15 +00:00
if_gif.h - after gif_set_tunnel(), psrc/pdst may be null. set IFF_RUNNING accordingly. 2002-10-16 19:49:37 +00:00
if_gre.c network interface and link layer changes: 2002-11-15 00:00:15 +00:00
if_gre.h MFS: recognize gre packets used in the WCCP protocol. 2002-12-07 14:22:05 +00:00
if_ieee80211.h Add kernel print bits #define for the IEEE80211_CAPINFO bits. 2002-06-24 04:40:12 +00:00
if_iso88025subr.c Use if_printf(ifp, "blah") instead of 2002-10-21 02:51:56 +00:00
if_llc.h s/__attribute__((__packed__))/__packed/g 2002-09-23 06:25:08 +00:00
if_loop.c Under some circumstances, the loopback interface will allocate a new 2002-12-18 15:34:17 +00:00
if_media.c At long last, commit the zero copy sockets code. 2002-06-26 03:37:47 +00:00
if_media.h Add some additional 802.11 media definitions. 2002-07-14 21:58:19 +00:00
if_mib.c The interface index space may be sparsely populated (e.g. when an 2001-10-17 04:12:29 +00:00
if_mib.h
if_ppp.c network interface and link layer changes: 2002-11-15 00:00:15 +00:00
if_ppp.h
if_pppvar.h Make ppp(4) devices clonable and unloadable. 2002-08-09 15:30:48 +00:00
if_sl.c network interface and link layer changes: 2002-11-15 00:00:15 +00:00
if_slvar.h sc_lasttime and sc_starttime are time_t's, not long's. 2001-10-27 20:31:24 +00:00
if_sppp.h Implement an option to administratively disable the negotiation of 2001-12-30 20:42:29 +00:00
if_spppsubr.c Be consistent about functions being static. 2002-10-16 10:45:53 +00:00
if_stf.c network interface and link layer changes: 2002-11-15 00:00:15 +00:00
if_stf.h just merged cosmetic changes from KAME to ease sync between KAME and FreeBSD. 2002-04-19 04:46:24 +00:00
if_tap.c network interface and link layer changes: 2002-11-15 00:00:15 +00:00
if_tap.h
if_tapvar.h Add cloning support for the tap(4) device similar to that in the tun(4) 2001-09-05 01:06:21 +00:00
if_tun.c network interface and link layer changes: 2002-11-15 00:00:15 +00:00
if_tun.h
if_tunvar.h Support /dev/tun cloning. Ansify if_tun.c while I'm there. 2001-06-01 15:51:10 +00:00
if_types.h Add recently assigned interface types. 2001-04-04 14:18:57 +00:00
if_var.h SMP locking for ifnet list. 2002-12-22 05:35:03 +00:00
if_vlan_var.h o eliminate separate callback interface for h/w tagged input packets; instead 2002-11-14 23:43:16 +00:00
if_vlan.c o eliminate separate callback interface for h/w tagged input packets; instead 2002-11-14 23:43:16 +00:00
if.c SMP locking for ifnet list. 2002-12-22 05:35:03 +00:00
if.h o add IF_*bps macros for netbsd compatibility 2002-11-14 23:16:18 +00:00
intrq.c Initialise the intrq_present fields at runtime, not link time. This allows 2002-01-08 10:34:03 +00:00
intrq.h Remove __P. 2002-03-19 21:54:18 +00:00
iso88025.h use __packed/__aligned rather than GCC-specific __attribute__. 2002-09-23 06:35:33 +00:00
net_osdep.c just merged cosmetic changes from KAME to ease sync between KAME and FreeBSD. 2002-04-19 04:46:24 +00:00
net_osdep.h Lock up ifaddr reference counts. 2002-12-18 11:46:59 +00:00
netisr.c Moved netisr code from kern/kern_intr.c to net/netisr.c as threatened in a 2002-09-22 05:56:41 +00:00
netisr.h Slight whitespace cleanup. Whitespace sync to MAC tree. 2002-07-27 19:53:02 +00:00
pfil.c Remove __P. 2002-03-19 21:54:18 +00:00
pfil.h Fixed some style bugs in the removal of __P(()). The main ones were 2002-03-24 09:34:04 +00:00
pfkeyv2.h add definitions for RIPEMD-160 HMAC and Skipjack encryption algorithms, 2002-10-16 02:18:56 +00:00
ppp_comp.h Fixed some style bugs in the removal of __P(()). The main ones were 2002-03-24 09:34:04 +00:00
ppp_deflate.c Be consistent about functions being static. 2002-10-16 10:45:53 +00:00
ppp_defs.h Sync with recent KAME. 2001-06-11 12:39:29 +00:00
ppp_tty.c Use if_printf(ifp, "blah") instead of printf("ppp%d: blah", ifp->if_unit). 2002-10-21 03:41:58 +00:00
radix.c o Untangle the confusion with the malloc flags {M_WAITOK, M_NOWAIT} and 2002-12-19 22:58:27 +00:00
radix.h o Untangle the confusion with the malloc flags {M_WAITOK, M_NOWAIT} and 2002-12-19 22:58:27 +00:00
raw_cb.c o Untangle the confusion with the malloc flags {M_WAITOK, M_NOWAIT} and 2002-12-19 22:58:27 +00:00
raw_cb.h Remove __P. 2002-03-19 21:54:18 +00:00
raw_usrreq.c Back out some style changes. They are not urgent, 2002-11-20 19:00:54 +00:00
route.c rn_walktree*() compute the next leaf before applying a function 2002-12-23 13:12:41 +00:00
route.h Fixed some style bugs in the removal of __P(()). The main ones were 2002-03-24 09:34:04 +00:00
rtsock.c SMP locking for ifnet list. 2002-12-22 05:35:03 +00:00
slcompress.c Replace various spelling with FALLTHROUGH which is lint()able 2002-08-25 13:23:09 +00:00
slcompress.h Remove __P. 2002-03-19 21:54:18 +00:00
slip.h
zlib.c Fix instances of macros with improperly parenthasized arguments. 2002-11-09 12:55:07 +00:00
zlib.h Add one copy of crc32() and crc32_tab[] in libkern, and remove it two other 2002-05-29 20:24:09 +00:00