Hello Anatoli,

[...]

>  2) teach rfcomm_pppd(8) to register DUN profile as well as LAN
>  profile. this should be easy to do. however, you will need to tweak
>  your ppp(8) configuration and add fake chat script to emulate modem
>  AT-command exchange.

i have attached the patch that implements option (2) above. please try
it and let me know. the patch adds new -D option to the
rfcomm_pppd(8). when -D is specified, rfcomm_pppd(8) server will
register DUN service on the same channel as LAN service. keep in mind
that remote client will still be thinking that it talks to the
modem-type device. it means that there will be AT-command exchange
before client starts talking PPP.  you will need to fake this
AT-command exchange using ppp(8) chat scripts. please read ppp(8) man
page and pay attention to "force-scripts" option.

to make rfcomm_pppd(8) server register DUN service you will need to start it as

# rfcomm_pppd -s -d -D -C 7 -l default

in case you did not get the attachment, the patch can be downloaded from

http://people.freebsd.org/~emax/rfcomm_pppd.dun.patch.txt

thanks,
max
Index: rfcomm_pppd.8
===================================================================
RCS file: /home/ncvs/src/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.8,v
retrieving revision 1.14
diff -u -r1.14 rfcomm_pppd.8
--- rfcomm_pppd.8       13 May 2007 18:59:22 -0000      1.14
+++ rfcomm_pppd.8       5 Mar 2008 17:46:04 -0000
@@ -41,7 +41,7 @@
 .Fl u Ar N
 .Nm
 .Fl s
-.Op Fl dhS
+.Op Fl dDhS
 .Op Fl a Ar address
 .Fl C Ar channel
 .Fl l Ar label
@@ -125,6 +125,15 @@
 This is the default mode.
 .It Fl d
 Do not detach from the controlling terminal, i.e., run in foreground.
+.It Fl D
+In server mode, register the
+.Cm DUN
+(Dial-Up Networking) service in addition to the
+.Cm LAN
+(LAN Access Using PPP) service.
+AT-command exchange can be faked with
+.Xr ppp 8
+chat script.
 .It Fl h
 Display usage message and exit.
 .It Fl l Ar label
Index: rfcomm_pppd.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.c,v
retrieving revision 1.6
diff -u -r1.6 rfcomm_pppd.c
--- rfcomm_pppd.c       21 Sep 2006 02:32:28 -0000      1.6
+++ rfcomm_pppd.c       5 Mar 2008 17:46:04 -0000
@@ -62,7 +62,8 @@
        struct sockaddr_rfcomm   sock_addr;
        char                    *label = NULL, *unit = NULL, *ep = NULL;
        bdaddr_t                 addr;
-       int                      s, channel, detach, server, service, regsp;
+       int                      s, channel, detach, server, service,
+                                regdun, regsp;
        pid_t                    pid;
 
        memcpy(&addr, NG_HCI_BDADDR_ANY, sizeof(addr));
@@ -70,10 +71,11 @@
        detach = 1;
        server = 0;
        service = 0;
+       regdun = 0;
        regsp = 0;
 
        /* Parse command line arguments */
-       while ((s = getopt(argc, argv, "a:cC:dhl:sSu:")) != -1) {
+       while ((s = getopt(argc, argv, "a:cC:dDhl:sSu:")) != -1) {
                switch (s) {
                case 'a': /* BDADDR */
                        if (!bt_aton(optarg, &addr)) {
@@ -110,6 +112,10 @@
                        detach = 0;
                        break;
 
+               case 'D': /* Register DUN service as well as LAN service */
+                       regdun = 1;
+                       break;
+
                case 'l': /* PPP label */
                        label = optarg;
                        break;
@@ -265,6 +271,31 @@
                }
 
                /*
+                * Register DUN (Dial-Up Networking) service on the same
+                * RFCOMM channel if requested. There is really no good reason
+                * to not to support this. AT-command exchange can be faked
+                * with chat script in ppp.conf
+                */
+
+               if (regdun) {
+                       sdp_dun_profile_t       dun;
+
+                       memset(&dun, 0, sizeof(dun));
+                       dun.server_channel = channel;
+
+                       if (sdp_register_service(ss,
+                                       SDP_SERVICE_CLASS_DIALUP_NETWORKING,
+                                       &addr, (void *) &dun, sizeof(dun),
+                                       NULL) != 0) {
+                               syslog(LOG_ERR, "Unable to register DUN " \
+                                       "service with local SDP daemon. " \
+                                       "%s (%d)", strerror(sdp_error(ss)),
+                                       sdp_error(ss));
+                               exit(1);
+                       }
+               }
+
+               /*
                 * Register SP (Serial Port) service on the same RFCOMM channel
                 * if requested. It appears that some cell phones are using so
                 * called "callback mechanism". In this scenario user is trying
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bluetooth
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to