From owner-freebsd-net Sun Jan 27 23:31:35 2002 Delivered-To: freebsd-net@freebsd.org Received: from mta7.pltn13.pbi.net (mta7.pltn13.pbi.net [64.164.98.8]) by hub.freebsd.org (Postfix) with ESMTP id 9B36B37B426 for ; Sun, 27 Jan 2002 23:31:20 -0800 (PST) Received: from elischer.org ([64.164.10.232]) by mta7.pltn13.pbi.net (iPlanet Messaging Server 5.1 (built May 7 2001)) with ESMTP id <0GQN00DX10W70G@mta7.pltn13.pbi.net> for freebsd-net@FreeBSD.ORG; Sun, 27 Jan 2002 23:31:20 -0800 (PST) Date: Sun, 27 Jan 2002 23:31:20 -0800 From: Julian Elischer Subject: Re: netgraph: how to setsockopt on ksocket node ? To: Florent Parent Cc: Archie Cobbs , freebsd-net@FreeBSD.ORG Message-id: <3C54FE47.81C90C55@elischer.org> MIME-version: 1.0 X-Mailer: Mozilla 4.7 [en] (X11; U; FreeBSD 5.0-CURRENT i386) Content-type: text/plain; charset=iso-8859-2 Content-transfer-encoding: 8BIT X-Accept-Language: en, hu References: <200201190530.g0J5U0T27493@arch20m.dellroad.org> <5390000.1011459455@blues.viagenie.qc.ca> Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Archie do you want to check this in, or shall I? Florent Parent wrote: > > --On 2002-01-18 21:30:00 -0800 archie@dellroad.org wrote: > >> netgraph: sendto(.dummy): Bad address > > > > Hmm.. I wonder if the problem is that this has never worked :-) > > That would explain why I couldn't find any examples on using this ;-) > > > That is, maybe setsockopt() is expecting the value pointer to point > > into user memory, while ng_ksocket is using a pointer that points > > into kernel memory? > > > > In which case, I don't know how to go about fixing it.. Julian? > > This is what I did to make it work for me. A better fix would probably be > around the struct proc definition. If fact, you had noted "broken" > probably as a memo to fix something here... > > struct proc *p = curproc ? curproc : &proc0; /* XXX broken */ > > *** ng_ksocket.c.orig Sat Jan 19 11:05:28 2002 > --- ng_ksocket.c Sat Jan 19 11:45:23 2002 > *************** > *** 759,765 **** > sopt.sopt_name = ksopt->name; > sopt.sopt_val = ksopt->value; > sopt.sopt_valsize = valsize; > ! sopt.sopt_p = p; > error = sosetopt(so, &sopt); > break; > } > --- 759,765 ---- > sopt.sopt_name = ksopt->name; > sopt.sopt_val = ksopt->value; > sopt.sopt_valsize = valsize; > ! sopt.sopt_p = 0; > error = sosetopt(so, &sopt); > break; > } > > Florent. > -- > Florent Parent > Viagénie http://www.viagenie.qc.ca -- +------------------------------------+ ______ _ __ | __--_|\ Julian Elischer | \ U \/ / hard at work in | / \ julian@elischer.org +------>x USA \ a very strange | ( OZ ) \___ ___ | country ! +- X_.---._/ presently in San Francisco \_/ \\ v To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message