|
From: Peter K. <pk...@us...> - 2002-11-20 16:59:25
|
The following file was modified in apps/bluetooth/experimental:
Name Old version New version Tag Comment
---- ----------- ----------- --- -------
btd.c 1.39 1.40=20=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Modified to use the RADIUS support that is part of the current
development version of pppd.
The diff of the modified file(s):
--- btd.c 2 Oct 2002 15:28:31 -0000 1.39
+++ btd.c 20 Nov 2002 16:59:21 -0000 1.40
@@ -6,7 +6,7 @@
* o Handles multipoint ppp connections
* o Handles HW upgrade
*
- * Copyright (C) 2000, 2001 Axis Communications AB
+ * Copyright (C) 2000, 2001, 2002 Axis Communications AB
*
* Author: Mattias Agren <mat...@ax...>
*
@@ -140,30 +140,18 @@
int pppd_pid;
int do_modememul;
unsigned char remote_bd[6];
+ unsigned char remote_name[BT_NAME_LENGTH];
struct ip_set *ipset;
} peer_struct;
=20
struct peer_struct peerlist[BT_NBR_DATAPORTS];
struct ip_set ipsetlist[BT_NBR_DATAPORTS];
=20
-static unsigned char dev[20];
-static unsigned char ip_addresses[35];
-static unsigned char ms_dns1[35];
-static unsigned char ms_dns2[35];
-static unsigned char ms_wins1[35];
-static unsigned char ms_wins2[35];
-static unsigned char netmask[35];
-static char remote_bd_str[18];
-static char local_bd_str[18];
-
-static fd_set rfd;
-static struct timeval tv;
-
#define PEER(line) (peerlist[line])
#define IPSET(line) (ipsetlist[line])
#define STATE(line) (peerlist[line].state)
=20
-static unsigned char *pppd_options[32];
+static unsigned char *pppd_options[64];
=20
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */
/* IPA stuff */
@@ -219,8 +207,6 @@
{ 0, 0, 0, 0 }
};
=20
-static int option_index =3D 0;
-
static void init();
static void init_sighandler(void);
static void btd_cleanup(void);
@@ -236,6 +222,8 @@
int
main(int argc, char **argv)
{=20=20
+ static fd_set rfd;
+ static struct timeval tv;
int result, opt;
int bt_disc =3D N_BT;
=20=20=20
@@ -249,7 +237,7 @@
=20=20=20
/* now parse options */
while ((opt =3D getopt_long(argc, argv, "fi:m:n:Rs:u:IUB",
- long_options, &option_index)) !=3D -1)
+ long_options, NULL)) !=3D -1)
{
switch(opt)
{
@@ -466,7 +454,8 @@
STATE(line) =3D CONNECTED;
=20=20=20=20=20=20=20
read_remote_bd(bt_cfd, line, PEER(line).remote_bd);
- printf("Remote bd: %s\n", bd2str(PEER(line).remote_bd));
+ read_remote_name(bt_cfd, line, PEER(line).remote_name, sizeof PEER(l=
ine).remote_name);
+ printf("Remote bd: %s (%s)\n", bd2str(PEER(line).remote_bd), PEER(li=
ne).remote_name);
=20=20=20=20=20=20=20
if (ipa_fd >=3D 0)
{=20=20
@@ -500,9 +489,18 @@
/* only server */
void build_pppdopts(int line, char **opts)
{
- int i =3D 0;
+ static unsigned char dev[20];
+ static unsigned char ip_addresses[35];
+ static unsigned char ms_dns1[35];
+ static unsigned char ms_dns2[35];
+ static unsigned char ms_wins1[35];
+ static unsigned char ms_wins2[35];
+ static unsigned char netmask[35];
+ static char remote_bd_str[36];
+ static char local_bd_str[32];
+ static char remote_name[20 + BT_NAME_LENGTH];
struct ip_set *ipset =3D PEER(line).ipset;
- char local_ip[20];
+ int i =3D 0;
=20=20=20
if (ipa_fd >=3D 0)
show_ipset(ipset, line);
@@ -535,14 +533,16 @@
{
unsigned char local_bd[6];
=20=20=20=20=20=20=20
- opts[i++] =3D "useradius";
+ opts[i++] =3D "plugin";
+ opts[i++] =3D "radius.so";
+ opts[i++] =3D "plugin";
+ opts[i++] =3D "radattr.so";
opts[i++] =3D "auth";
opts[i++] =3D "login";
- opts[i++] =3D "localbdaddr";
=20
+#ifdef __CRIS__
read_local_bd(bt_cfd, local_bd);
-=20=20=20=20=20=20=20=20
- sprintf(local_bd_str, "%02x:%02x:%02x:%02x:%02x:%02x",=20
+ sprintf(local_bd_str, "Axis-BT-AP-ID=3D%02x:%02x:%02x:%02x:%02x:%02x=
",
local_bd[0],=20
local_bd[1],=20
local_bd[2],=20
@@ -550,11 +550,10 @@
local_bd[4],=20
local_bd[5]);
=20=20=20=20=20=20=20
+ opts[i++] =3D "avpair";
opts[i++] =3D local_bd_str;
=20
- opts[i++] =3D "remotebdaddr";
-
- sprintf(remote_bd_str, "%02x:%02x:%02x:%02x:%02x:%02x",=20
+ sprintf(remote_bd_str, "Axis-BT-Client-ID=3D%02x:%02x:%02x:%02x:%02x=
:%02x",
PEER(line).remote_bd[0],=20
PEER(line).remote_bd[1],=20
PEER(line).remote_bd[2],=20
@@ -562,12 +561,27 @@
PEER(line).remote_bd[4],=20
PEER(line).remote_bd[5]);
=20=20=20=20=20=20=20
+ opts[i++] =3D "avpair";
opts[i++] =3D remote_bd_str;
=20=20=20=20=20=20=20
+ if (*PEER(line).remote_name)
+ {
+ sprintf(remote_name, "Axis-BT-Client-Name=3D\"%s\"", PEER(line).re=
mote_name);
+
+ opts[i++] =3D "avpair";
+ opts[i++] =3D remote_name;
+ }
+
if (ipset->useradiusip)
{
opts[i++] =3D "useautoip";
}=20=20=20
+
+ if (ipset->usingmasq)
+ {
+ pppd_options[i++] =3D "acct-local-addr";
+ }
+#endif /* __CRIS__ */
}=20=20
else=20
{
@@ -582,9 +596,12 @@
opts[i++] =3D "ktune"; /* enables ip_forwarding */
}
=20
- strcpy(local_ip, get_local_ip_address());
- /* local/remote ip */
- sprintf(ip_addresses, "%s:%s", local_ip, inet_ntoa(ipset->ip));
+ sprintf(ip_addresses, "%s:", get_local_ip_address());
+
+ if (!ipset->useradius || !ipset->useradiusip)
+ {
+ strcat(ip_addresses, inet_ntoa(ipset->ip));
+ }
=20=20=20=20=20
printf("IP used: %s\n", ip_addresses);
=20
@@ -770,7 +787,19 @@
return;
}
=20=20=20=20=20
+ if (WIFEXITED(status) && WEXITSTATUS(status))
+ {
+// unsigned int con_id;
+
+ syslog(LOG_INFO, "PPP line %d was shutdown due to an error: %d", lin=
e, WEXITSTATUS(status));
+
+// con_id =3D CREATE_RFCOMM_ID(line, 2);
+// bt_disconnect(bt_cfd, con_id);
+ }
+ else
+ {
D(syslog(LOG_INFO, "PPP line %d was shutdown", line));
+ }
=20=20=20=20=20
if (ipa_fd >=3D 0)
{=20
|