From mulix@actcom.co.il Tue Nov 20 12:55:16 2001 +0200
Return-Path: <pptpclient-devel-admin@lists.sourceforge.net>
Delivered-To: mulix@alhambra.merseine.nu
Received: from lmail.actcom.co.il (lmail.actcom.co.il [192.114.47.13])
	by alhambra.merseine.nu (Postfix) with ESMTP id 340F17983F
	for <mulix@alhambra.merseine.nu>; Tue, 20 Nov 2001 12:55:16 +0200 (IST)
Received: from actcom.co.il (actcom.co.il [192.114.47.1])
	by lmail.actcom.co.il (8.11.6/8.11.6) with ESMTP id fAKAtFh27395
	for <mulix@alhambra.merseine.nu>; Tue, 20 Nov 2001 12:55:15 +0200
Received: from lmail.actcom.co.il by actcom.co.il  with ESMTP
	(8.11.6/actcom-0.2) id fAKAt8T17620 for <mulix@actcom.co.il>;
	Tue, 20 Nov 2001 12:55:09 +0200 (EET)  
	(rfc931-sender: mail.actcom.co.il [192.114.47.13])
Received: from usw-sf-list1.sourceforge.net (usw-sf-fw2.sourceforge.net [216.136.171.252])
	by lmail.actcom.co.il (8.11.6/8.11.6) with ESMTP id fAK99Yh30553
	for <mulix@actcom.co.il>; Tue, 20 Nov 2001 11:09:34 +0200
Received: from localhost ([127.0.0.1] helo=usw-sf-list1.sourceforge.net)
	by usw-sf-list1.sourceforge.net with esmtp (Exim 3.31-VA-mm2 #1 (Debian))
	id 1666tr-0003Wb-00; Tue, 20 Nov 2001 01:09:03 -0800
Received: from line167.adsl.actcom.co.il
	([192.117.101.167] helo=alhambra.merseine.nu ident=ndb)
	by usw-sf-list1.sourceforge.net with esmtp (Exim 3.31-VA-mm2 #1 (Debian))
	id 1666th-0003Us-00
	for <pptpclient-devel@lists.sourceforge.net>; Tue, 20 Nov 2001 01:08:54 -0800
Received: by alhambra.merseine.nu (Postfix, from userid 513)
	id 6BDDE7983F; Tue, 20 Nov 2001 11:08:41 +0200 (IST)
Received: from localhost (localhost [127.0.0.1])
	by alhambra.merseine.nu (Postfix) with ESMTP
	id 85E7F9C0C0; Tue, 20 Nov 2001 11:08:41 +0200 (IST)
From: mulix <mulix@actcom.co.il>
X-X-Sender:  <mulix@alhambra.merseine.nu>
To: <james.cameron@compaq.com>
Cc: <pptpclient-devel@lists.sourceforge.net>
Subject: Re: [pptp-devel] RFC: required patch to pptp 1.0.3 for israeli 
 adslservice
In-Reply-To: <3BF9FE29.443D0F59@stl.dec.com>
Message-ID: <Pine.LNX.4.33.0111201105450.19267-100000@alhambra.merseine.nu>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Sender: pptpclient-devel-admin@lists.sourceforge.net
Errors-To: pptpclient-devel-admin@lists.sourceforge.net
X-BeenThere: pptpclient-devel@lists.sourceforge.net
X-Mailman-Version: 2.0.5
Precedence: bulk
List-Help: <mailto:pptpclient-devel-request@lists.sourceforge.net?subject=help>
List-Post: <mailto:pptpclient-devel@lists.sourceforge.net>
List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/pptpclient-devel>,
	<mailto:pptpclient-devel-request@lists.sourceforge.net?subject=subscribe>
List-Id: Developers of the Linux PPTP client. <pptpclient-devel.lists.sourceforge.net>
List-Unsubscribe: <https://lists.sourceforge.net/lists/listinfo/pptpclient-devel>,
	<mailto:pptpclient-devel-request@lists.sourceforge.net?subject=unsubscribe>
List-Archive: <http://www.geocrawler.com/redir-sf.php3?list=pptpclient-devel>
X-Original-Date: Tue, 20 Nov 2001 11:08:39 +0200 (IST)
Date: Tue, 20 Nov 2001 11:08:39 +0200 (IST)
Status: RO
Content-Length: 10194
Lines: 267

On Tue, 20 Nov 2001, James Cameron wrote:

> Since no further comments were made, I've applied the patch.  Thanks.
> Apologies for the delay, I was unwell.

i hope you are better now.

since i did not really expect the previous patch to be applied, here's a
follow up patch to clean it up and add a bit of documentation.

might i ask when is the next version scheduled to be released? is there
a roadmap or a TODO list?

diff -ur --exclude CVS pptp-linux/AUTHORS pptp-mulix/AUTHORS
--- pptp-linux/AUTHORS	Sat Dec 23 10:19:51 2000
+++ pptp-mulix/AUTHORS	Tue Nov 20 10:54:57 2001
@@ -5,3 +5,4 @@
 Patches and bug-fixes by:
 - Christoph Lameter <christoph@lameter.com>
 - Gordon Chaffee <chaffee@HOME.COM>
+- mulix <mulix@actcom.co.il>
diff -ur --exclude CVS pptp-linux/ChangeLog pptp-mulix/ChangeLog
--- pptp-linux/ChangeLog	Tue Nov 20 08:30:10 2001
+++ pptp-mulix/ChangeLog	Tue Nov 20 11:04:00 2001
@@ -1,3 +1,16 @@
+Tue Nov 20 11:01:10 2001  mulix  <mulix@actcom.co.il>
+
+	* AUTHORS: add mulix.
+	* USING: add paragraph on quirks support.
+	* orckit_quirks.c: remove debugging call, rename functions and
+	variables consistently.
+	* pptp.c: (usage) remove debugging print.
+	* pptp_ctrl.c: when calling quirks hooks, check their return
+	values and warn if an error occurs.
+	* pptp_quirks.c: orckit_atur3_start_ctrl_conn was renamed
+	orckit_atur3_start_ctrl_conn_hook.
+	From: mulix@actcom.co.il
+
 Tue Nov 20 17:01:10 2001  James Cameron  <quozl@us.netrek.org>

 	* orckit_quirks.c, orckit_quirks.h: add quirks handling for orckit
diff -ur --exclude CVS pptp-linux/USING pptp-mulix/USING
--- pptp-linux/USING	Sat Dec 23 10:19:51 2000
+++ pptp-mulix/USING	Tue Nov 20 10:57:09 2001
@@ -1,12 +1,15 @@
 pptp-linux is based on pppd, so invocation is very similar:

-% pptp hostname [ppp-options]
+% pptp hostname [--phone-number] [--quirks ...] [ppp-options]

 So, for example, I invoke pptp with:

 pptp my.pptp.host debug name cananian remotename ntdialup 172.18.0.2:172.18.0.3
 route add -net 172.18.0.0 netmask 255.255.0.0 gw 172.18.0.3

+NOTE: The hostname comes *before* the pptp options, and the pppd
+options come last.
+
 You will see three pptp-related processes in your process list: a call
 manager, a GRE/PPP en/decapsulator, and pppd.  To shut down the pptp
 connection, kill the pppd process.
@@ -17,3 +20,16 @@
 configuration. Be sure you thoroughly understand MS-CHAP support in
 pppd.  Use the 'debug' option to pppd to log connection information;
 this will help you trouble-shoot the pppd side of pptp.
+
+QUIRKS HANDLING:
+
+Some ADSL providers and some ADSL hardware are buggy or not conforming
+to the RFC, and require special handling. To this end, pptp now
+supports a 'quirks' mechanism. Currently, only '--quirks BEZEQ_ISRAEL'
+is defined,for conneting to Bezeq (the Israeli phone company) ADSL
+service. (Note: only *some* of the equipment used by bezeq needs
+this option, but even the equipment that does not need it works fine
+with it. If you use Bezeq, you probably want the '--quirks
+BEZEQ_ISRAEL' switch). More information on Bezeq's ADSL service can be
+found at http://www.pointer.co.il/~mulix/adsl-howto.txt and
+http://damyen.technion.ac.il/~dani/adsl-howto.txt.
diff -ur --exclude CVS pptp-linux/orckit_quirks.c pptp-mulix/orckit_quirks.c
--- pptp-linux/orckit_quirks.c	Tue Nov 20 08:30:10 2001
+++ pptp-mulix/orckit_quirks.c	Tue Nov 20 10:52:10 2001
@@ -17,8 +17,7 @@
 int
 orckit_atur3_build_hook(struct pptp_out_call_rqst* packet)
 {
-
-    unsigned int length = 10;
+    unsigned int name_length = 10;

     struct pptp_out_call_rqst fixed_packet = {
 	PPTP_HEADER_CTRL(PPTP_OUT_CALL_RQST),
@@ -26,7 +25,7 @@
 	0, /* hton16(call->sernum) */
 	hton32(PPTP_BPS_MIN), hton32(PPTP_BPS_MAX),
 	hton32(PPTP_BEARER_DIGITAL), hton32(PPTP_FRAME_ANY),
-	hton16(PPTP_WINDOW), 0, hton16(length), 0,
+	hton16(PPTP_WINDOW), 0, hton16(name_length), 0,
 	{'R','E','L','A','Y','_','P','P','P','1',0}, {0}
     };

@@ -35,7 +34,6 @@

     memcpy(packet, &fixed_packet, sizeof(*packet));

-    log("%s called\n", __FUNCTION__);
     return 0;
 }

@@ -58,8 +56,9 @@
     return 0;
 }

+/* return 0 on success, non 0 otherwise */
 int
-orckit_atur3_start_ctrl_conn(struct pptp_start_ctrl_conn* packet)
+orckit_atur3_start_ctrl_conn_hook(struct pptp_start_ctrl_conn* packet)
 {
     struct pptp_start_ctrl_conn fixed_packet = {
 	{0}, /* we'll set the header later */
diff -ur --exclude CVS pptp-linux/orckit_quirks.h pptp-mulix/orckit_quirks.h
--- pptp-linux/orckit_quirks.h	Tue Nov 20 08:30:10 2001
+++ pptp-mulix/orckit_quirks.h	Tue Nov 20 10:28:35 2001
@@ -22,6 +22,6 @@

 /* return 0 on success, non zero otherwise */
 int
-orckit_atur3_start_ctrl_conn(struct pptp_start_ctrl_conn* packet);
+orckit_atur3_start_ctrl_conn_hook(struct pptp_start_ctrl_conn* packet);

 #endif /* INC_ORCKIT_QUIRKS_H_ */
Binary files pptp-linux/pptp and pptp-mulix/pptp differ
diff -ur --exclude CVS pptp-linux/pptp.c pptp-mulix/pptp.c
--- pptp-linux/pptp.c	Tue Nov 20 10:16:15 2001
+++ pptp-mulix/pptp.c	Tue Nov 20 10:50:58 2001
@@ -50,11 +50,10 @@
 void usage(char *progname) {
   fprintf(stderr,
 	  "%s\n"
-	  "patched by mulix <mulix@actcom.co.il> for Bezeq, Israel\n"
 	  "Usage:\n"
 	  " %s hostname [[--phone <phone number>] [--quirks ISP_NAME] -- ][ pppd options]\n"
 	  "\nOr using pppd option pty: \n"
-	  " pty \" %s hostname --nolaunchpppd [--phone <phone number>]\"\n"
+	  " pty \" %s hostname --nolaunchpppd [--phone <phone number>] [--quirks ISP_NAME]\"\n"
 	  "Currently recognized ISP_NAMEs for quirks are BEZEQ_ISRAEL\n",
 	  version, progname, progname);
   log("%s called with wrong arguments, program not started.", progname);
Binary files pptp-linux/pptp_callmgr and pptp-mulix/pptp_callmgr differ
diff -ur --exclude CVS pptp-linux/pptp_ctrl.c pptp-mulix/pptp_ctrl.c
--- pptp-linux/pptp_ctrl.c	Tue Nov 20 10:16:15 2001
+++ pptp-mulix/pptp_ctrl.c	Tue Nov 20 10:59:21 2001
@@ -119,7 +119,10 @@
 void pptp_dispatch_packet(PPTP_CONN * conn, void * buffer, size_t size);
 /* Dispatch packets (control messages) */
 void pptp_dispatch_ctrl_packet(PPTP_CONN * conn, void * buffer, size_t size);
-/* Set link info, for pptp servers that need it */
+/* Set link info, for pptp servers that need it.
+   this is a noop, unless the user specified a quirk and
+   there's a set_link hook defined in the quirks table
+   for that quirk */
 void pptp_set_link(PPTP_CONN * conn, int peer_call_id);
 /*----------------------------------------------------------------------*/
 /* Constructors and Destructors.                                        */
@@ -164,10 +167,12 @@
     };

     /* fix this packet, if necessary */
-    int idx;
-    if ((idx = get_quirk_index()) != -1 && pptp_fixups[idx].start_ctrl_conn)
-	pptp_fixups[idx].start_ctrl_conn(&packet);
-
+    int idx, rc;
+    if ((idx = get_quirk_index()) != -1 && pptp_fixups[idx].start_ctrl_conn) {
+	if ((rc = pptp_fixups[idx].start_ctrl_conn(&packet)))
+	    warn("calling the start_ctrl_conn hook failed (%d)", rc);
+    }
+
     if (pptp_send_ctrl_packet(conn, &packet, sizeof(packet)))
       conn->conn_state = CONN_WAIT_CTL_REPLY;
     else return NULL; /* could not send initial start request. */
@@ -222,10 +227,13 @@
       hton16(PPTP_WINDOW), 0, 0, 0, {0}, {0}
     };

-    int idx;
+    int idx, rc;
     /* if we have a quirk, build a new packet to fit it */
-    if ((idx = get_quirk_index()) != -1 && pptp_fixups[idx].out_call_rqst_hook)
-      pptp_fixups[idx].out_call_rqst_hook(&packet);
+    if ((idx = get_quirk_index()) != -1 && pptp_fixups[idx].out_call_rqst_hook) {
+	if ((rc = pptp_fixups[idx].out_call_rqst_hook(&packet)))
+	    warn("calling the out_call_rqst hook failed (%d)", rc);
+    }
+

     /* fill in the phone number if it was specified */
     if( phonenr ){
@@ -516,9 +524,11 @@
 	PPTP_HOSTNAME, PPTP_VENDOR };

       /* fix this packet, if necessary */
-      int idx;
-      if ((idx = get_quirk_index()) != -1 && pptp_fixups[idx].start_ctrl_conn)
-	  pptp_fixups[idx].start_ctrl_conn(&reply);
+      int idx, rc;
+      if ((idx = get_quirk_index()) != -1 && pptp_fixups[idx].start_ctrl_conn) {
+	  if ((rc = pptp_fixups[idx].start_ctrl_conn(&reply)))
+	      warn("calling the start_ctrl_conn hook failed (%d)", rc);
+      }

       if (conn->conn_state == CONN_IDLE) {
 	if (ntoh16(packet->version) < PPTP_VERSION) {
@@ -683,7 +693,9 @@
 	  call->peer_call_id = ntoh16(packet->call_id);
 	  call->speed        = ntoh32(packet->speed);
 	  pptp_reset_timer();
-	  pptp_set_link(conn, call->peer_call_id);
+	  /* call pptp_set_link. unless the user specified a quirk
+	     and this quirk has a set_link hook, this is a noop */
+ 	  pptp_set_link(conn, call->peer_call_id);

 	  if (call->callback!=NULL) call->callback(conn, call, CALL_OPEN_DONE);
 	  log("Outgoing call established (call ID %u, peer's call ID %u).\n",
@@ -758,16 +770,16 @@
 void
 pptp_set_link(PPTP_CONN* conn, int peer_call_id)
 {
-    int idx;
+    int idx, rc;

     /* if we need to send a set_link packet because of buggy
        hardware or pptp server, do it now */
     if ((idx = get_quirk_index()) != -1 && pptp_fixups[idx].set_link_hook) {
 	struct pptp_set_link_info packet;
-	pptp_fixups[idx].set_link_hook(&packet, peer_call_id);
+	if ((rc = pptp_fixups[idx].set_link_hook(&packet, peer_call_id)))
+	    warn("calling the set_link hook failed (%d)", rc);

 	if (pptp_send_ctrl_packet(conn, &packet, sizeof(packet))) {
-	    log("pptp_set_link() packet sending succesfull");
 	    pptp_reset_timer();
 	}
     }
diff -ur --exclude CVS pptp-linux/pptp_quirks.c pptp-mulix/pptp_quirks.c
--- pptp-linux/pptp_quirks.c	Tue Nov 20 08:30:10 2001
+++ pptp-mulix/pptp_quirks.c	Tue Nov 20 10:39:38 2001
@@ -13,7 +13,7 @@
 struct pptp_fixup pptp_fixups[] = {
     {BEZEQ_ISRAEL, ORCKIT, ORCKIT_ATUR3,
      orckit_atur3_build_hook,
-     orckit_atur3_start_ctrl_conn,
+     orckit_atur3_start_ctrl_conn_hook,
      orckit_atur3_set_link_hook}
 };

-- 
mulix

http://www.pointer.co.il/~mulix/
http://syscalltrack.sf.net/



_______________________________________________
pptpclient-devel mailing list
pptpclient-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pptpclient-devel

