Fix Call-Disconnect-Notify operation

- Patch submitted upstream:
  http://marc.info/?l=pptpclient-devel&m=128594487715881&w=1
  Use the peer's call ID rather than our own when processing
  Call Disconnect notifications
This commit is contained in:
Paul Howarth 2010-11-30 15:38:04 +00:00
parent 871f362c44
commit c03acc049f
2 changed files with 45 additions and 0 deletions

View File

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

View File

@ -16,6 +16,7 @@ Patch5: pptp-1.7.2-pptpsetup-mppe.patch
Patch6: pptp-1.7.2-waitpid.patch
Patch7: pptp-1.7.2-conn-free.patch
Patch8: pptp-1.7.2-conn-free2.patch
Patch100: pptp-1.7.2-call-disconnect-notify.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: ppp >= 2.4.2, /sbin/ip
%if 0%{?fedora} > 14
@ -68,6 +69,10 @@ tunnels.
# Avoid using connection struct after it is freed (upstream patch)
%patch8 -p0 -b .conn-free2
# Fix broken Call-Disconnect-Notify code
# Submitted upstream: http://marc.info/?l=pptpclient-devel&m=128594487715881&w=1
%patch100 -p1 -b .callids
# Pacify rpmlint
%{__perl} -pi -e 's/install -o root -m 555 pptp/install -m 755 pptp/;' Makefile
@ -111,6 +116,7 @@ tunnels.
%changelog
* Tue Nov 30 2010 Paul Howarth <paul@city-fan.org> 1.7.2-11
- Require systemd-units for ownership of /etc/tmpfiles.d directory
- Fix Call-Disconnect-Notify operation
* Thu Nov 25 2010 Paul Howarth <paul@city-fan.org> 1.7.2-10
- Add /etc/tmpfiles.d/pptp.conf to create /var/run/pptp at boot time for