1.\" Copyright (c) 2001-2003 Maksim Yevmenkin <m_evmenkin@yahoo.com> 2.\" All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright 10.\" notice, this list of conditions and the following disclaimer in the 11.\" documentation and/or other materials provided with the distribution. 12.\" 13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23.\" SUCH DAMAGE. 24.\" 25.\" $Id: rfcomm_pppd.8,v 1.7 2003/09/07 18:32:11 max Exp $ 26.\" 27.Dd February 4, 2003 28.Dt RFCOMM_PPPD 8 29.Os 30.Sh NAME 31.Nm rfcomm_pppd 32.Nd RFCOMM PPP daemon 33.Sh SYNOPSIS 34.Nm 35.Fl c 36.Op Fl dh 37.Fl a Ar address 38.Fl C Ar channel 39.Fl l Ar label 40.Fl u Ar N 41.Nm 42.Fl s 43.Op Fl dDhS 44.Op Fl a Ar address 45.Fl C Ar channel 46.Fl l Ar label 47.Sh DESCRIPTION 48The 49.Nm 50daemon is a simple wrapper daemon that allows the use of 51.Xr ppp 8 52via an RFCOMM connection. 53It can operate in two modes: client and server. 54.Pp 55In client mode, 56.Nm 57opens an RFCOMM connection to the specified server's 58.Ar BD_ADRR 59and 60.Ar channel . 61Once the RFCOMM connection is established, 62.Nm 63executes 64.Xr ppp 8 65in 66.Fl direct 67mode with the specified 68.Ar label . 69Likewise, 70.Xr ppp 8 71operates over the RFCOMM connection just like it would over a standard serial 72port, thus allowing a user to 73.Dq "dial out" 74and connect to the Internet. 75.Pp 76In server mode, 77.Nm 78opens an RFCOMM socket and listens for incoming connections from remote clients. 79Once the new incoming connection is accepted, 80.Nm 81forks and executes 82.Xr ppp 8 83in 84.Fl direct 85mode with the specified 86.Ar label . 87Likewise, 88.Xr ppp 8 89operates over the RFCOMM connection just like it would over a standard serial 90port, thus providing network connectivity to remote clients. 91.Pp 92The options are as follows: 93.Bl -tag -width indent 94.It Fl a Ar address 95In client mode, this required option specifies the address of the remote 96RFCOMM server. 97In server mode, this option can be used to specify the local 98address to listen on. 99By default, in server mode, the daemon will listen on 100.Dv ANY 101address. 102The address can be specified as BD_ADDR or name. 103If a name was specified, the 104.Nm 105utility will attempt to resolve the name via 106.Xr bt_gethostbyname 3 . 107.It Fl C Ar channel 108In both client and server mode, this required option specifies the RFCOMM 109channel to connect to or listen on. 110In server mode, the channel should be a number between 1 and 30. 111In client mode, the channel could either be a number between 1 and 30 112or a service name. 113Supported service names are: 114.Cm DUN 115(Dial-Up Networking) and 116.Cm LAN 117(LAN Access Using PPP). 118If a service name is used instead of a numeric channel number, then 119.Nm 120will try to obtain an RFCOMM channel number via SDP 121(Service Discovery Protocol). 122.It Fl c 123Act as an RFCOMM client. 124This is the default mode. 125.It Fl d 126Do not detach from the controlling terminal, i.e., run in foreground. 127.It Fl D 128In server mode, register the 129.Cm DUN 130(Dial-Up Networking) service in addition to the 131.Cm LAN 132(LAN Access Using PPP) service. 133AT-command exchange can be faked with 134.Xr ppp 8 135chat script. 136.It Fl h 137Display usage message and exit. 138.It Fl l Ar label 139In both client and server mode, this required option specifies which 140.Xr ppp 8 141label will be used. 142.It Fl S 143In server mode, register the 144.Cm SP 145(Serial Port) service in addition to the 146.Cm LAN 147(LAN Access Using PPP) service. 148.Pp 149It appears that some cell phones are using the so-called 150.Dq "callback mechanism" . 151In this scenario, the user is trying to connect his cell phone to the Internet, 152while the user's host computer is acting as the gateway server. 153It seems that it is not possible to tell the phone to just connect and start 154using the 155.Cm LAN 156service. 157Instead, the user's host computer must 158.Dq "jump start" 159the phone by connecting to the phone's 160.Cm SP 161service. 162What happens next is the phone kills the existing connection and opens another 163connection back to the user's host computer. 164The phone really wants to use the 165.Cm LAN 166service, but for whatever reason it looks for the 167.Cm SP 168service on the user's host computer. 169This brain-damaged behavior was reported for the Nokia 6600 and the 170Sony/Ericsson P900. 171.It Fl s 172Act as an RFCOMM server. 173.It Fl u Ar N 174This option maps directly to the 175.Fl unit 176.Xr ppp 8 177command-line option and tells 178.Nm 179to instruct 180.Xr ppp 8 181to only attempt to open 182.Pa /dev/tun Ns Ar N . 183This option only works in client mode. 184.El 185.Sh PPP CONFIGURATION 186.Ss Important Notes on PPP Configuration 187Special attention is required when adding new RFCOMM configurations to the 188existing PPP configuration. 189Please keep in mind that PPP will 190.Em always 191execute commands in the 192.Dq Li default 193label of your 194.Pa /etc/ppp/ppp.conf 195file. 196Please make sure that the 197.Dq Li default 198label 199.Em only 200contains commands that apply to 201.Em every 202other label. 203If you need to use PPP for both dialing out and accepting incoming 204RFCOMM connections, please make sure you have moved all commands related to 205dialing out from the 206.Dq Li default 207section into an appropriate outgoing label. 208.Ss RFCOMM Server 209One of the typical examples is the LAN access. 210In this example, an RFCOMM connection 211is used as a null-modem connection between a client and a server. 212Both client and server will start talking PPP right after the RFCOMM 213connection has been established. 214.Bd -literal -offset indent 215rfcomm-server: 216 set timeout 0 217 set lqrperiod 10 218 set ifaddr 10.0.0.1 10.0.0.2 255.255.255.0 219 enable lqr 220 accept lqr 221 accept dns 222 # Do not use PPP authentication. Assume that 223 # Bluetooth connection was authenticated already 224 disable pap 225 deny pap 226 disable chap 227 deny chap 228.Ed 229.Ss RFCOMM Client 230The 231.Nm 232utility supports both 233.Cm LAN 234(LAN Access Using PPP) and 235.Cm DUN 236(Dial-Up Networking) access. 237The client's configuration for 238.Cm LAN 239access is very similar to the server's and might look like this: 240.Bd -literal -offset indent 241rfcomm-client: 242 enable lqr 243 accept lqr 244 set dial 245 set timeout 0 246 disable iface-alias 247 set ifaddr 10.0.0.1/0 10.0.0.2/0 255.255.255.0 0.0.0.0 248 # Do not use PPP authentication. Assume that 249 # Bluetooth connection was authenticated already 250 deny pap 251 disable pap 252 deny chap 253 disable chap 254.Ed 255.Pp 256The client's configuration for 257.Cm DUN 258access is different. 259In this scenario, the client gets connected to the virtual serial port on the 260server. 261To open a PPP session, the client must dial a number. 262Note that by default 263.Xr ppp 8 264will not execute any configured chat scripts. 265The 266.Ic force-scripts 267option can be used to override this behavior. 268An example configuration is shown below: 269.Bd -literal -offset indent 270rfcomm-dialup: 271 # This is IMPORTANT option 272 enable force-scripts 273 274 # You might want to change these 275 set authname 276 set authkey 277 set phone "*99***1#" 278 279 # You might want to adjust dial string as well 280 set dial "ABORT BUSY ABORT NO\\\\sCARRIER TIMEOUT 5 \\ 281 \\"\\" AT OK-AT-OK ATE1Q0 OK \\\\dATDT\\\\T TIMEOUT 40 CONNECT" 282 set login 283 set timeout 30 284 enable dns 285 resolv rewrite 286 287 set ifaddr 10.0.0.1/0 10.0.0.2/0 255.255.255.0 0.0.0.0 288 add default HISADDR 289.Ed 290.Pp 291Note that by adjusting the initialization string, one can make a CSD (Circuit 292Switched Data), HSCSD (High Speed Circuit Switched Data) or GPRS (General 293Packet Radio Service) connection. 294The availability of the particular connection 295type depends on the phone model and service plan activated on the phone. 296.Sh EXIT STATUS 297.Ex -std 298.Sh EXAMPLES 299.Dl "rfcomm_pppd -s -a 00:01:02:03:04:05 -C 1 -l rfcomm-server" 300.Pp 301This command will start 302.Nm 303in the server mode. 304The RFCOMM server will listen on local address 305.Li 00:01:02:03:04:05 306and channel 307.Li 1 . 308Once the incoming connection has been accepted, 309.Nm 310will execute 311.Xr ppp 8 312in 313.Fl direct 314mode with the 315.Dq Li rfcomm-server 316label. 317.Pp 318.Dl "rfcomm_pppd -c -a 00:01:02:03:04:05 -C 1 -l rfcomm-client" 319.Pp 320This command will start 321.Nm 322in the client mode. 323.Nm 324will try to connect to the RFCOMM server at 325.Li 00:01:02:03:04:05 326address and channel 327.Li 1 . 328Once connected, 329.Nm 330will execute 331.Xr ppp 8 332in 333.Fl direct 334mode with the 335.Dq Li rfcomm-client 336label. 337.Sh SEE ALSO 338.Xr rfcomm_sppd 1 , 339.Xr bluetooth 3 , 340.Xr ng_btsocket 4 , 341.Xr ppp 8 , 342.Xr sdpcontrol 8 , 343.Xr sdpd 8 344.Sh AUTHORS 345.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com 346.Sh CAVEATS 347The 348.Nm 349utility in server mode will try to register the Bluetooth LAN Access Over PPP 350service with the local SDP daemon. 351If the local SDP daemon is not running, 352.Nm 353will exit with an error. 354