All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: sendmsg and IP_PKTINFO
@ 2003-02-18 19:57 Julian Anastasov
  2003-02-18 23:39 ` Neil Brown
  0 siblings, 1 reply; 13+ messages in thread
From: Julian Anastasov @ 2003-02-18 19:57 UTC (permalink / raw)
  To: Neil Brown; +Cc: linux-kernel, ja


	Hello,

Neil Brown wrote:

> Note that the in_pktinfo is described as "some information about the
> incoming packet".  In particular ipi_ifindex is "the unique index of
> the interface the packets was received on".
>
> i.e. it is more about the incoming than the outgoing packet.

	Yes, because when set as socket option you can receive
pktinfo with recvmsg. But IP_PKTINFO can be used also with sendmsg.
Just forget about interfaces, i.e. use something like this in cmsg:

.ipi = {
	.ipi_ifindex = 0,
	.ipi_spec_dst = local_ip,
},

	Such code is needed when your UDP socket is not
connected (preferred) nor bound (with bind). In such case
it is essential to provide sendmsg with the local IP address
used for proper routing. Playing with interfaces should be
avoided if possible. If is a common error UDP users not to
provide the routing with local IP address.

Regards

--
Julian Anastasov <ja@ssi.bg>


^ permalink raw reply	[flat|nested] 13+ messages in thread
* (no subject)
@ 2003-02-15  1:53 Neil Brown
  2003-02-18  7:10 ` David S. Miller
  0 siblings, 1 reply; 13+ messages in thread
From: Neil Brown @ 2003-02-15  1:53 UTC (permalink / raw)
  To: Herbert Xu; +Cc: linux-kernel

Subject: Re: Routing problem with udp, and a multihomed host in 2.4.20
In-Reply-To: message from Herbert Xu on Saturday February 15
References: <15948.13879.734412.313081@notabene.cse.unsw.edu.au>
	<E18jpaa-0007Rc-00@gondolin.me.apana.org.au>
X-Mailer: VM 7.07 under Emacs 20.7.2
FCC: ~/.mail/linux
X-face:	[Gw_3E*Gng}4rRrKRYotwlE?.2|**#s9D<ml'fY1Vw+@XfR[fRCsUoP?K6bt3YD\ui5Fh?f
	LONpR';(ql)VM_TQ/<l_^D3~B:z$\YC7gUCuC=sYm/80G=$tt"98mr8(l))QzVKCk$6~gldn~*FK9x
	8`;pM{3S8679sP+MbP,72<3_PIH-$I&iaiIb|hV1d%cYg))BmI)AZ
--text follows this line--
On Saturday February 15, herbert@gondor.apana.org.au wrote:
> Neil Brown <neilb@cse.unsw.edu.au> wrote:
> > 
> > It turns out that the problem occurs when send_msg is used to send a
> > UDP packet, and the control information contains
> >              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 */
> >              };
> > specifying the address and interface of the message that we are
> > replying to.
> 
> So your application is forcing the packet to go out on a specific
> interface bypassing the routing table...

No.
My application (which is just using standard rpc server libraries) is
saying
  "This is in reply to a request that came in through a given
  interface".

It is not reasonable to treat that statement as equivalent to:
  "This packet must go out that interface"

which is what appears to be happening.

NeilBrown


> -- 
> Debian GNU/Linux 3.0 is out! ( http://www.debian.org/ )
> Email:  Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2003-02-21  4:23 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <15954.4693.893707.471216@notabene.cse.unsw.edu.au.suse.lists.linux.kernel>
     [not found] ` <200302181606.TAA03838@sex.inr.ac.ru.suse.lists.linux.kernel>
     [not found]   ` <15954.49970.860809.75554@notabene.cse.unsw.edu.au.suse.lists.linux.kernel>
     [not found]     ` <20030218.155651.108799644.davem@redhat.com.suse.lists.linux.kernel>
2003-02-19  8:17       ` sendmsg and IP_PKTINFO Andi Kleen
2003-02-19  8:06         ` David S. Miller
2003-02-21  3:51         ` Neil Brown
2003-02-21  4:17           ` David S. Miller
2003-02-18 19:57 Julian Anastasov
2003-02-18 23:39 ` Neil Brown
  -- strict thread matches above, loose matches on Subject: below --
2003-02-15  1:53 Neil Brown
2003-02-18  7:10 ` David S. Miller
2003-02-18 11:00   ` sendmsg and IP_PKTINFO Neil Brown
2003-02-18 16:06     ` kuznet
2003-02-18 23:35       ` Neil Brown
2003-02-18 23:56         ` David S. Miller
2003-02-19  3:52     ` David S. Miller
2003-02-19  4:13       ` Neil Brown
2003-02-19  4:03         ` David S. Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.