Subject: Re: how is dest addr handled by connect() or sendto() code ?
To: Philip Christian <>
From: Jaromir Dolecek <>
List: tech-kern
Date: 02/03/2003 22:04:14
After a very brief look, it seems the call graph is like this:

sys_sendto() 	->		(massages args)
sendit()	->		further massaging into mbufs
so->so_send 	->		
sosend()	->		actually send the data to protocol layer in chunks
so->so_proto->pr_usrreq(PRU_SEND) ->
clnp_usrreq(PRU_SEND)	->	no special handling for PRU_SEND, passes down
raw_usrreq(PRU_SEND)	->	calls clnp_usrreq(PRU_CONNECT) if nam
	is nonnull (it.e. if address was specified for sendto(2) call), then 
	invokes protocol output function, I assume rclnp_output()

Now, clnp_usrreq(PRU_CONNECT) does fill in isop_sfaddr and rcb_faddr,
it seems everything is correct there. So it should work.

Since it doesn't work for you, can you confirm clnp_usrreq(PRU_CONNECT)
is really called during your sendto(2) call, and that the address is
correctly filled in? If it's not called, there must be something
I overlook. If it is called, then something else must erase the address
between PRU_CONNECT and rest of raw_usrreq() handling. Perhaps confirm
that the condition in clnp_usrreq(PRU_CONNECT) for m_len and siso_len
doesn't fire, and that it actually validates and sets the internal
socket address properly. 


Philip Christian wrote:
[ Charset ISO-8859-1 unsupported, converting... ]
> I have spent now about six weeks trying to get a SOCK_RAW send() or sendto() call to work with an ISO socket and came to the conclusion that it is broken.
> Basically I have figured out that the send() or sendto() calls results in rclnp_output function in clnp_raw.c being called which calls function clnp_output in clnp_output.c
> send() or sendto() seem to fail because 
> rp->risop_isop.isop_faddr->siso_addr.isoa_len
> and
> rp->risop_isop.isop_faddr->siso_addr.isoa_genaddr[]
> do not get populated properly with the destination address before function rclnp_output is executed.
> In fact I have manually forced an address into this structure inside the rclnp_output function and recompiled the kernel, and a packet is then actually transmitted.
> I cannot figure out what the kernel does when send() or sendto() are executed.
> There are various tables of system calls in places like /sys/syscall.h but I can't get from there to the actual code.
> I have also had a look at the Design and Implementation of the 4.4 BSD Operating System book and I still couldn't figure it out.
> Can someone point me in the right direction so that I can figure out why the address is not getting from the connect() or sendto() dest address arguments into rp->risop_isop.isop_faddr please ?
> Really I just want a pointer to the code that gets executed, so it almost isn't even an OSI specific question...
> Thanks, Philip
> ---------------------------------
> With Yahoo! Mail you can get a bigger mailbox -- choose a size that fits your needs

Jaromir Dolecek <>  
-=- We should be mindful of the potential goal, but as the tantric    -=-
-=- Buddhist masters say, ``You may notice during meditation that you -=-
-=- sometimes levitate or glow.   Do not let this distract you.''     -=-