Thread (10 messages) 10 messages, 5 authors, 2007-08-16

Proposed interface for per-packet mesh-ttl

From: Javier Cardona <hidden>
Date: 2007-07-03 19:29:25

David Woodhouse suggested that this list is a more appropriate forum
for my message...

---------- Forwarded message ----------
From: Javier Cardona <redacted>
Date: Jul 3, 2007 11:49 AM
Subject: Proposed interface for per-packet mesh-ttl
To: libertas-dev@lists.infradead.org


Libertas-dev,

I'm currently working on per-packet mesh ttl.  My plan is to register
new mesh sockopts through netfilter.  The user interface will be:

#include <sys/types.h>
#include <sys/socket.h>

/* in mesh.h ? */
#define MESH_SO_SET_TTL         77
#define MESH_SO_GET_TTL         77

int main()
{
    int sock;
    int optlen;
    unsigned char ttl;

    ttl = 7;
    optlen = sizeof(ttl);

    sock = socket (PF_INET, SOCK_STREAM, 0);
    setsockopt(sock, SOL_IP, MESH_SO_SET_TTL, &ttl, optlen);
    getsockopt(sock, SOL_IP, MESH_SO_GET_TTL, &ttl, &optlen);

    /* from here on, all traffic from sock will be sent to the mesh
with ttl=7 */

    return 0;
}


Pros:

* it is non-intrusive (only need to reserve the socket option values,
no other changes to the net stack are needed)
* runtime configurable (this options may be supported only when a
mesh_opts module is loaded).
* familiar and intuitive (at least to me :)

Cons:

* netfilter only has hooks for IPv4 and IPv6.  If we want to make mesh
parameters configurable at other layers (e.g. packet) we'll have to
create the hooks.
* It is debatable whether a mesh option should be set at SOL_IP, as it
is a layer 2 protocol.    We do want (some) mesh options to be applied
to flows a that level, and the {g,s}etsockopt interface does not
support setting lower layer options to higher layer sockets.

Speak up if you would like to see this done in a different way.

Cheers,

Javier
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help