G'day mulix,

Thank you for your patch to pptp that adds support for Bezeq.

I'm the pptp-client project administrator, or release engineer, and I've
taken on the job in the past few months.

My comments on your patch follow:

- I'm wondering if the #define should be something other than Bezeq. 
Have you heard if any other implementations need this change?  Have you
any idea what software or hardware Bezeq is using to deliver ADSL?

- can this code change be added as a configuration option rather than an
#ifdef?

- changes are made to pptp_options.h for Bezeq, but some of them are
ignored by the struct pptp_out_call_rqst packet changes.  Would it be
possible to define additional constants so that the code that
initialises the struct has no #ifdef?  In other words, can the changes
be isolated somehow in order to simplify the code.

- do the changes to add pptp_set_link need to be #ifdef'd?  Has this
been tested with conventional PPTP environments?

- the changes to the error reporting are good, they improve the
situation.

Patch relative to current CVS is attached.  No significant changes made,
just made sure it applies cleanly.

-- 
James Cameron
http://quozl.linux.org.au/
Index: Makefile
===================================================================
RCS file: /cvsroot/pptpclient/pptp-linux/Makefile,v
retrieving revision 1.4
diff -u -u -r1.4 Makefile
--- Makefile    2001/05/11 07:48:14     1.4
+++ Makefile    2001/11/13 03:33:49
@@ -1,10 +1,11 @@
 VERSION = 1.0.3
 VERSION_DEFINE = '-DPPTP_LINUX_VERSION="${VERSION}"'
+COUNTRY_DEFINE = '-DPPTP_BEZEQ_ISRAEL=1'
 
 CC     = gcc -Wall
 DEBUG  = -g
 INCLUDE =
-CFLAGS  = -O1 $(VERSION_DEFINE) $(DEBUG) $(INCLUDE) -DPROGRAM_NAME=\"pptp\"
+CFLAGS  = -O1 $(VERSION_DEFINE) $(DEBUG) $(COUNTRY_DEFINE) $(INCLUDE) 
+-DPROGRAM_NAME=\"pptp\"
 LIBS   =
 LDFLAGS        = -lutil
 
Index: pptp.c
===================================================================
RCS file: /cvsroot/pptpclient/pptp-linux/pptp.c,v
retrieving revision 1.7
diff -u -u -r1.7 pptp.c
--- pptp.c      2001/08/06 07:31:50     1.7
+++ pptp.c      2001/11/13 03:33:54
@@ -49,6 +49,7 @@
 void usage(char *progname) {
   fprintf(stderr,
          "%s\n"
+         "patched by mulix <[EMAIL PROTECTED]> for Israel\n"
         "Usage:\n"
         " %s hostname [[--phone <phone number>] -- ][ pppd options]\n"
          "\nOr using pppd option pty: \n"
Index: pptp_ctrl.c
===================================================================
RCS file: /cvsroot/pptpclient/pptp-linux/pptp_ctrl.c,v
retrieving revision 1.4
diff -u -u -r1.4 pptp_ctrl.c
--- pptp_ctrl.c 2001/04/30 03:42:36     1.4
+++ pptp_ctrl.c 2001/11/13 03:34:03
@@ -205,13 +205,25 @@
   call->closure   = NULL;
   /* Send off the call request */
   {
-    struct pptp_out_call_rqst packet = {
+    struct pptp_out_call_rqst packet =
+#ifndef PPTP_BEZEQ_ISRAEL
+    {
       PPTP_HEADER_CTRL(PPTP_OUT_CALL_RQST),
       hton16(call->call_id), hton16(call->sernum),
       hton32(PPTP_BPS_MIN), hton32(PPTP_BPS_MAX),
       hton32(PPTP_BEARER_CAP), hton32(PPTP_FRAME_CAP), 
       hton16(PPTP_WINDOW), 0, 0, 0, {0}, {0}
     };
+#else /* PPTP_BEZEQ_ISRAEL is defined */
+    {
+      PPTP_HEADER_CTRL(PPTP_OUT_CALL_RQST),
+      0, /* hton16(call->callid) */
+      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(PPTP_HOSTNAME_LEN),0, PPTP_HOSTNAME, {0}
+    };
+#endif
 
     /* fill in the phone number if it was specified */
     if( phonenr ){
@@ -473,6 +485,22 @@
   }
 }
 
+static void
+pptp_set_link(PPTP_CONN* conn, int peer_call_id)
+{
+     struct pptp_set_link_info packet = {
+         PPTP_HEADER_CTRL(PPTP_SET_LINK_INFO),
+         hton16(peer_call_id),
+         0,
+         0xffffffff,
+         0xffffffff};
+
+     if (pptp_send_ctrl_packet(conn, &packet, sizeof(packet))) {
+         log("pptp_set_link() packet sending succesfull");
+         pptp_reset_timer();
+     }
+}
+
 void pptp_dispatch_ctrl_packet(PPTP_CONN * conn, void * buffer, size_t size) {
   struct pptp_header *header = (struct pptp_header *)buffer;
   u_int8_t close_reason = PPTP_STOP_NONE;
@@ -639,8 +667,21 @@
       if (call->state.pns == PNS_WAIT_REPLY) {
        /* check for errors */
        if (packet->result_code!=1) {
-         /* An error.  Log it. */
-         log("Error opening call. [callid %d]", (int) callid);
+         /* An error.  Log it verbosely. */
+         unsigned int legal_error_value =
+              sizeof(pptp_general_errors)/sizeof(pptp_general_errors[0]);
+         int err = packet->error_code;
+          log("Error '%d' opening call. [callid %d]",
+             packet->result_code, (int) callid);
+          log("Error code is '%d', Cause code is '%d'", err,
+             packet->cause_code);
+          if ((err > 0) && (err < legal_error_value)){
+            log("Error is '%s', Error message: '%s'",
+            pptp_general_errors[err].name,
+            pptp_general_errors[err].desc);
+         }
+
+
          call->state.pns = PNS_IDLE;
          if (call->callback!=NULL) call->callback(conn, call, CALL_OPEN_FAIL);
          pptp_call_destroy(conn, call);
@@ -650,6 +691,7 @@
          call->peer_call_id = ntoh16(packet->call_id);
          call->speed        = ntoh32(packet->speed);
          pptp_reset_timer();
+         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",
                call->call_id, call->peer_call_id);
Index: pptp_options.h
===================================================================
RCS file: /cvsroot/pptpclient/pptp-linux/pptp_options.h,v
retrieving revision 1.2
diff -u -u -r1.2 pptp_options.h
--- pptp_options.h      2000/12/23 08:32:15     1.2
+++ pptp_options.h      2001/11/13 03:34:08
@@ -18,22 +18,37 @@
 #define PPTP_BPS_MIN 2400
 #define PPTP_BPS_MAX 10000000
 
-#ifndef STANDARD
-#define PPTP_MAX_CHANNELS 65535
-#define PPTP_FIRMWARE_STRING "0.01"
-#define PPTP_FIRMWARE_VERSION 0x001
-#define PPTP_HOSTNAME {'l','o','c','a','l',0}
-#define PPTP_VENDOR   {'c','a','n','a','n','i','a','n',0}
-#define PPTP_FRAME_CAP  PPTP_FRAME_ANY
-#define PPTP_BEARER_CAP PPTP_BEARER_ANY
-#else
+/* define STANDARD to emulate NT 4.0 */
+#ifdef STANDARD
 #define PPTP_MAX_CHANNELS 5
 #define PPTP_FIRMWARE_STRING "0.01"
 #define PPTP_FIRMWARE_VERSION 0
 #define PPTP_HOSTNAME {'l','o','c','a','l',0}
+#define PPTP_HOSTNAME_LEN 5
 #define PPTP_VENDOR   {'N','T',0}
 #define PPTP_FRAME_CAP  2
 #define PPTP_BEARER_CAP 1
-#endif
 
+/* define PPTP_BEZEQ_ISRAEL to be able to connec to BEZEQ's ADSL service */
+#elif defined PPTP_BEZEQ_ISRAEL
+#define PPTP_MAX_CHANNELS 0
+#define PPTP_FIRMWARE_STRING "0x6021"
+#define PPTP_FIRMWARE_VERSION 0x6021
+#define PPTP_HOSTNAME {'R','E','L','A','Y','_','P','P','P','1',0}
+#define PPTP_HOSTNAME_LEN 10
+#define PPTP_VENDOR   {'M','S',' ','W','i','n',' ','N','T',0}
+#define PPTP_FRAME_CAP  PPTP_FRAME_ASYNC
+#define PPTP_BEARER_CAP PPTP_BEARER_ANALOG
+
+/* default behaviour */
+#else
+#define PPTP_MAX_CHANNELS 65535
+#define PPTP_FIRMWARE_STRING "0.01"
+#define PPTP_FIRMWARE_VERSION 0x001
+#define PPTP_HOSTNAME {'l','o','c','a','l',0}
+#define PPTP_HOSTNAME_LEN 5
+#define PPTP_VENDOR   {'c','a','n','a','n','i','a','n',0}
+#define PPTP_FRAME_CAP  PPTP_FRAME_ANY
+#define PPTP_BEARER_CAP PPTP_BEARER_DIGITAL
+#endif
 #endif /* INC_PPTP_OPTIONS_H */

Reply via email to