Add rfcomm_pppd_server rc script to allow start rfcomm_pppd(8) in server
mode at boot time. Multiple profiles can be started at the same time. The whole idea is very similar to the ppp rc script. Document Bluetooth knobs in rc.conf(5) MFC after: 1 week
This commit is contained in:
parent
c20bcaca65
commit
194303edd4
@ -29,7 +29,7 @@ FILES= DAEMON FILESYSTEMS LOGIN NETWORKING SERVERS \
|
||||
pf pflog pfsync \
|
||||
powerd power_profile ppp pppoed pwcheck \
|
||||
quota \
|
||||
random rarpd resolv root \
|
||||
random rarpd resolv rfcomm_pppd_server root \
|
||||
route6d routed routing rpcbind rtadvd rwho \
|
||||
savecore sdpd securelevel sendmail \
|
||||
serial sppp statd swap1 \
|
||||
|
122
etc/rc.d/rfcomm_pppd_server
Normal file
122
etc/rc.d/rfcomm_pppd_server
Normal file
@ -0,0 +1,122 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
# PROVIDE: rfcomm_pppd_server
|
||||
# REQUIRE: DAEMON sdpd
|
||||
# BEFORE: LOGIN
|
||||
# KEYWORD: nojail
|
||||
|
||||
. /etc/rc.subr
|
||||
|
||||
name="rfcomm_pppd_server"
|
||||
rcvar=`set_rcvar`
|
||||
command="/usr/sbin/rfcomm_pppd"
|
||||
start_cmd="rfcomm_pppd_server_start"
|
||||
stop_cmd="rfcomm_pppd_server_stop"
|
||||
required_modules="ng_btsocket"
|
||||
|
||||
rfcomm_pppd_server_start_profile()
|
||||
{
|
||||
local _profile _profile_cleaned _punct _punct_c
|
||||
local _bdaddr _channel _x
|
||||
|
||||
_profile=$1
|
||||
_profile_cleaned=$1
|
||||
|
||||
_punct=". - / +"
|
||||
for _punct_c in ${_punct} ; do
|
||||
_profile_cleaned=`ltr ${_profile_cleaned} ${_punct_c} '_'`
|
||||
done
|
||||
|
||||
rc_flags=""
|
||||
|
||||
# Check for RFCOMM PPP profile bdaddr override
|
||||
#
|
||||
eval _bdaddr=\$rfcomm_pppd_server_${_profile_cleaned}_bdaddr
|
||||
if [ -n "${_bdaddr}" ]; then
|
||||
rc_flags="${rc_flags} -a ${_bdaddr}"
|
||||
fi
|
||||
|
||||
# Check for RFCOMM PPP profile channel override
|
||||
#
|
||||
eval _channel=\$rfcomm_pppd_server_${_profile_cleaned}_channel
|
||||
if [ -z "${_channel}" ]; then
|
||||
_channel=1
|
||||
fi
|
||||
rc_flags="${rc_flags} -C ${_channel}"
|
||||
|
||||
# Check for RFCOMM PPP profile register SP override
|
||||
#
|
||||
eval _x=\$rfcomm_pppd_server_${_profile_cleaned}_register_sp
|
||||
if [ -n "${_x}" ]; then
|
||||
if checkyesno "rfcomm_pppd_server_${_profile_cleaned}_register_sp" ; then
|
||||
rc_flags="${rc_flags} -S"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check for RFCOMM PPP profile register DUN override
|
||||
#
|
||||
eval _x=\$rfcomm_pppd_server_${_profile_cleaned}_register_dun
|
||||
if [ -n "${_x}" ]; then
|
||||
if checkyesno "rfcomm_pppd_server_${_profile_cleaned}_register_dun" ; then
|
||||
rc_flags="${rc_flags} -D"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Run!
|
||||
#
|
||||
$command -s ${rc_flags} -l ${_profile}
|
||||
}
|
||||
|
||||
rfcomm_pppd_server_stop_profile()
|
||||
{
|
||||
local _profile
|
||||
|
||||
_profile=$1
|
||||
|
||||
/bin/pkill -f "^${command}.*[[:space:]]${_profile}\$" || \
|
||||
echo -n "(not running)"
|
||||
}
|
||||
|
||||
rfcomm_pppd_server_start()
|
||||
{
|
||||
local _profile _p
|
||||
|
||||
_profile=$*
|
||||
if [ -z "${_profile}" ]; then
|
||||
_profile=${rfcomm_pppd_server_profile}
|
||||
fi
|
||||
|
||||
echo -n "Starting RFCOMM PPP profile:"
|
||||
|
||||
for _p in ${_profile} ; do
|
||||
echo -n " ${_p}"
|
||||
rfcomm_pppd_server_start_profile ${_p}
|
||||
done
|
||||
|
||||
echo "."
|
||||
}
|
||||
|
||||
rfcomm_pppd_server_stop()
|
||||
{
|
||||
local _profile _p
|
||||
|
||||
_profile=$*
|
||||
if [ -z "${_profile}" ]; then
|
||||
_profile=${rfcomm_pppd_server_profile}
|
||||
fi
|
||||
|
||||
echo -n "Stopping RFCOMM PPP profile:"
|
||||
|
||||
for _p in ${_profile} ; do
|
||||
echo -n " ${_p}"
|
||||
rfcomm_pppd_server_stop_profile ${_p}
|
||||
done
|
||||
|
||||
echo "."
|
||||
}
|
||||
|
||||
load_rc_config $name
|
||||
run_rc_command $*
|
@ -3880,6 +3880,108 @@ autobridge_bridge0="tap* dc0 vlan[345]"
|
||||
If set to
|
||||
.Dq Li YES ,
|
||||
enable support for sound mixer.
|
||||
.It Va hcsecd_enable
|
||||
.Pq Vt bool
|
||||
If set to
|
||||
.Dq Li YES ,
|
||||
enable Bluetooth security daemon.
|
||||
.It Va hcsecd_config
|
||||
.Pq Vt str
|
||||
Configuration file for
|
||||
.Xr hcsecd 8 .
|
||||
Default
|
||||
.Pa /etc/bluetooth/hcsecd.conf .
|
||||
.It Va sdpd_enable
|
||||
.Pq Vt bool
|
||||
If set to
|
||||
.Dq Li YES ,
|
||||
enable Bluetooth Service Discovery Protocol daemon.
|
||||
.It Va sdpd_control
|
||||
.Pq Vt str
|
||||
Path to
|
||||
.Xr sdpd 8
|
||||
control socket.
|
||||
Default
|
||||
.Pa /var/run/sdp .
|
||||
.It Va sdpd_groupname
|
||||
.Pq Vt str
|
||||
Sets
|
||||
.Xr sdpd 8
|
||||
group to run as after it initializes.
|
||||
Default
|
||||
.Dq Li nobody .
|
||||
.It Va sdpd_username
|
||||
.Pq Vt str
|
||||
Sets
|
||||
.Xr sdpd 8
|
||||
user to run as after it initializes.
|
||||
Default
|
||||
.Dq Li nobody .
|
||||
.It Va bthidd_enable
|
||||
.Pq Vt bool
|
||||
If set to
|
||||
.Dq Li YES ,
|
||||
enable Bluetooth Human Interface Device daemon.
|
||||
.It Va bthidd_config
|
||||
.Pq Vt str
|
||||
Configuration file for
|
||||
.Xr bthidd 8 .
|
||||
Default
|
||||
.Pa /etc/bluetooth/bthidd.conf .
|
||||
.It Va bthidd_hids
|
||||
.Pq Vt str
|
||||
Path to a file, where
|
||||
.Xr bthidd 8
|
||||
will store information about known HID devices.
|
||||
Default
|
||||
.Pa /var/db/bthidd.hids .
|
||||
.It Va rfcomm_pppd_server_enable
|
||||
.Pq Vt bool
|
||||
If set to
|
||||
.Dq Li YES ,
|
||||
enable Bluetooth RFCOMM PPP wrapper daemon.
|
||||
.It Va rfcomm_pppd_server_profile
|
||||
.Pq Vt str
|
||||
The name of the profile to use from
|
||||
.Pa /etc/ppp/ppp.conf .
|
||||
Multiple profiles can be specified here.
|
||||
Also used to specify per-profile overrides.
|
||||
When the profile name contains any of the characters
|
||||
.Dq Li .-/+
|
||||
they are translated to
|
||||
.Dq Li _
|
||||
for the proposes of the override variable names.
|
||||
.It Va rfcomm_pppd_server_ Ns Ao Ar profile Ac Ns _bdaddr
|
||||
.Pq Vt str
|
||||
Overrides local address to listen on.
|
||||
By default
|
||||
.Xr rfcomm_pppd 8
|
||||
will listen on
|
||||
.Dq Li ANY
|
||||
address.
|
||||
The address can be specified as BD_ADDR or name.
|
||||
.It Va rfcomm_pppd_server_ Ns Ao Ar profile Ac Ns _channel
|
||||
.Pq Vt str
|
||||
Overrides local RFCOMM channel to listen on.
|
||||
By default
|
||||
.Xr rfcomm_pppd 8
|
||||
will listen on RFCOMM channel 1.
|
||||
Must set properly if multiple profiles used in the same time.
|
||||
.It Va rfcomm_pppd_server_ Ns Ao Ar profile Ac Ns _register_sp
|
||||
.Pq Vt bool
|
||||
Tells
|
||||
.Xr rfcomm_pppd 8
|
||||
if it should register Serial Port service on the speficied RFCOMM channel.
|
||||
Default
|
||||
.Dq Li NO .
|
||||
.It Va rfcomm_pppd_server_ Ns Ao Ar profile Ac Ns _register_dun
|
||||
.Pq Vt bool
|
||||
Tells
|
||||
.Xr rfcomm_pppd 8
|
||||
if it should register Dial-Up Networking service on the speficied
|
||||
RFCOMM channel.
|
||||
Default
|
||||
.Dq Li NO .
|
||||
.El
|
||||
.Sh FILES
|
||||
.Bl -tag -width ".Pa /etc/defaults/rc.conf" -compact
|
||||
@ -3920,12 +4022,14 @@ enable support for sound mixer.
|
||||
.Xr amd 8 ,
|
||||
.Xr apm 8 ,
|
||||
.Xr atm 8 ,
|
||||
.Xr bthidd 8 ,
|
||||
.Xr chkprintcap 8 ,
|
||||
.Xr chown 8 ,
|
||||
.Xr cron 8 ,
|
||||
.Xr dhclient 8 ,
|
||||
.Xr ftpd 8 ,
|
||||
.Xr geli 8 ,
|
||||
.Xr hcsecd 8 ,
|
||||
.Xr ifconfig 8 ,
|
||||
.Xr inetd 8 ,
|
||||
.Xr ipf 8 ,
|
||||
@ -3955,6 +4059,7 @@ enable support for sound mixer.
|
||||
.Xr quotaon 8 ,
|
||||
.Xr rc 8 ,
|
||||
.Xr rc.sendmail 8 ,
|
||||
.Xr rfcomm_pppd 8 ,
|
||||
.Xr route 8 ,
|
||||
.Xr routed 8 ,
|
||||
.Xr rpcbind 8 ,
|
||||
@ -3962,6 +4067,7 @@ enable support for sound mixer.
|
||||
.Xr rpc.statd 8 ,
|
||||
.Xr rwhod 8 ,
|
||||
.Xr savecore 8 ,
|
||||
.Xr sdpd 8 ,
|
||||
.Xr sshd 8 ,
|
||||
.Xr swapon 8 ,
|
||||
.Xr sysctl 8 ,
|
||||
|
Loading…
Reference in New Issue
Block a user