diff options
author | emax <emax@FreeBSD.org> | 2008-03-06 00:37:29 +0000 |
---|---|---|
committer | emax <emax@FreeBSD.org> | 2008-03-06 00:37:29 +0000 |
commit | 94a2761115c484eb8778322e89e888cacc1ca083 (patch) | |
tree | 8388bdcfb4aa17c2ea483a617d92826c9b74a540 /usr.sbin/bluetooth | |
parent | 22cf966cb52052fefb5adfc78876035c264fef34 (diff) | |
download | FreeBSD-src-94a2761115c484eb8778322e89e888cacc1ca083.zip FreeBSD-src-94a2761115c484eb8778322e89e888cacc1ca083.tar.gz |
Add an option to register DUN (Dial-Up Networking) service on the same
RFCOMM channel if needed. There is really no good reason to not to support
this. AT-command exchange can be faked with chat script in ppp.conf.
MFC after: 1 week
Diffstat (limited to 'usr.sbin/bluetooth')
-rw-r--r-- | usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.8 | 11 | ||||
-rw-r--r-- | usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.c | 35 |
2 files changed, 43 insertions, 3 deletions
diff --git a/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.8 b/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.8 index 1f5efff..e74e113 100644 --- a/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.8 +++ b/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.8 @@ -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 @@ Act as an RFCOMM client. 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 diff --git a/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.c b/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.c index 7a879bb..ad33a60 100644 --- a/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.c +++ b/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.c @@ -62,7 +62,8 @@ main(int argc, char *argv[]) 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 @@ main(int argc, char *argv[]) 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 @@ main(int argc, char *argv[]) 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 @@ main(int argc, char *argv[]) } /* + * 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 |