Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Jan 2002 18:16:08 -0800 (PST)
From:      Archie Cobbs <archie@dellroad.org>
To:        Florent Parent <Florent.Parent@viagenie.qc.ca>
Cc:        freebsd-net@FreeBSD.ORG
Subject:   Re: netgraph: how to setsockopt on ksocket node ?
Message-ID:  <200201180216.g0I2G8k23055@arch20m.dellroad.org>
In-Reply-To: <31440000.1011279577@blues.viagenie.qc.ca> "from Florent Parent at Jan 17, 2002 09:59:37 am"

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200201180216.g0I2G8k23055>