[Olsr-users] Proposal: Use just one socket to send and receive messages on all interfaces
Henning Rogge
(spam-protected)
Wed Sep 10 12:42:45 CEST 2008
On Wed, Sep 10, 2008 at 11:38, Joerg Pommnitz <(spam-protected)> wrote:
> Hello all,
> while researching on how to set the TTL for IPv6 multicast messages
> I found out some things that would be useful for olsrd.
> Currently olsrd opens and binds sockets to each interface it feels
> responsible for.
> Under Linux (and probably other unixish systems) there is an alternativ
> to this.
>
> Sending packets on a specific interface:
>
> use sendmsg(2) and add a control message of type IP_PKTINFO to the
> outbound message. The data part of the control message is of type
> struct in_pktinfo where you can specify the desired interface index in
> the ipi_ifindex memeber. Additionally one would probably need to set the
> MSG_DONT_ROUTE flag.
> For IPv6 it might even be simpler: the sockaddr_in6 has a sin6_scope_id
> which is just the interface index.
This part is not very interesting for OLSR because OLSR only sends
broadcast packages.
> Receiving packets:
> Use recvmsg(2) to receive the incoming packets. If you enable the
> socket option IP_PKTINFO or IPV6_RECVPKTINFO than recvmsg will add
> a correcponding control message with information about the interface
> the packet was received on, the original destination address and the
> local interface address that caused the packet to be received.
>
> I think this would be enough to have a single socket for all interfaces.
> I'm just airing the idea, I won't be able to do this myself anytime
> soon.
This one sounds more interesting. :)
Henning
--
"Wo kämen wir hin, wenn alle sagten, wo kämem wir hin, und niemand
ginge, um einmal zu schauen, wohin man käme, wenn man ginge." (Kurt
Marti)
More information about the Olsr-users
mailing list