|
|
a0181c |
Fix broken Call-Disconnect-Notify code
|
|
|
a0181c |
Submitted upstream: http://marc.info/?l=pptpclient-devel&m=128594487715881&w=1
|
|
|
a0181c |
|
|
|
a0181c |
--- pptp-1.7.2/pptp_ctrl.c 2010-11-30 15:26:29.856391644 +0000
|
|
|
a0181c |
+++ pptp-1.7.2/pptp_ctrl.c 2010-11-30 15:26:29.861391766 +0000
|
|
|
a0181c |
@@ -941,15 +941,25 @@ int ctrlp_disp(PPTP_CONN * conn, void *
|
|
|
a0181c |
{
|
|
|
a0181c |
struct pptp_call_clear_ntfy *packet =
|
|
|
a0181c |
(struct pptp_call_clear_ntfy *)buffer;
|
|
|
a0181c |
+ int i;
|
|
|
a0181c |
+ u_int16_t our_call_id;
|
|
|
a0181c |
+ u_int16_t peer_call_id = ntoh16(packet->call_id);
|
|
|
a0181c |
log("Call disconnect notification received (call id %d)",
|
|
|
a0181c |
- ntoh16(packet->call_id));
|
|
|
a0181c |
- if (vector_contains(conn->call, ntoh16(packet->call_id))) {
|
|
|
a0181c |
- PPTP_CALL * call;
|
|
|
a0181c |
- ctrlp_error(packet->result_code, packet->error_code,
|
|
|
a0181c |
- packet->cause_code, pptp_call_disc_ntfy,
|
|
|
a0181c |
- MAX_CALL_DISC_NTFY);
|
|
|
a0181c |
- vector_search(conn->call, ntoh16(packet->call_id), &call);
|
|
|
a0181c |
- pptp_call_destroy(conn, call);
|
|
|
a0181c |
+ (int) peer_call_id);
|
|
|
a0181c |
+ /* See if we can map the peer's call id to our own */
|
|
|
a0181c |
+ for (i = 0; i < vector_size(conn->call); i++) {
|
|
|
a0181c |
+ PPTP_CALL * call = vector_get_Nth(conn->call, i);
|
|
|
a0181c |
+ if (call->peer_call_id == peer_call_id) {
|
|
|
a0181c |
+ our_call_id = call->call_id;
|
|
|
a0181c |
+ if (vector_contains(conn->call, our_call_id)) {
|
|
|
a0181c |
+ ctrlp_error(packet->result_code, packet->error_code,
|
|
|
a0181c |
+ packet->cause_code, pptp_call_disc_ntfy,
|
|
|
a0181c |
+ MAX_CALL_DISC_NTFY);
|
|
|
a0181c |
+ vector_search(conn->call, our_call_id, &call);
|
|
|
a0181c |
+ pptp_call_destroy(conn, call);
|
|
|
a0181c |
+ }
|
|
|
a0181c |
+ break;
|
|
|
a0181c |
+ }
|
|
|
a0181c |
}
|
|
|
a0181c |
/* XXX we could log call stats here XXX */
|
|
|
a0181c |
/* XXX not all servers send this XXX */
|