lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Wed, 9 Feb 2011 11:36:21 +0100
From:	Joakim Tjernlund <joakim.tjernlund@...nsmode.se>
To:	netdev@...r.kernel.org
Subject:  MSG_DONTROUTE with IP_PKTINFO(ipi_ifindex)


How does sendmsg(2) work w.r.t IP_PKTINFO(ipi_ifindex) != 0
and MSG_DONTROUTE set?

man 7 ip has this to say about ipi_ifindex:

       IP_PKTINFO (since Linux 2.2)
              Pass  an  IP_PKTINFO  ancillary  message that contains a pktinfo
              structure that supplies  some  information  about  the  incoming
              packet.   This  only  works  for datagram oriented sockets.  The
              argument is a flag that tells the socket whether the  IP_PKTINFO
              message should be passed or not.  The message itself can only be
              sent/retrieved as control message with a packet using recvmsg(2)
              or sendmsg(2).

                  struct in_pktinfo {
                      unsigned int   ipi_ifindex;  /* Interface index */
                      struct in_addr ipi_spec_dst; /* Local address */
                      struct in_addr ipi_addr;     /* Header Destination
                                                      address */
                  };

              ipi_ifindex  is the unique index of the interface the packet was
              received on.  ipi_spec_dst is the local address  of  the  packet
              and  ipi_addr  is  the destination address in the packet header.
              If IP_PKTINFO is passed to sendmsg(2) and  ipi_spec_dst  is  not
              zero,  then it is used as the local source address for the rout‐
              ing table lookup and for setting up  IP  source  route  options.
              When  ipi_ifindex  is not zero, the primary local address of the
              interface specified by the index overwrites ipi_spec_dst for the
              routing table lookup.

So if ipi_ifindex is set with MSG_DONTROUTE, will linux use the I/F in ipi_index
or will it still lookup the dst address and use that instead?

I am asking as I got multiple ppp I/F between the same 2 routers which have
the same local and remote address(unnumbered ppp interfaces) and I want
to specify the interface to use as src and dst addr aren't unique.

Also, suppose I only have ipi_spec_dst and ipi_addr set and multiple interfaces match,
will the packet be sent on one of the matching interfaces or on all matching interfaces?

 Jocke

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ