recvfrom and sockaddr_in.sin_port

From: Adam (adam@eax.com)
Date: Sun Jul 08 2001 - 12:14:47 EST


hello,
        I'm using recvfrom, and upon return it should fill in
        from argument with sockaddr_in data structure. from
        ip(7) man page I get that it has format of :

        struct sockaddr_in {
             sa_family_t sin_family; /* address family: AF_INET */
             u_int16_t sin_port; /* port in network byte order*/
             struct in_addr sin_addr; /* internet address */
        };

        for PF_INET type of socket. Now if I run the program the, data in
        the from field comes out as:

2 0 0 0 192 168 1 4 61 63 140 200 85 214 2

 | | |

AF_INET :2
IP :192.168.1.4

        and as show in above example and other repeated test, the port
        part is always set to 0. Shouldn't that be set to port number?

        on similar token the "padding" part after the IP is always set
        to the same pattern. Shouldn't it rather be zeroed, or be
        some random data?

        I have attached a simple program I used for generating those
        results.

-- 
Adam
http://www.eax.com      The Supreme Headquarters of the 32 bit registers


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



This archive was generated by hypermail 2b29 : Sun Jul 15 2001 - 21:00:08 EST