From owner-freebsd-questions Mon Feb 3 12:48:19 2003 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6DB9737B401; Mon, 3 Feb 2003 12:48:13 -0800 (PST) Received: from scl8owa02.int.exodus.net (scl8out02.exodus.net [66.35.230.242]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6508643E4A; Mon, 3 Feb 2003 12:48:12 -0800 (PST) (envelope-from Maksim.Yevmenkin@cw.com) Received: from scl8owa01.int.exodus.net ([66.35.230.241]) by scl8owa02.int.exodus.net with Microsoft SMTPSVC(5.0.2195.5329); Mon, 3 Feb 2003 12:48:12 -0800 Received: from exodus.net ([165.193.27.35]) by scl8owa01.int.exodus.net over TLS secured channel with Microsoft SMTPSVC(5.0.2195.5329); Mon, 3 Feb 2003 12:48:11 -0800 Message-ID: <3E3ED4DF.7090904@exodus.net> Date: Mon, 03 Feb 2003 12:45:19 -0800 From: Maksim Yevmenkin User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.1) Gecko/20021126 X-Accept-Language: en-us, en MIME-Version: 1.0 To: hackers@FreeBSD.ORG, questions@FreeBSD.ORG, brian@freebsd.org Cc: doconnor@gsoft.com.au, imp@bsdimp.com Subject: [PATCH] PPP in -direct mode does not execute any chat scripts References: <45258A4365C6B24A9832BFE224837D552B1283@sjdcex01.int.exodus.net> Content-Type: multipart/mixed; boundary="------------040507020505080405040700" X-OriginalArrivalTime: 03 Feb 2003 20:48:11.0684 (UTC) FILETIME=[90B91640:01C2CBC5] Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG This is a multi-part message in MIME format. --------------040507020505080405040700 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Dear Hackers, Please find attached patch that adds new option to the PPP. run-scripts-in-direct-mode Default: Disabled. This allows to run chat scripts in direct mode. did i miss anything? objections? comments? reviews? thanks, max > I'm working on the Bluetooth stack for FreeBSD and currently > doing testing for new in-kernel RFCOMM code. RFCOMM is a way > to emulate serial link over Bluetooth. > > In particular Bluetooth spec defines two RFCOMM based profiles > LAN (Network Access profile) and DUN (DialUp Networking profile). > Both profiles use PPP. > > My current in-kernel RFCOMM code provides SOCK_STREAM sockets > interface, i.e. when application wants to talk RFCOMM it just > opens a socket. The next step is to run PPP, so the launcher > program opens RFCOMM connection then dup() socket to stdin and > stdout and exec() PPP in direct mode. > > Everything works great for the LAN profile, where null-modem > connection is assumed and both client and server start talking > PPP right after RFCOMM connection is established. > > However the DUN profile is more tricky. In this scenario client > just connected to the virtual serial port on the server. Now to > start PPP session client must "dial a number". i.e. there is > still need for a little chat script. > > Here is an example: > > 1) I'd like to use my GPRS and Bluetooth enabled cell phone to > access the Internet > 2) I open a RFCOMM connection to the cell phone and get connected > to the virtual serial port on the cell phone. > 3) Now i must dial a "special" GRPS number, i.e. something like > ATD*98***1# and wait for CONNECT string from the phone > 4) Now i can talk PPP. > > So the questions is: would it be possible to enable PPP chat > in "direct" mode? Is there any reason to not allow this? It > seems 'login' script would do just fine. Is there any other/ > better way to do this? One possible option right now is to > execute /bin/chat from the launcher program before executing > PPP, but i'd rather keep all chat scripts in PPP. > > thanks, > max --------------040507020505080405040700 Content-Type: text/plain; name="ppp.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="ppp.diff" diff -ru8 ppp.orig/bundle.h ppp/bundle.h --- ppp.orig/bundle.h Mon Feb 3 10:34:44 2003 +++ ppp/bundle.h Mon Feb 3 10:36:56 2003 @@ -44,16 +44,17 @@ #define OPT_LOOPBACK 0x0040 #define OPT_PASSWDAUTH 0x0080 #define OPT_PROXY 0x0100 #define OPT_PROXYALL 0x0200 #define OPT_SROUTES 0x0400 #define OPT_TCPMSSFIXUP 0x0800 #define OPT_THROUGHPUT 0x1000 #define OPT_UTMP 0x2000 +#define OPT_RSIDM 0x4000 /* run-scripts-in-direct-mode */ #define MAX_ENDDISC_CLASS 5 #define Enabled(b, o) ((b)->cfg.opt & (o)) /* AutoAdjust() values */ #define AUTO_UP 1 #define AUTO_DOWN 2 diff -ru8 ppp.orig/command.c ppp/command.c --- ppp.orig/command.c Mon Feb 3 10:34:45 2003 +++ ppp/command.c Mon Feb 3 10:57:05 2003 @@ -2851,29 +2851,32 @@ {"loopback", NULL, OptSet, LOCAL_AUTH, "Loop packets for local iface", "disable|enable", (const void *)OPT_LOOPBACK}, {"passwdauth", NULL, OptSet, LOCAL_AUTH, "Use passwd file", "disable|enable", (const void *)OPT_PASSWDAUTH}, {"proxy", NULL, OptSet, LOCAL_AUTH, "Create a proxy ARP entry", "disable|enable", (const void *)OPT_PROXY}, {"proxyall", NULL, OptSet, LOCAL_AUTH, "Proxy ARP for all remote hosts", "disable|enable", (const void *)OPT_PROXYALL}, + {"run-scripts-in-direct-mode", NULL, OptSet, LOCAL_AUTH, + "Run char scripts in direct mode", "disable|enable", + (const void *)OPT_RSIDM}, {"sroutes", NULL, OptSet, LOCAL_AUTH, "Use sticky routes", "disable|enable", (const void *)OPT_SROUTES}, {"tcpmssfixup", "mssfixup", OptSet, LOCAL_AUTH, "Modify MSS options", "disable|enable", (const void *)OPT_TCPMSSFIXUP}, {"throughput", NULL, OptSet, LOCAL_AUTH, "Rolling throughput", "disable|enable", (const void *)OPT_THROUGHPUT}, {"utmp", NULL, OptSet, LOCAL_AUTH, "Log connections in utmp", "disable|enable", (const void *)OPT_UTMP}, #ifndef NOINET6 -#define OPT_MAX 13 /* accept/deny allowed below and not above */ +#define OPT_MAX 14 /* accept/deny allowed below and not above */ #else -#define OPT_MAX 11 +#define OPT_MAX 12 #endif {"acfcomp", NULL, NegotiateSet, LOCAL_AUTH | LOCAL_CX, "Address & Control field compression", "accept|deny|disable|enable", (const void *)NEG_ACFCOMP}, {"chap", "chap05", NegotiateSet, LOCAL_AUTH | LOCAL_CX, "Challenge Handshake Authentication Protocol", "accept|deny|disable|enable", (const void *)NEG_CHAP05}, diff -ru8 ppp.orig/datalink.c ppp/datalink.c --- ppp.orig/datalink.c Mon Feb 3 10:34:45 2003 +++ ppp/datalink.c Mon Feb 3 11:03:48 2003 @@ -956,17 +956,18 @@ free(dl); return result; } void datalink_Up(struct datalink *dl, int runscripts, int packetmode) { - if (dl->physical->type & (PHYS_DIRECT|PHYS_DEDICATED)) + if ((dl->physical->type & PHYS_DEDICATED) || + ((dl->physical->type & PHYS_DIRECT) && !Enabled(dl->bundle, OPT_RSIDM))) /* Ignore scripts */ runscripts = 0; switch (dl->state) { case DATALINK_CLOSED: if (bundle_Phase(dl->bundle) == PHASE_DEAD || bundle_Phase(dl->bundle) == PHASE_TERMINATE) bundle_NewPhase(dl->bundle, PHASE_ESTABLISH); diff -ru8 ppp.orig/ppp.8.m4 ppp/ppp.8.m4 --- ppp.orig/ppp.8.m4 Mon Feb 3 10:34:46 2003 +++ ppp/ppp.8.m4 Mon Feb 3 12:23:52 2003 @@ -3089,16 +3089,20 @@ Proxy arp entries are only made for sticky routes that are added using the .Dq add command. No proxy arp entries are made for the interface address itself (as created by the .Dq set ifaddr command). +.It run-scripts-in-direct-mode +Default: Disabled. This allows to run chat scripts in +.Dv direct +mode. .It sroutes Default: Enabled. When the .Dq add command is used with the .Dv HISADDR , .Dv MYADDR , .Dv HISADDR6 --------------040507020505080405040700-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message