FILE_LICENCE ( GPL2_OR_LATER );
-/* Unique IP datagram identification number */
-static uint16_t next_ident = 0;
+/* Unique IP datagram identification number (high byte) */
+static uint8_t next_ident_high = 0;
/** List of IPv4 miniroutes */
struct list_head ipv4_miniroutes = LIST_HEAD_INIT ( ipv4_miniroutes );
iphdr->verhdrlen = ( IP_VER | ( sizeof ( *iphdr ) / 4 ) );
iphdr->service = IP_TOS;
iphdr->len = htons ( iob_len ( iobuf ) );
- iphdr->ident = htons ( ++next_ident );
iphdr->ttl = IP_TTL;
iphdr->protocol = tcpip_protocol->tcpip_proto;
iphdr->dest = sin_dest->sin_addr;
goto err;
}
+ /* (Ab)use the "ident" field to convey metadata about the
+ * network device statistics into packet traces. Useful for
+ * extracting debug information from non-debug builds.
+ */
+ iphdr->ident = htons ( ( (++next_ident_high) << 8 ) |
+ ( ( netdev->rx_stats.bad & 0xf ) << 4 ) |
+ ( ( netdev->rx_stats.good & 0xf ) << 0 ) );
+
/* Determine link-layer destination address */
if ( ( rc = ipv4_ll_addr ( next_hop, iphdr->src, netdev,
ll_dest ) ) != 0 ) {