Regarding Flow of sendto (UDP) using IPv6.

Prasad Dandra dbprasad at
Tue Oct 30 07:02:19 PDT 2007

Hi All,

Thank You for the reply.
But I still haven't got the information I am expecting.

I am using the *FreeBSD IPv6 stack*.

I would be very grateful if you help me to know the following:

1) I wrote the UDP client server program, the client is continously sending
packets to server till some condition is met and then recieving the packets
from the server untill some other condition is met. The code is working
fine. I want to know how the *sendto flow works in the client when I am
continously calling it without bind??* Doesn't it require connection to
be disconnected after each sendto? if no why?

Ex: sendto calls sendit and sendit calls kern_sendit in it and then using
prusend the control goes to sosend and udp6_output is called.
In udp6_output what are the functions it enters when 1st time sendto is
called and in the subsequent sendto calls? i,e *what is the diffrence in th
code flow?*

2) I used the same code using other IPv6 stack which has *FreeBSD ported* in
it but here the same code doesn't work. If bind is used it works properly.
Without Bind it fails at the function if
(!IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_faddr)) in udp6_output when tryin the
send packet 2nd time.
I am not able to find where *in6p->in6p_faddr is initialised to 0*(which i
feel is necessary to send the packet next time or else it fails as mentioned
above)* in FreeBSD IPv6 stack. is it required? *Kindly help me in this

3) Similarly how is the code flow when the stack recieves the packet i.e the
*code flow in udp6_input? *
Like udp6_input calls in6_pcblookup_hash. In *in6_pcblookup_hash whether it
enters 1st LIST_FOREACH function or the one in wildcard?*
The implementation of IPv6 is bit different compared to IPv4 like the
pcbconnect is avoided and pcbsetport is used in IPv6, the theory and
explaination is not available in books as that of IPv4 hence it is diificult
to analyse the code flow, so expecting help.
Waiting for response.

Thanks and Regards

On 10/17/07, Lowell Gilbert <freebsd-questions-local at> wrote:
> "Prasad Dandra" <dbprasad at> writes:
> > I have some doubts regarding the BSD stack flow.
> > I am very much interested to know the code flow from sendto (UDP case)
> upto
> > udp6_output function when used in IPv6 client (simple client) and also
> how
> > the local port and destination address are assigned without using bind
> > when 1st time the sendto is called i.e  where the pcbconnect and pcbbind
> are
> > called (particularly in case of ipv6)?
> >
> > Any information provided about the links, books to be refered for more
> > details will also be helpful.
> Bear in mind that the IPv6 implementation in FreeBSD has recently been
> exchanged for a different one, but I don't think the basic concepts
> are much changed.  For that matter, the IPv4 model (which has plenty
> of book documentation covering it) isn't very different.

More information about the freebsd-questions mailing list