|
@@ -245,6 +245,8 @@ struct dhcp_session {
|
245
|
245
|
|
246
|
246
|
/** Retransmission timer */
|
247
|
247
|
struct retry_timer timer;
|
|
248
|
+ /** Transmission counter */
|
|
249
|
+ unsigned int count;
|
248
|
250
|
/** Start time of the current state (in ticks) */
|
249
|
251
|
unsigned long start;
|
250
|
252
|
};
|
|
@@ -1098,6 +1100,14 @@ static int dhcp_tx ( struct dhcp_session *dhcp ) {
|
1098
|
1100
|
goto done;
|
1099
|
1101
|
}
|
1100
|
1102
|
|
|
1103
|
+ /* (Ab)use the "secs" field to convey metadata about the DHCP
|
|
1104
|
+ * session state into packet traces. Useful for extracting
|
|
1105
|
+ * debug information from non-debug builds.
|
|
1106
|
+ */
|
|
1107
|
+ dhcppkt.dhcphdr->secs = htons ( ( ++(dhcp->count) << 2 ) |
|
|
1108
|
+ ( dhcp->offer.s_addr ? 0x02 : 0 ) |
|
|
1109
|
+ ( dhcp->proxy_offer ? 0x01 : 0 ) );
|
|
1110
|
+
|
1101
|
1111
|
/* Fill in packet based on current state */
|
1102
|
1112
|
if ( ( rc = dhcp->state->tx ( dhcp, &dhcppkt, &peer ) ) != 0 ) {
|
1103
|
1113
|
DBGC ( dhcp, "DHCP %p could not fill DHCP request: %s\n",
|