PERROR("%s - Failed inserting timer event", h->ctx.module_name);
goto fail;
}
+
+ /*
+ * Save a copy of the header + Authentication Vector for checking the response.
+ */
+ MEM(u->packet = talloc_memdup(u, u->packet, RADIUS_HEADER_LENGTH));
}
/** Free a connection handle, closing associated resources
goto error;
}
- /*
- * Keep a copy of the packet for potential retransmission.
- *
- * @todo - do this only for UDP.
- */
- MEM(u->packet = talloc_memdup(u, h->buffer, packet_len));
-
return 0;
}
packet_len += slen;
if (packet_len < u->packet_len) {
+ /*
+ * The first time around, save a copy of the packet for later writing.
+ */
+ if (!u->partial) MEM(u->packet = talloc_memdup(u, u->packet, u->packet_len));
+
u->partial = packet_len;
trunk_request_signal_partial(treq);
return;
*/
RDEBUG("%s request. Relying on NAS to perform more retransmissions", action);
}
+
+ /*
+ * We don't retransmit over TCP.
+ */
+ if (h->ctx.fd_config->type != SOCK_DGRAM) return;
+
+ /*
+ * If we only send one datagram packet, then don't bother saving it.
+ */
+ if (u->retry.config && u->retry.config->mrc == 1) return;
+
+ MEM(u->packet = talloc_memdup(u, u->packet, u->packet_len));
}
/** Deal with Protocol-Error replies, and possible negotiation