[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4ACDAE64.5020101@gmail.com>
Date: Thu, 08 Oct 2009 11:18:28 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: thomas yang <lampsu@...il.com>
CC: netdev@...r.kernel.org
Subject: Re: IP header identification field is zero, why?
thomas yang a écrit :
> The IP ID for TCP is non-zero, but for UDP is zero, strange.
>
> I want to make the IP ID (not always zero) for UDP packets, what should I do?
> (I want to use 'IP header ID, flags, offset, protocol' to identify an
> IP packets)
As I said, you can connect() your udp socket, if you send/receive trafic to/from a given destination.
if (connected_sock)
res = connect(sock, (struct sockaddr *)&addr, sizeof(addr));
(Only once)
Then, your sendto() can be faster (because no route lookup is performed)
if (sendto(sock, buffer, psize, 0,
connected_socks ? NULL : (struct sockaddr *)&addr,
sizeof(struct sockaddr_in)) != -1)
Then linux *will* generate an ID for each datagram.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists