From owner-freebsd-net Thu Jan 17 18:30: 9 2002 Delivered-To: freebsd-net@freebsd.org Received: from InterJet.dellroad.org (adsl-63-194-81-26.dsl.snfc21.pacbell.net [63.194.81.26]) by hub.freebsd.org (Postfix) with ESMTP id 109C337B400 for ; Thu, 17 Jan 2002 18:30:06 -0800 (PST) Received: from arch20m.dellroad.org (arch20m.dellroad.org [10.1.1.20]) by InterJet.dellroad.org (8.9.1a/8.9.1) with ESMTP id SAA61968; Thu, 17 Jan 2002 18:16:09 -0800 (PST) Received: (from archie@localhost) by arch20m.dellroad.org (8.11.6/8.11.6) id g0I2G8k23055; Thu, 17 Jan 2002 18:16:08 -0800 (PST) (envelope-from archie) From: Archie Cobbs Message-Id: <200201180216.g0I2G8k23055@arch20m.dellroad.org> Subject: Re: netgraph: how to setsockopt on ksocket node ? In-Reply-To: <31440000.1011279577@blues.viagenie.qc.ca> "from Florent Parent at Jan 17, 2002 09:59:37 am" To: Florent Parent Date: Thu, 17 Jan 2002 18:16:08 -0800 (PST) Cc: freebsd-net@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL88 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII 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 Florent Parent writes: > Anyone has an example on how to setsockopt on a ksocket node in netgraph? > > struct opts { > int level; > int name; > int value; > } myopts = { SOL_SOCKET, SO_REUSEADDR, 1 > }; > > ret = NgSendMsg(cs, epath, NGM_KSOCKET_COOKIE, NGM_KSOCKET_SETOPT, > (struct ng_ksocket_sockopt *)&myopts, > sizeof(myopts))); > > return error 14 "Bad address". > > Did some tracing in ng_ksocket.c and the struct sockopt sent as argument to > sosetopt() seems to contains sane values: > > sopt.sopt_val = 0xc182452c (pointer dereferences to 1) > sopt.sopt_valsize = 4 What kind of socket? What version of FreeBSD? That should work.. if the error is coming from the sosetopt() call then it's a socket problem rather than a netgraph problem. What if you create the socket normally and call setsockopt()? Cheers, -Archie __________________________________________________________________________ Archie Cobbs * Packet Design * http://www.packetdesign.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message