- if (timestamp || log || logfrmt)
- if (ioctl(s[i], SIOCGSTAMP, &tv) < 0)
- perror("SIOCGSTAMP");
+ for (cmsg = CMSG_FIRSTHDR(&msg);
+ cmsg && (cmsg->cmsg_level == SOL_SOCKET);
+ cmsg = CMSG_NXTHDR(&msg,cmsg)) {
+ if (cmsg->cmsg_type == SO_TIMESTAMP)
+ tv = *(struct timeval *)CMSG_DATA(cmsg);
+ else if (cmsg->cmsg_type == SO_RXQ_OVFL)
+ dropcnt[i] = *(__u32 *)CMSG_DATA(cmsg);
+ }
+
+ /* check for (unlikely) dropped frames on this specific socket */
+ if (dropcnt[i] != last_dropcnt[i]) {
+
+ __u32 frames;
+
+ if (dropcnt[i] > last_dropcnt[i])
+ frames = dropcnt[i] - last_dropcnt[i];
+ else
+ frames = 4294967295U - last_dropcnt[i] + dropcnt[i]; /* 4294967295U == UINT32_MAX */