From owner-freebsd-net@FreeBSD.ORG Sun Apr 21 01:20:07 2013 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 8FEE37A4 for ; Sun, 21 Apr 2013 01:20:07 +0000 (UTC) (envelope-from laurie_jennings_1977@yahoo.com) Received: from nm36-vm3.bullet.mail.ne1.yahoo.com (nm36-vm3.bullet.mail.ne1.yahoo.com [98.138.229.115]) by mx1.freebsd.org (Postfix) with ESMTP id DDB871641 for ; Sun, 21 Apr 2013 01:20:06 +0000 (UTC) Received: from [98.138.90.51] by nm36.bullet.mail.ne1.yahoo.com with NNFMP; 21 Apr 2013 01:18:24 -0000 Received: from [98.138.88.239] by tm4.bullet.mail.ne1.yahoo.com with NNFMP; 21 Apr 2013 01:18:24 -0000 Received: from [127.0.0.1] by omp1039.mail.ne1.yahoo.com with NNFMP; 21 Apr 2013 01:18:24 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 549035.36514.bm@omp1039.mail.ne1.yahoo.com Received: (qmail 56725 invoked by uid 60001); 21 Apr 2013 01:18:24 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1366507104; bh=bb2KLYKRvaq26RTJZ6ZBWyGJBzuuD+f0mPHuYvR0dhg=; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:Message-ID:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=NOiawse8xOisP6FtrOmhkCRAR11FQKd6m8XvuzOHpAymwHI/ZRisfTu2wfqZtoSBlFuRn2xhLiEg5NU1EygM8LPYy0BRjt7Rw+NUQnmI8kgjiZEEjr3ilQMt3BYjIRnWTTSWAcQkaYe1UU9W/8I8AOOBk8I0k+8VxcOhL6del1o= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:Message-ID:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=sQqZMSxnvsPKjbrK/l4JVxyu+5HJTDuV/4T780qFkLN3WgGAZv9InUxuXl74AIsTAfS9q0vo/WJX91Ww8JwB+vNsfGtE792Y7y74hvZ3uSY27lMdvAUySxDoYY3pI1zCXIwgbDHt8gEnzj6zuyebFSRp1XFSU/two9CS0wMlrYY=; X-YMail-OSG: XQntZX4VM1l6hh9vACLO.VVhZLbbSmsezpJIXVKB1rle64l tk4V.BPr.OsXZB8jn4Qctg2u6nuBsojte6ZVMrauMQONxuu0pUXZXxLusQYe i0B_lTO5HlL0z1eKIPIFMCFSNy1qOvxMQ28MZGmAXAp4EnlQhHb_Saj17TM1 q29uqjcuGDgxKJ2gxcfygez5icNl1DE11EA4euBmm6O5N9FEbVSZjiLkS1A4 dMSRrl1Ldv.t7ORd7vYoV5PLEbP2eOR0Wn0j7FVcUpMXDyRGs4S8PGV07bl3 TwUTvA5gnkeon9uExUsxwz2TbtjYhFCZRB9x.PmdjKshAlI_xNUm3brJcY8D 59uNptkd8GFh33p2AXfhzY7ngdbPXqrxIBuWW6TLWvHAMaoAGwPYrSrPFclz D_xHgfKcPn1Fa2eD.0wRkY8BcPAWHTtd3EMwhnaCRONS0mmYxomntrHA2Ioq A1B1ryUG_O.NEp5TPaZcrR9J4FJ.BWixhDI5y Received: from [98.203.118.124] by web125804.mail.ne1.yahoo.com via HTTP; Sat, 20 Apr 2013 18:18:24 PDT X-Rocket-MIMEInfo: 002.001, VGhhdCBkb2VzIGhlbHAuIElzIHRoZXJlIGEgd2F5IGZvciB0aGUga2VybmVsIHRvIGFjY2VzcyB0aGUgbWVtb3J5IG1hcCBkaXJlY3RseWJ5IHNlZ21lbnQgbmFtZT8NCkxhdXJpZQ0KDQotLS0gT24gVGh1LCA0LzE4LzEzLCBKb2huIEJhbGR3aW4gPGpoYkBmcmVlYnNkLm9yZz4gd3JvdGU6DQoNCkZyb206IEpvaG4gQmFsZHdpbiA8amhiQGZyZWVic2Qub3JnPg0KU3ViamVjdDogUmU6IHNobV9tYXAgcXVlc3Rpb25zDQpUbzogZnJlZWJzZC1uZXRAZnJlZWJzZC5vcmcNCkNjOiAiTGF1cmllIEplbm5pbmdzIiABMAEBAQE- X-Mailer: YahooMailClassic/15.1.7 YahooMailWebService/0.8.141.536 Message-ID: <1366507104.55455.YahooMailClassic@web125804.mail.ne1.yahoo.com> Date: Sat, 20 Apr 2013 18:18:24 -0700 (PDT) From: Laurie Jennings Subject: Re: shm_map questions To: freebsd-net@freebsd.org, John Baldwin In-Reply-To: <201304180950.18349.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.14 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Apr 2013 01:20:07 -0000 That does help. Is there a way for the kernel to access the memory map dire= ctlyby segment name? Laurie --- On Thu, 4/18/13, John Baldwin wrote: From: John Baldwin Subject: Re: shm_map questions To: freebsd-net@freebsd.org Cc: "Laurie Jennings" Date: Thursday, April 18, 2013, 6:50 AM On Thursday, April 11, 2013 10:58:14 am Laurie Jennings wrote: > Im working on a simple project that shares a memory segment between a use= r=20 processand a kernel module. I'm having some problems with shm_map and there= =20 doesn't seem to be much info on it. > Im not sure what happened to the memory when the user process that create= s=20 it terminates.=A0 I have some questions. > 1) Does the kernel mapping keep the segment from being garbage collected= =20 when the use process that creates it terminated? I've experienced shm_unmap= ()=20 panic when tryingto unmap a segment > scenario:=A0=20 > User process Maps SegmentKernel maps it=A0 with shm_map()User Process=20 TerminatesKernel tries to shm_unmap() and it panics. The kernel mapping bumps the refcount on the underlying vm object, so it wi= ll not go away.=A0 OTOH, you should be keeping your own reference count on the associated fd so that you can call shm_unmap().=A0 That is, the model shoul= d be something like: struct mydata *foo; foo->fp =3D fget(fd); shm_map(fp, &foo->p); /* Don't call fdrop */ and then when unmapping: struct mydata *foo; shm_unmap(foo->fp, foo->p); fdrop(foo->fp); > 2) Is there a way for the kernel process to know when the user process ha= s=20 goneaway? A ref count? You can install a process_exit EVENTHANDLER if you want to destroy this whe= n a process goes away.=A0 I have used shm_map/unmap for other objects that alre= ady had a reference count so I did my shm_unmap when that object was destroyed. > 3) Does a SHM_ANON segment persist as long as the kernel has it mapped, o= r=20 doesit get garbage collected when the creating user process terminates? It goes away when the backing 'struct file' goes away.=A0 If you follow the= =20 model above of keeping a reference count on the associated struct file then it won't go away until you fdrop() after the shm_unmap. > 4) When using a named segment, can the kernel "reuse" a mapping for a new= =20 userprocess? > Example: > User process creates shm segment with path /fooKernel Maps shm segment wi= th=20 shm_map()User process terminates.User process runs again, opening segment /= foo > Does the kernel need to re-map, or is the original mapping valid? The mapping is not per-process, so if you have mapped a shm for /foo and mapped it, it will stay mapped until you call shm_unmap.=A0 Multiple proces= ses can shm_open /foo and mmap it and they will all share the same memory. You could even share a SHM_ANON fd among multiple processes by passing it across a UNIX domain socket. Hope this helps. --=20 John Baldwin _______________________________________________ freebsd-net@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-net To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" From owner-freebsd-net@FreeBSD.ORG Sun Apr 21 03:41:56 2013 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id CAD06E36 for ; Sun, 21 Apr 2013 03:41:56 +0000 (UTC) (envelope-from karl@denninger.net) Received: from fs.denninger.net (wsip-70-169-168-7.pn.at.cox.net [70.169.168.7]) by mx1.freebsd.org (Postfix) with ESMTP id 764B21DD for ; Sun, 21 Apr 2013 03:41:55 +0000 (UTC) Received: from [192.168.1.40] (localhost [127.0.0.1]) by fs.denninger.net (8.14.6/8.13.1) with ESMTP id r3L2aFX0084747 for ; Sat, 20 Apr 2013 21:36:16 -0500 (CDT) (envelope-from karl@denninger.net) Received: from [192.168.1.40] (TLS/SSL) [192.168.1.40] by Spamblock-sys (LOCAL/AUTH); Sat Apr 20 21:36:16 2013 Message-ID: <5173509A.905@denninger.net> Date: Sat, 20 Apr 2013 21:36:10 -0500 From: Karl Denninger User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130215 Thunderbird/17.0.3 MIME-Version: 1.0 To: Steven Hartland Subject: Re: Odd NAT/IPSEC question -- help! :-) References: <517333A8.7020704@denninger.net> <394C5F1CA58741F9965A5782A1117153@multiplay.co.uk> In-Reply-To: <394C5F1CA58741F9965A5782A1117153@multiplay.co.uk> X-Enigmail-Version: 1.5.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: freebsd-net@freebsd.org X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Apr 2013 03:41:56 -0000 I don't think so -- gre is not involved in the config. On 4/20/2013 7:59 PM, Steven Hartland wrote: > ----- Original Message ----- From: "Karl Denninger" > ... >> My "ordinary" NAT entry is simply "nat 1 ip from any to any via em1", >> which works fine for ordinary "on the client" traffic; no problems with >> that. > ... > > Just a stab in the dark, as I vaguely remember something similar, do you > also need to configure your nat for gre as well as ip? > > Regards > Steve > > > ================================================ > This e.mail is private and confidential between Multiplay (UK) Ltd. > and the person or entity to whom it is addressed. In the event of > misdirection, the recipient is prohibited from using, copying, > printing or otherwise disseminating it or any information contained in > it. > In the event of misdirection, illegible or incomplete transmission > please telephone +44 845 868 1337 > or return the E.mail to postmaster@multiplay.co.uk. > > > > %SPAMBLOCK-SYS: Matched [+killing@multiplay.co.uk], message ok -- -- Karl Denninger /The Market Ticker ®/ Cuda Systems LLC