Skip to contentSkip to conversation

libipq and timestamp

DISCUSSION Eric Leblond 2 participants 2 messages Aug 18, 2003 – Aug 19, 2003 netfilter

lore
Share & tools
lore
#0 lore raw

Hi,

I did not manage to get the timestamp of a packet in the message given by libipq. It is just 0.
Is there something to do to have it fill in ?

Thanks in advance,

Signature · 2 lines
Eric Leblond <[email protected]>
GnuFw : http://www.gnufw.org
#1 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 3 lines · Eric Leblond

I did not manage to get the timestamp of a packet in the message given by libipq. It is just 0.
Is there something to do to have it fill in ?

If the packet is locally generated then the timestamp is not filled in for you. Here is a snippet that may help:

/* locally generated?, no timestamp */
if (!m->timestamp_sec)

    {
      memset (&tz, 0, sizeof (tz));
      gettimeofday (&tv, &tz);
      ph.ts.tv_sec = tv.tv_sec;
      ph.ts.tv_usec = tv.tv_usec;
    }
  else
    {
      ph.ts.tv_sec = m->timestamp_sec;
      ph.ts.tv_usec = m->timestamp_usec;
    }

-----BEGIN PGP SIGNATURE-----
Comment: Keeping the world safe for geeks.

iD8DBQE/QXFbwBVKl/Nci0oRAt91AJwMLTu43iFjrtAyAj4fGG2nvYK2pwCg7RgH ym7QrHv/NkFEa3Q/semyoS4=
=fwjd
-----END PGP SIGNATURE-----