Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Jan 2002 11:55:09 +0100
From:      "Rogier R. Mulhuijzen" <drwilco@drwilco.net>
To:        Florent Parent <Florent.Parent@viagenie.qc.ca>
Cc:        freebsd-net@freebsd.org
Subject:   Re: netgraph: how to setsockopt on ksocket node ?
Message-ID:  <5.1.0.14.0.20020118114410.01bc2d00@mail.drwilco.net>
In-Reply-To: <214190000.1011326302@blues.viagenie.qc.ca>
References:  <200201180216.g0I2G8k23055@arch20m.dellroad.org> <200201180216.g0I2G8k23055@arch20m.dellroad.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi Florent,

You use:

     struct opts {
         int level;
         int name;
         int value;
     } myopts;

     myopts.level = SOL_SOCKET;
     myopts.name  = SO_REUSEPORT;
     myopts.value = 1;

But socket options (on this level) are a predefined struct. Here's an 
example from some code I am working on:

     struct sockopt sopt;

     /* some code removed */

     bzero(&sopt, sizeof(sopt));
     sopt.sopt_level = SOL_SOCKET;
     sopt.sopt_name = SO_SNDBUF;
     bufsiz = 128 * 1024;      /* XXX */
     sopt.sopt_val = &bufsiz;
     sopt.sopt_valsize = sizeof(bufsiz);

Hope this clears a few things up =)   (BTW, I'm not using netgraph after 
this code, but I know from reading the netgraph source that this struct 
sockopt is what is used).

	Doc


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?5.1.0.14.0.20020118114410.01bc2d00>