On Friday 11 June 2004 16:53, Julian Anastasov wrote:
> Hello,
>
> On Fri, 11 Jun 2004, Denis Vlasenko wrote:
> > Hmmm... do I have to set a *routing dest address* field
> > to set src ip address of my UDP packet?
>
> Try such function:
>
> [snip]
Thanks for your excellent help Julian.
It helped me to finally make my code work.
Pity I did not keep it that way, because
it wouldn't be portable. I converted it
to 'man cmsg' compliant way.
On Friday 11 June 2004 17:14, Henrik Nordstrom wrote:
> [snip]
> > I am trying to figure it out, currently I'm getting
> > -EINVAL in sendmsg in this code:
> >
> > # define SRCADDR_SOCKOPT IP_PKTINFO
> > # define SRCADDR_DATASIZE (CMSG_SPACE(sizeof(struct in_pktinfo)))
> > # define srcaddr(x) (&(((struct in_pktinfo
> > *)(CMSG_DATA(x)))->ipi_spec_dst))
>
> Drop the defines. These are only obfuscating your code and the source to
> your error. You need to pass a in_pktinfo structure in the message, and
They were there in the example recv code from the Net. That code tried
to use IP_DSTADDR (IIRC) option (a BSDism or something) if it is #defined.
Dropped #defines.
I ended up with following patch for djbdns. Run tested.
Thanks again for your help guys.
--
vda
d.diff
Description: Text Data
|