Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Feb 2002 19:56:24 -0800 (PST)
From:      Archie Cobbs <archie@dellroad.org>
To:        Florent Parent <Florent.Parent@viagenie.qc.ca>
Cc:        Marko Zec <zec@tel.fer.hr>, freebsd-net@FreeBSD.ORG
Subject:   Re: ng_dummy - netgraph traffic shaping node
Message-ID:  <200202070356.g173uO015959@arch20m.dellroad.org>
In-Reply-To: <14420000.1013008215@blues.viagenie.qc.ca> "from Florent Parent at Feb 6, 2002 10:10:15 am"

next in thread | previous in thread | raw e-mail | index | archive | help
Florent Parent writes:
> > Btw, where could I find some examples on parsing setsockopt() calls to
> > selected nodes, if such thing is possible at all?
> >
> 
> Here's how I do it on a ksocket node (patch on ksocket is required unless 
> you're using -CURRENT. Check thread on "netgraph: how to setsockopt on 
> ksocket node ?". )
> 
> struct opts {
>     int level;
>     int name;
>     int value;
> } myopts = { SOL_SOCKET, SO_REUSEADDR, 1 };
> 
> if ( (ret = NgSendMsg(cs, epath, NGM_KSOCKET_COOKIE, NGM_KSOCKET_SETOPT,
>                       (struct ng_ksocket_sockopt *)&myopts, 
> sizeof(myopts))) < 0) {
>     fprintf(stderr, "%s Cannot setopt the ksocket node: %s\n",
>             epath, strerror(errno));
>     return (-1);
> }

Plus, you need 4.5-stable for this to work because of
a bug that was recently fixed.

-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?200202070356.g173uO015959>