talkd

Mateus Cordeiro Inssa mateus en ifnet.com.br
Lun Ene 31 10:44:18 CST 2000


David S. Miller writes:
 >    From: Mateus Cordeiro Inssa <mateus en ifnet.com.br>
 >    Date: Mon, 31 Jan 2000 09:13:57 -0200 (BRDT)
 > 
 >      Of course the application check for errors, but the error always
 >    occur in the first recvfrom. The application doesn't change any
 >    socket property, so I assume it is on blocking mode.
 > 
 >      The sequence is: socket, bind, select,recvfrom. No one uses any
 >    extra param.
 > 
 > Right, and if recvfrom returns an error, the sockaddr structure
 > holds garbage.  It's contents cannot be relied upon, and what
 > I get from your report is that the sockaddr passed to recvfrom
 > is the same one which gets passed to sendto/sendmsg.  That is
 > wrong, and is what causes the problem.  The application in question
 > needs to be fixed if this is the case.

  Just to clarify: I'm not the original poster. Yes, the talkd must be 
fixed, my application not (because it checks if the error occurs).

  Look:

socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 4
bind(4, {sin_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("0.0.0.0")}, 16) = 0
listen(4, 20)                           = 0
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 5
bind(5, {sin_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("0.0.0.0")}, 16) = 0

select(12, [4 5], NULL, NULL, NULL)     = 1 (in [5])
recvfrom(5, "\323x\1\0\0\1\0\0\0\0\0\0\3ola\4"..., 512, 0, {sa_family=0, sa_data="\0\0\0\0\0\0\0\0\0\0\0\0\0\0"}, [16]) = 29
 | 00000  d3 78 01 00 00 01 00 00  00 00 00 00 03 6f 6c 61  .x...... .....ola |
 | 00010  04 68 6f 6d 65 02 62 72  00 00 01 00 01           .home.br .....    |


# Oh, why do I have the packet, the lenght is right (errno is not set)
and the sockaddr is completely wrong ?

# And, in the second turn...


select(12, [4 5], NULL, NULL, NULL)     = 1 (in [5])
recvfrom(5, "\323x\1\0\0\1\0\0\0\0\0\0\3ola\4"..., 512, 0, {sin_family=AF_INET, sin_port=htons(1026), sin_addr=inet_addr("10.0.0.13")}, [16]) = 29
 | 00000  d3 78 01 00 00 01 00 00  00 00 00 00 03 6f 6c 61  .x...... .....ola |
 | 00010  04 68 6f 6d 65 02 62 72  00 00 01 00 01           .home.br .....    |


  Why the first (only the first) pass in this loop gives the error ?

  []'s

Mateus Cordeiro Inssa
---------------------
Linux User: 76186  Kernel: 2.3.40
ICQ (Licq): 15243895
---------------------
mateus en ifnet.com.br
mateus en cwb.fnn.net

Mon Jan 31 11:57:16 BRDT 2000

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo en vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



Más información sobre la lista de distribución Ayuda