[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RFC: required patch to pptp 1.0.3 for israeli adsl service
- To: <pptpclient-devel(at-nospam)lists.sourceforge.net>
- Subject: RFC: required patch to pptp 1.0.3 for israeli adsl service
- From: mulix <mulix(at-nospam)actcom.co.il>
- Date: Tue, 13 Nov 2001 00:04:19 +0200 (IST)
- Cc: <linux-il(at-nospam)linux.org.il>
- Delivered-To: linux.org.il-linux-il@linux.org.il
- Sender: linux-il-bounce(at-nospam)cs.huji.ac.il
hello,
i'd like to solicite comments for the attached patch to pptp-1.0.3. this
patch is required for pptp to work with the adsl equipment used by the
single adsl provider in israel. it's been in use for the last year and
works with all adsl modem types, while vanilla pptp-1.0.3 fails with at
least some modems.
i'm not suggesting for the patch to be applied in its current form, but
i would like to solicit comments on how it can be changed so that it
will be applied. in particular, how should the country specific
information be handled?
this patch is based on an earlier patch we did to pptp-1.0.2. both are
available at http://www.pointer.co.il/~mulix/. the original patch
(against 1.0.2) was derived from watching packet dumps of succesful
windows connections vs. failed linux connections, and the 1.0.3 patch
was a merge of the 1.0.2 patch with the original pptp 1.0.3.
diff -ur pptp-linux-1.0.3/Makefile pptp-mulix-1.0.3/Makefile
--- pptp-linux-1.0.3/Makefile Mon May 7 06:19:34 2001
+++ pptp-mulix-1.0.3/Makefile Fri Jun 8 23:41:01 2001
@@ -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
Only in pptp-mulix-1.0.3/: pptp
diff -ur pptp-linux-1.0.3/pptp.c pptp-mulix-1.0.3/pptp.c
--- pptp-linux-1.0.3/pptp.c Mon Apr 30 06:42:36 2001
+++ pptp-mulix-1.0.3/pptp.c Fri Jun 8 23:42:09 2001
@@ -42,6 +42,7 @@
void usage(char *progname) {
fprintf(stderr,
"%s\n"
+ "patched by mulix <mulix@actcom.co.il> for Israel\n"
"Usage:\n"
" %s hostname [[--phone <phone number>] -- ][ pppd options]\n",
version, progname);
Only in pptp-mulix-1.0.3/: pptp_callmgr
diff -ur pptp-linux-1.0.3/pptp_ctrl.c pptp-mulix-1.0.3/pptp_ctrl.c
--- pptp-linux-1.0.3/pptp_ctrl.c Mon Apr 30 06:42:36 2001
+++ pptp-mulix-1.0.3/pptp_ctrl.c Fri Jun 8 23:55:01 2001
@@ -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);
diff -ur pptp-linux-1.0.3/pptp_options.h pptp-mulix-1.0.3/pptp_options.h
--- pptp-linux-1.0.3/pptp_options.h Sat Dec 23 10:32:15 2000
+++ pptp-mulix-1.0.3/pptp_options.h Fri Jun 8 23:59:20 2001
@@ -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 */
--
mulix
http://www.pointer.co.il/~mulix/
http://syscalltrack.sf.net/
=================================================================
To unsubscribe, send mail to linux-il-request@linux.org.il with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail linux-il-request@linux.org.il