Re: Socket related stuff - patch available for testing

看板DFBSD_kernel作者時間16年前 (2009/11/12 12:32), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/11 (看更多)
Looks good Matt, Just my quick review, I didn't notice anything obvious, although patch is fairly large. Cheers, Edward. 2009/11/12 Matthew Dillon <dillon@apollo.backplane.com>: > =A0 =A0Here's a patch, it needs some serious testing: > > =A0 =A0 =A0 =A0fetch http://apollo.backplane.com/DFlyMisc/tcp01.patch > > =A0 =A0The patch: > > =A0 =A0 =A0 =A0* Moves the socket pointer into the netmsg base structure,= even > =A0 =A0 =A0 =A0 =A0though some things don't use it, I know > > =A0 =A0 =A0 =A0* Adds a lwkt_port pointer to the socket structure and ini= tializes > =A0 =A0 =A0 =A0 =A0it to cpu0_soport() > > =A0 =A0 =A0 =A0* Expects network protocols to set so->so_port in their at= tach > =A0 =A0 =A0 =A0 =A0functions, plus I do that for tcp and udp. > > =A0 =A0 =A0 =A0* Performs message chasing when the protocol port changes = due to > =A0 =A0 =A0 =A0 =A0e.g. =A0a connect() or an implied connect or (I think)= also an > =A0 =A0 =A0 =A0 =A0implied binding to INADDR_ANY. > > =A0 =A0 =A0 =A0 =A0If a number of messages for a socket have built up on = a protocol > =A0 =A0 =A0 =A0 =A0thread and some operation in the protocol changes the = socket's > =A0 =A0 =A0 =A0 =A0protocol thread (aka implied connect), then any other = messages > =A0 =A0 =A0 =A0 =A0queued to that protocol thread, or new messages which = race the > =A0 =A0 =A0 =A0 =A0change, will automatically be forwarded to the correct= protocol > =A0 =A0 =A0 =A0 =A0thread when they are encountered. > > =A0 =A0 =A0 =A0* Fixes implied connects for TCP. =A0This is when you use = sendmsg() > =A0 =A0 =A0 =A0 =A0with an address to imply a connect along with data, so= data can > =A0 =A0 =A0 =A0 =A0be sent along with the SYN. > > =A0 =A0 =A0 =A0 =A0Implied connects were completely broken and would cras= h the kernel. > =A0 =A0 =A0 =A0 =A0Example: =A0finger user@target =A0(instant crash). =A0= finger uses the > =A0 =A0 =A0 =A0 =A0implied connect feature. > > =A0 =A0 =A0 =A0* Cleans up a bunch of stuff. =A0I was almost able to remo= ve > =A0 =A0 =A0 =A0 =A0the proto->pr_mport field entirely but sendmsg() still= needs > =A0 =A0 =A0 =A0 =A0to use it in the case where the passed address is non-= NULL (aka > =A0 =A0 =A0 =A0 =A0sendto() style). =A0All other code that used to call p= roto->pr_mport() > =A0 =A0 =A0 =A0 =A0now simply snarf the port out of so->so_port. > > =A0 =A0 =A0 =A0 =A0The mport functions themselves now basically just retu= rn so_port. > =A0 =A0 =A0 =A0 =A0I left the sendmsg code intact just in case we wanted = to optimize > =A0 =A0 =A0 =A0 =A0it later on for UDP. > > =A0 =A0I found a few other bugs in the code but haven't fixed them yet. = =A0UDP > =A0 =A0is not MPSAFE due to the global inpcbinfo (udbinfo) structure it u= ses. > > =A0 =A0This patch does need testing. =A0I don't know what I might have bl= own up. > =A0 =A0It's fairly straight forward so I would also appreciate a code rev= iew. > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0-Matt > > --=20 --=20 Edward O'Callaghan http://www.auroraux.org/ eocallaghan at auroraux dot org
文章代碼(AID): #1A-u_4XO (DFBSD_kernel)
討論串 (同標題文章)
文章代碼(AID): #1A-u_4XO (DFBSD_kernel)