* [Bluez-devel] Proposal: patch for pand
@ 2006-11-02 10:34 Olivier Dole
2006-11-02 10:38 ` Olivier Dole
0 siblings, 1 reply; 4+ messages in thread
From: Olivier Dole @ 2006-11-02 10:34 UTC (permalink / raw)
To: BlueZ development
[-- Attachment #1: Type: text/plain, Size: 991 bytes --]
Hi everyone,
For my work I need a similar mechanism to "devup" script in pand when a
PAN disconnection occurs.
That's why I've done the following patch (see attachment for source
code) which allows PAN daemon to run a "devdown" script either when a
disconnection is spotted i.e. remote device closes the connection or
when you explicitly do the disconnection. To use it, simply add the
following option to your command line:
pand --options --devdown /path/to/devdown-script
or
pand -options -o /path/to/devdown-script
or you can also read the pand man page ;)
The behaviour is the same as for "devup" script. I mean when the script
is run the following arguments are supplied to the script:
$1 <-> device interface e.g. "bnep0"
$2 <-> bluetooth address of the disconnected device e.g.
"00:45:78:AE:B4:01"
and of course your script must have the correct permissions to run.
Any feedback about this patch is of course welcome ;)
Hope you will find this patch usefull.
Regards,
Olivier DOLE
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: bluez_pand_dev-down.patch --]
[-- Type: text/x-patch; name=bluez_pand_dev-down.patch; charset=UTF-8, Size: 35279 bytes --]
diff -Naur pand.orig/main.c pand.new/main.c
--- pand.orig/main.c 2006-09-30 00:23:28.000000000 +0200
+++ pand.new/main.c 2006-11-02 11:03:27.000000000 +0100
@@ -73,6 +73,7 @@
static char netdev[16] = "bnep%d";
static char *pidfile = NULL;
static char *devupcmd = NULL;
+static char *devdowncmd = NULL;
static bdaddr_t src_addr = *BDADDR_ANY;
static int src_dev = -1;
@@ -89,15 +90,22 @@
KILL
} modes;
-static void run_devup(char *dev, char *dst, int sk, int nsk)
+struct script_arg {
+ char dev[20];
+ char dst[20];
+ int sk;
+ int nsk;
+};
+
+static void run_script(char *script, char *dev, char *dst, int sk, int nsk)
{
char *argv[4];
struct sigaction sa;
- if (!devupcmd)
+ if (!script)
return;
-
- if (access(devupcmd, R_OK | X_OK))
+
+ if (access(script, R_OK | X_OK))
return;
if (fork())
@@ -114,16 +122,57 @@
sigaction(SIGCHLD, &sa, NULL);
sigaction(SIGPIPE, &sa, NULL);
- argv[0] = devupcmd;
+ argv[0] = script;
argv[1] = dev;
argv[2] = dst;
argv[3] = NULL;
- execv(devupcmd, argv);
+ execv(script, argv);
exit(1);
}
+/* Wait for disconnect or error condition on the socket */
+static int w4_hup(int sk, struct script_arg *down_cmd)
+{
+ struct pollfd pf;
+ sigset_t sigs;
+ int n;
+
+ sigfillset(&sigs);
+ sigdelset(&sigs, SIGCHLD);
+ sigdelset(&sigs, SIGPIPE);
+ sigdelset(&sigs, SIGTERM);
+ sigdelset(&sigs, SIGINT);
+ sigdelset(&sigs, SIGHUP);
+
+ while (!terminate) {
+ pf.fd = sk;
+ pf.events = POLLERR | POLLHUP;
+ n = ppoll(&pf, 1, NULL, &sigs);
+ if (n < 0) {
+ if (errno == EINTR || errno == EAGAIN)
+ continue;
+ syslog(LOG_ERR, "Poll failed. %s(%d)",
+ strerror(errno), errno);
+ return 1;
+ }
+
+ if (n) {
+ int err = 0;
+ socklen_t olen = sizeof(err);
+ getsockopt(sk, SOL_SOCKET, SO_ERROR, &err, &olen);
+ syslog(LOG_INFO, "%s disconnected%s%s", netdev,
+ err ? " : " : "", err ? strerror(err) : "");
+ if (down_cmd)
+ run_script(devdowncmd, down_cmd->dev, down_cmd->dst, down_cmd->sk, down_cmd->nsk);
+ close(sk);
+ return 0;
+ }
+ }
+ return 0;
+}
+
static int do_listen(void)
{
struct l2cap_options l2o;
@@ -207,12 +256,21 @@
if (!bnep_accept_connection(nsk, role, devname)) {
char str[40];
+ struct script_arg down_cmd;
+
ba2str(&l2a.l2_bdaddr, str);
syslog(LOG_INFO, "New connection from %s %s",
- str, devname);
+ str, netdev);
- run_devup(devname, str, sk, nsk);
+ run_script(devupcmd, devname, str, sk, nsk);
+
+ memset(&down_cmd, 0, sizeof(struct script_arg));
+ strncpy(down_cmd.dev, devname, strlen(devname) + 1);
+ strncpy(down_cmd.dst, str, strlen(str) + 1);
+ down_cmd.sk = sk;
+ down_cmd.nsk = nsk;
+ w4_hup(nsk, &down_cmd);
} else {
syslog(LOG_ERR, "Connection failed. %s(%d)",
strerror(errno), errno);
@@ -227,46 +285,6 @@
return 0;
}
-/* Wait for disconnect or error condition on the socket */
-static int w4_hup(int sk)
-{
- struct pollfd pf;
- sigset_t sigs;
- int n;
-
- sigfillset(&sigs);
- sigdelset(&sigs, SIGCHLD);
- sigdelset(&sigs, SIGPIPE);
- sigdelset(&sigs, SIGTERM);
- sigdelset(&sigs, SIGINT);
- sigdelset(&sigs, SIGHUP);
-
- while (!terminate) {
- pf.fd = sk;
- pf.events = POLLERR | POLLHUP;
- n = ppoll(&pf, 1, NULL, &sigs);
- if (n < 0) {
- if (errno == EINTR || errno == EAGAIN)
- continue;
- syslog(LOG_ERR, "Poll failed. %s(%d)",
- strerror(errno), errno);
- return 1;
- }
-
- if (n) {
- int err = 0;
- socklen_t olen = sizeof(err);
- getsockopt(sk, SOL_SOCKET, SO_ERROR, &err, &olen);
- syslog(LOG_INFO, "%s disconnected%s%s", netdev,
- err ? " : " : "", err ? strerror(err) : "");
-
- close(sk);
- return 0;
- }
- }
- return 0;
-}
-
/* Connect and initiate BNEP session
* Returns:
* -1 - critical error (exit persist mode)
@@ -279,6 +297,7 @@
struct sockaddr_l2 l2a;
socklen_t olen;
int sk, r = 0;
+ struct script_arg down_cmd;
syslog(LOG_INFO, "Connecting to %s", dst);
@@ -314,10 +333,15 @@
syslog(LOG_INFO, "%s connected", netdev);
- run_devup(netdev, dst, sk, -1);
+ run_script(devupcmd, netdev, dst, sk, -1);
- if (persist) {
- w4_hup(sk);
+ if (persist || devdowncmd) {
+ memset(&down_cmd, 0, sizeof(struct script_arg));
+ strncpy(down_cmd.dev, netdev, strlen(netdev) + 1);
+ strncpy(down_cmd.dst, dst, strlen(dst) + 1);
+ down_cmd.sk = sk;
+ down_cmd.nsk = -1;
+ w4_hup(sk, &down_cmd);
if (terminate && cleanup) {
syslog(LOG_INFO, "Disconnecting from %s.", dst);
@@ -525,11 +549,12 @@
{ "cache", 0, 0, 'C' },
{ "pidfile", 1, 0, 'P' },
{ "devup", 1, 0, 'u' },
+ { "devdown", 1, 0, 'o' },
{ "autozap", 0, 0, 'z' },
{ 0, 0, 0, 0 }
};
-static char main_sopts[] = "hsc:k:Kr:d:e:i:lnp::DQ::AESMC::P:u:z";
+static char main_sopts[] = "hsc:k:Kr:d:e:i:lnp::DQ::AESMC::P:u:o:z";
static char main_help[] =
"Bluetooth PAN daemon version " VERSION " \n"
@@ -556,7 +581,8 @@
"\t--persist -p[interval] Persist mode\n"
"\t--cache -C[valid] Cache addresses\n"
"\t--pidfile -P <pidfile> Create PID file\n"
- "\t--devup -u <script> Script to run when interface comes up\n";
+ "\t--devup -u <script> Script to run when interface comes up\n"
+ "\t--devdown -o <script> Script to run when interface comes down\n";
int main(int argc, char *argv[])
{
@@ -661,6 +687,10 @@
devupcmd = strdup(optarg);
break;
+ case 'o':
+ devdowncmd = strdup(optarg);
+ break;
+
case 'z':
cleanup = 1;
break;
diff -Naur pand.orig/.main.c.swp pand.new/.main.c.swp
--- pand.orig/.main.c.swp 1970-01-01 01:00:00.000000000 +0100
+++ pand.new/.main.c.swp 2006-11-02 11:03:31.000000000 +0100
@@ -0,0 +1,70 @@
+b0VIM 6.4\0\0\0\0\x10\0\0oÂIEGI\0S7\0\0odole\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0ODole-Ubuntu\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0~odole/Bluez-CVS/utils/pand.new/main.c\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\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\0x
+\0\0f
+\0\0e
+\0\0S
+\0\0@
+\0\09
+\0\08
+\0\0ñ \0\0³ \0\0² \0\0 \0\0 \0\0o \0\0Y \0\0? \0\0+ \0\0
+ \0\0 \0\0ù\b\0\0è\b\0\0Õ\b\0\0Ã\b\0\0º\b\0\0¹\b\0\0\b\0\0y\b\0\0[\b\0\0;\b\0\0:\b\0\0\x12\b\0\0ù\a\0\0ø\a\0\0Ù\a\0\0Ø\a\0\0¸\a\0\0·\a\0\0°\a\0\0©\a\0\0¢\a\0\0\a\0\0\a\0\0\a\0\0\a\0\0\x7f\a\0\0k\a\0\0\\a\0\0M\a\0\0C\a\0\08\a\0\05\a\0\03\a\0\0ç\x06\0\0å\x06\0\0Õ\x06\0\0¿\x06\0\0¾\x06\0\0°\x06\0\0¦\x06\0\0£\x06\0\0\x06\0\0w\x06\0\0v\x06\0\0i\x06\0\0_\x06\0\0^\x06\0\0P\x06\0\0C\x06\0\0B\x06\0\03\x06\0\0%\x06\0\0$\x06\0\0\a\x06\0\0í\x05\0\0Í\x05\0\0\x05\0\0¬\x05\0\0\x05\0\0\x05\0\0y\x05\0\0h\x05\0\0g\x05\0\0Q\x05\0\0P\x05\0\0F\x05\0\0D\x05\0\0C\x05\0\0\b\x05\0\0Ñ\x04\0\0Ï\x04\0\0¼\x04\0\0¬\x04\0\0¤\x04\0\0£\x04\0\0\x04\0\0s\x04\0\0W\x04\0\0;\x04\0\0 \x04\0\0\x05\x04\0\0\x04\x04\0\0î\x03\0\0à\x03\0\0¿\x03\0\0\x03\0\0\x03\0\0d\x03\0\0V\x03\0\0,\x03\0\0\r\x03\0\0\0\x03\0\0ü\x02\0\0û\x02\0\0ð\x02\0\0à\x02\0\0¿\x02\0\0¾\x02\0\0½\x02\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 socklen_t olen = sizeof(err);\0 int err = 0;\0 if (n) {\0\0 }\0 return 1;\0 strerror(errno), errno);\0 syslog(LOG_ERR, "Poll failed. %s(%d)",\0 continue;\0 if (errno == EINTR || errno == EAGAIN)\0 if (n < 0) {\0 n = ppoll(&pf, 1, NULL, &sigs);\0 pf.events = POLLERR | POLLHUP;\0 pf.fd = sk;\0 while (!terminate) {\0\0 sigdelset(&sigs, SIGHUP);\0 sigdelset(&sigs, SIGINT);\0 sigdelset(&sigs, SIGTERM);\0 sigdelset(&sigs, SIGPIPE);\0 sigdelset(&sigs, SIGCHLD);\0 sigfillset(&sigs);\0\0 int n;\0 sigset_t sigs;\0 struct pollfd pf;\0{\0static int w4_hup(int sk, struct script_arg *down_cmd)\0/* Wait for disconnect or error condition on the socket */\0\0}\0 exit(1);\0\0 execv(script, argv);\0\0 argv[3] = NULL;\0 argv[2] = dst;\0 argv[1] = dev;\0 argv[0] = script;\0\0 sigaction(SIGPIPE, &sa, NULL);\0 sigaction(SIGCHLD, &sa, NULL);\0 sa.sa_handler = SIG_DFL;\0 memset(&sa, 0, sizeof(sa));\0\0 close(nsk);\0 if (nsk >= 0)\0\0 close(sk);\0 if (sk >= 0)\0\0 return;\0 if (fork())\0\0 return;\0 if (access(script, R_OK | X_OK))\0 \0 return;\0 if (!script)\0\0 struct sigaction sa;\0 char *argv[4];\0{\0static void run_script(char *script, char *dev, char *dst, int sk, int nsk)\0 \0};\0 int nsk;\0 int sk;\0 char dst[20];\0 char dev[20];\0struct script_arg {\0\0} modes;\0 KILL\0 CONNECT,\0 LISTEN,\0 SHOW,\0 NONE,\0enum {\0\0static void do_kill(char *dst);\0\0static volatile int terminate;\0\0static int src_dev = -1;\0static bdaddr_t src_addr = *BDADDR_ANY;\0\0static char *devdowncmd = NULL;\0static char *devupcmd = NULL;\0static char *pidfile = NULL;\0static char netdev[16] = "bnep%d";\0\0} cache;\0 bdaddr_t bdaddr;\0 char dst[40];\0 int valid;\0static struct {\0\0static int search_duration = 10;\0static int cleanup;\0static int link_mode = 0;\0static int use_cache;\0static int use_sdp = 1;\0static int persist;\0static int detach = 1;\0\0static uint16_t service = BNEP_SVC_NAP; /* Remote service */\0static uint16_t role = BNEP_SVC_PANU; /* Local role (ie service) */\0\0#endif\0#include "ppoll.h"\0#ifdef NEED_PPOLL\0\0#include "pand.h"\0\0#include <bluetooth/bnep.h>\0#include <bluetooth/l2cap.h>\0#include <bluetooth/hci_lib.h>\0#include <bluetooth/hci.h>\0#include <bluetooth/bluetooth.h>\0\0#include <sys/socket.h>\0#include <sys/types.h>\0#include <sys/stat.h>\0#include <sys/poll.h>\0#include <getopt.h>\0#include <signal.h>\0#include <syslog.h>\0#include <string.h>\0#include <stdlib.h>\0#include <unistd.h>\0#include <fcntl.h>\0#include <errno.h>\0#include <stdio.h>\0#define _GNU_SOURCE\0\0#endif\0#include <config.h>\0#ifdef HAVE_CONFIG_H\0\0 */\0 *\0 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA\0 * along with this program; if not, write to the Free Software\0 * You should have received a copy of the GNU General Public License\0 *\0 * GNU General Public License for more details.\0 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\0 * but WITHOUT ANY WARRANTY; without even the implied warranty of\0 * This program is distributed in the hope that it will be useful,\0 *\0 * (at your option) any later version.\0 * the Free Software Foundation; either version 2 of the License, or\0 * it under the terms of the GNU General Public License as published by\0 * This program is free software; you can redistribute it and/or modify\0 *\0 *\0 * Copyright (C) 2002-2006 Marcel Holtmann <marcel@holtmann.org>\0 * Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>\0 *\0 * BlueZ - Bluetooth protocol stack for Linux\0 *\0/*\0ad\0\0æ\x02\0\0Æ\x05\0\0\0\x10\0\0³\0\0\0æ\x0f\0\0Ü\x0f\0\0Û\x0f\0\0Ï\x0f\0\0¼\x0f\0\0\x0f\0\0\x0f\0\0\x7f\x0f\0\0~\x0f\0\0r\x0f\0\0b\x0f\0\0S\x0f\0\09\x0f\0\0/\x0f\0\0.\x0f\0\0"\x0f\0\0\x12\x0f\0\0\x03\x0f\0\0ù\x0e\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0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0}\0 return 0;\0\0 unlink(pidfile);\0 if (pidfile)\0\0 }\0 break;\0 do_listen();\0 case LISTEN:\0\0 break;\0 do_connect();\0 case CONNECT:\0 switch (mode) {\0\0 }\0 free(dst);\0 cache.valid = 1;\0 str2ba(dst, &cache.bdaddr);\0 strncpy(cache.dst, dst, sizeof(cache.dst) - 1);\0\0 use_cache = 0;\0 /* Disable cache invalidation */\0 if (dst) {\0\0 return -1;\0 if (pidfile && write_pidfile())\0\0 }\0 }\0 return -1;\0 strerror(errno), errno);\0 syslog(LOG_ERR, "Invalid source. %s(%d)",\0 if (src_dev < 0 || hci_devba(src_dev, &src_addr) < 0) {\0 src_dev = hci_devid(src);\0 if (src) {\0\0 syslog(LOG_INFO, "Bluetooth PAN daemon version %s", VERSION);\0 openlog("pand", LOG_PID | LOG_NDELAY | LOG_PERROR, LOG_DAEMON);\0\0 }\0 exit(1);\0 perror("Can't start daemon");\0 if (detach && daemon(0, 0)) {\0\0 sigaction(SIGINT, &sa, NULL);\0 sigaction(SIGTERM, &sa, NULL);\0 sa.sa_handler = sig_term;\0\0 sigaction(SIGHUP, &sa, NULL);\0 sa.sa_handler = sig_hup;\0\0 sigaction(SIGPIPE, &sa, NULL);\0 sigaction(SIGCHLD, &sa, NULL);\0 sa.sa_handler = SIG_IGN;\0 sa.sa_flags = SA_NOCLDSTOP;\0 memset(&sa, 0, sizeof(sa));\0 /* Initialize signals */\0\0 }\0 return 0;\0 printf(main_help);\0 case NONE:\0\0 return 0;\0 do_kill(dst);\0 case KILL:\0\0 return 0;\0 do_show();\0 case SHOW:\0 switch (mode) {\0 /* Check non daemon modes first */\0\0 return -1;\0 if (bnep_init())\0\0 optind = 0;\0 argv += optind;\0 argc -= optind;\0\0 }\0 }\0 exit(0);\0 printf(main_help);\0 default:\0 case 'h':\0\0 break;\0 cleanup = 1;\0 case 'z':\0\0 break;\0 devdowncmd = strdup(optarg);\0 case 'o':\0\0 break;\0 devupcmd = strdup(optarg);\0 case 'u':\0\0 break;\0 pidfile = strdup(optarg);\0 case 'P':\0\0 break;\0 use_cache = 2;\0 else\0 use_cache = atoi(optarg);\0 if (optarg)\0 case 'C':\0\0 break;\0 persist = 5;\0 else\0 persist = atoi(optarg);\0 if (optarg)\0 case 'p':\0\0 break;\0 detach = 0;\0 case 'n':\0\0 break;\0 netdev[15] = '\0';\0 strncpy(netdev, optarg, 16);\0 case 'e':\0\0 break;\0 link_mode |= L2CAP_LM_MASTER;\0 case 'M':\0\0 break;\0 link_mode |= L2CAP_LM_SECURE;\0 case 'S':\0\0 break;\0 link_mode |= L2CAP_LM_ENCRYPT;\0 case 'E':\0\0 break;\0 link_mode |= L2CAP_LM_AUTH;\0 case 'A':\0\0 break;\0 use_sdp = 0;\0 case 'D':\0\0 break;\0 bnep_str2svc(optarg, &service);\0 case 'd':\0\0 break;\0 bnep_str2svc(optarg, &role);\0 case 'r':\0\0 break;\0 src = strdup(optarg);\0 case 'i':\0\0 break;\0 detach = 0;\0 mode = KILL;\0 case 'K':\0\0 break;\0 dst = strdup(optarg);\0 detach = 0;\0 mode = KILL;\0 case 'k':\0\0 break;\0 search_duration = atoi(optarg);\0 if (optarg)\0 mode = CONNECT;\0 case 'Q':\0\0 break;\0 dst = strdup(optarg);\0ad\0\0\f\0\0\0x\x02\0\0\0\x10\0\0\0\0\0Ê\x0f\0\0\x0f\0\0f\x0f\0\0T\x0f\0\0ý\x0e\0\0ï\x0e\0\0â\x0e\0\0Þ\x0e\0\0Û\x0e\0\0Ð\x0e\0\0Î\x0e\0\0Í\x0e\0\0²\x0e\0\0°\x0e\0\0\x0e\0\0|\x0e\0\0k\x0e\0\0^\x0e\0\0]\x0e\0\0O\x0e\0\0)\x0e\0\0(\x0e\0\0õ\r\0\0º\r\0\0«\r\0\0s\r\0\0T\r\0\0G\r\0\0D\r\0\0C\r\0\0$\r\0\0\x05\r\0\0â\f\0\0Ã\f\0\0Â\f\0\0\f\0\0a\f\0\0B\f\0\05\f\0\02\f\0\01\f\0\0ÿ\v\0\0à\v\0\0Ë\v\0\0\v\0\0P\v\0\01\v\0\0$\v\0\0!\v\0\0 \v\0\0ÿ
+\0\0·
+\0\0~
+\0\0_
+\0\0R
+\0\0O
+\0\0N
+\0\09
+\0\0(
+\0\0á \0\0¬ \0\0 \0\0 \0\0} \0\0| \0\0k \0\0j \0\0T \0\04 \0\0 \0\0\x15 \0\0\x14 \0\0ß\b\0\0Î\b\0\0¢\b\0\0\b\0\0v\b\0\0r\b\0\0q\b\0\0]\b\0\0S\b\0\0I\b\0\0>\b\0\0\x14\b\0\0õ\a\0\0ê\a\0\0Û\a\0\0Î\a\0\0Ê\a\0\0É\a\0\0©\a\0\0\a\0\0\a\0\0]\a\0\0L\a\0\0-\a\0\0,\a\0\0\f\a\0\0\v\a\0\0Ú\x06\0\0Ä\x06\0\0Ã\x06\0\0\x06\0\0\x06\0\0]\x06\0\0%\x06\0\0õ\x05\0\0à\x05\0\0É\x05\0\0®\x05\0\0£\x05\0\0s\x05\0\0T\x05\0\0P\x05\0\0O\x05\0\0A\x05\0\06\x05\0\03\x05\0\02\x05\0\0$\x05\0\0\v\x05\0\0\0\x05\0\0þ\x04\0\0ý\x04\0\0Ø\x04\0\0Ì\x04\0\0\x04\0\0\x04\0\0p\x04\0\0l\x04\0\02\x04\0\00\x04\0\0\x15\x04\0\0ü\x03\0\0ë\x03\0\0Û\x03\0\0¾\x03\0\0½\x03\0\0\x03\0\0\x03\0\0U\x03\0\0F\x03\0\0\x0e\x03\0\0ï\x02\0\0â\x02\0\0ß\x02\0\0Þ\x02\0\0¬\x02\0\0\x02\0\0x\x02\0\0w\x02\0\0\0\0\0\0\0\0\0\0 olen = sizeof(l2o);\0 memset(&l2o, 0, sizeof(l2o));\0 /* Setup L2CAP options according to BNEP spec */\0\0 }\0 return -1;\0 strerror(errno), errno);\0 syslog(LOG_ERR, "Cannot create L2CAP socket. %s(%d)",\0 if (sk < 0) {\0 sk = socket(AF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP);\0\0 syslog(LOG_INFO, "Connecting to %s", dst);\0\0 struct script_arg down_cmd;\0 int sk, r = 0;\0 socklen_t olen;\0 struct sockaddr_l2 l2a;\0 struct l2cap_options l2o;\0{\0static int create_connection(char *dst, bdaddr_t *bdaddr)\0 */\0 * 0 - success\0 * 1 - non critical error\0 * -1 - critical error (exit persist mode)\0 * Returns:\0/* Connect and initiate BNEP session\0\0}\0 return 0;\0 bnep_sdp_unregister();\0 if (use_sdp)\0\0 }\0 exit(0);\0 close(nsk);\0\0 }\0 strerror(errno), errno);\0 syslog(LOG_ERR, "Connection failed. %s(%d)",\0 } else {\0 w4_hup(nsk, &down_cmd);\0 down_cmd.nsk = nsk;\0 down_cmd.sk = sk;\0 strncpy(down_cmd.dst, str, strlen(str) + 1);\0 strncpy(down_cmd.dev, devname, strlen(devname) + 1);\0 memset(&down_cmd, 0, sizeof(struct script_arg));\0 \0 run_script(devupcmd, devname, str, sk, nsk);\0\0 str, netdev);\0 syslog(LOG_INFO, "New connection from %s %s",\0\0 ba2str(&l2a.l2_bdaddr, str);\0\0 struct script_arg down_cmd;\0 char str[40];\0 if (!bnep_accept_connection(nsk, role, devname)) {\0\0 devname[15] = '\0';\0 strncpy(devname, netdev, 16);\0\0 }\0 continue;\0 close(nsk);\0 default:\0 strerror(errno), errno);\0 syslog(LOG_ERR, "Fork failed. %s(%d)",\0 case -1:\0 break;\0 case 0:\0 switch (fork()) {\0\0 }\0 continue;\0 strerror(errno), errno);\0 syslog(LOG_ERR, "Accept failed. %s(%d)",\0 if (nsk < 0) {\0 nsk = accept(sk, (struct sockaddr *) &l2a, &alen);\0\0 int nsk;\0 char devname[16];\0 socklen_t alen = sizeof(l2a);\0 while (!terminate) {\0\0 listen(sk, 10);\0\0 }\0 return -1;\0 strerror(errno), errno);\0 syslog(LOG_ERR, "Failed to set link mode. %s(%d)",\0 if (lm && setsockopt(sk, SOL_L2CAP, L2CAP_LM, &lm, sizeof(lm)) < 0) {\0 lm = link_mode;\0 /* Set link mode */\0\0 }\0 return -1;\0 strerror(errno), errno);\0 syslog(LOG_ERR, "Failed to set L2CAP options. %s(%d)",\0 if (setsockopt(sk, SOL_L2CAP, L2CAP_OPTIONS, &l2o, sizeof(l2o)) < 0) {\0 l2o.imtu = l2o.omtu = BNEP_MTU;\0\0 }\0 return -1;\0 strerror(errno), errno);\0 syslog(LOG_ERR, "Failed to get L2CAP options. %s(%d)",\0 if (getsockopt(sk, SOL_L2CAP, L2CAP_OPTIONS, &l2o, &olen) < 0) {\0 olen = sizeof(l2o);\0 memset(&l2o, 0, sizeof(l2o));\0 /* Setup L2CAP options according to BNEP spec */\0\0 }\0 return -1;\0 strerror(errno), errno);\0 syslog(LOG_ERR, "Bind failed. %s(%d)",\0 if (bind(sk, (struct sockaddr *) &l2a, sizeof(l2a))) {\0\0 l2a.l2_psm = htobs(BNEP_PSM);\0 bacpy(&l2a.l2_bdaddr, &src_addr);\0 l2a.l2_family = AF_BLUETOOTH;\0 memset(&l2a, 0, sizeof(l2a));\0\0 }\0 return -1;\0 strerror(errno), errno);\0 syslog(LOG_ERR, "Cannot create L2CAP socket. %s(%d)",\0 if (sk < 0) {\0 sk = socket(AF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP);\0 /* Create L2CAP socket and bind it to PSM BNEP */\0\0 bnep_sdp_register(&src_addr, role);\0 if (use_sdp)\0\0 int sk, lm;\0 socklen_t olen;\0 struct sockaddr_l2 l2a;\0 struct l2cap_options l2o;\0{\0static int do_listen(void)\0\0}\0 return 0;\0 }\0 }\0 return 0;\0 close(sk);\0 run_script(devdowncmd, down_cmd->dev, down_cmd->dst, down_cmd->sk, down_cmd->nsk);\0 if (down_cmd) \0 err ? " : " : "", err ? strerror(err) : "");\0 syslog(LOG_INFO, "%s disconnected%s%s", netdev,\0 getsockopt(sk, SOL_SOCKET, SO_ERROR, &err, &olen);\0ad\0\0\x05\0\0\0±\x02\0\0\0\x10\0\0¦\0\0\0È\x0f\0\0§\x0f\0\0i\x0f\0\0h\x0f\0\0I\x0f\0\0*\x0f\0\0\a\x0f\0\0\x06\x0f\0\0Ð\x0e\0\0§\x0e\0\0\x0e\0\0\x0e\0\0h\x0e\0\0I\x0e\0\0)\x0e\0\0
+\x0e\0\0 \x0e\0\0Ì\r\0\0\r\0\0\r\0\0f\r\0\0e\r\0\08\r\0\07\r\0\0\x18\r\0\0ã\f\0\0¬\f\0\0{\f\0\0e\f\0\0N\f\0\03\f\0\02\f\0\0\x13\f\0\0Þ\v\0\0Ì\v\0\0Ç\v\0\0Ã\v\0\0Â\v\0\0¹\v\0\0¯\v\0\0}\v\0\0Y\v\0\0P\v\0\0M\v\0\0L\v\0\0@\v\0\0?\v\0\0-\v\0\0!\v\0\0ñ
+\0\0Ö
+\0\0µ
+\0\0
+\0\0
+\0\0~
+\0\0{
+\0\0z
+\0\0o
+\0\0m
+\0\0l
+\0\0V
+\0\0J
+\0\0\x1d
+\0\0\0
+\0\0î \0\0ê \0\0Î \0\0Ì \0\0¹ \0\0¥ \0\0 \0\0 \0\0 \0\0{ \0\0h \0\0W \0\0V \0\0= \0\0" \0\0î\b\0\0Þ\b\0\0Ë\b\0\0À\b\0\0»\b\0\0®\b\0\0ª\b\0\0©\b\0\0\b\0\0\b\0\0S\b\0\0R\b\0\0E\b\0\0\x06\b\0\0÷\a\0\0Ê\a\0\0«\a\0\0\a\0\0\a\0\0\a\0\0}\a\0\0l\a\0\0M\a\0\0L\a\0\0:\a\0\0
+\a\0\0ç\x06\0\0æ\x06\0\0¥\x06\0\0\x06\0\0\x06\0\0\x06\0\0b\x06\0\0R\x06\0\0?\x06\0\04\x06\0\0/\x06\0\0+\x06\0\0\x1c\x06\0\0ú\x05\0\0ù\x05\0\0î\x05\0\0ì\x05\0\0ë\x05\0\0Ñ\x05\0\0Ï\x05\0\0µ\x05\0\0³\x05\0\0²\x05\0\0\x05\0\0\x05\0\0\x05\0\0X\x05\0\0R\x05\0\03\x05\0\01\x05\0\00\x05\0\0\x13\x05\0\0\x11\x05\0\0\b\x05\0\0\x06\x05\0\0\x05\x05\0\0ç\x04\0\0å\x04\0\0Õ\x04\0\0Ó\x04\0\0Ò\x04\0\0³\x04\0\0±\x04\0\0¨\x04\0\0\x04\0\0\x04\0\0\x04\0\0\x04\0\0N\x04\0\0<\x04\0\0\x14\x04\0\0ó\x03\0\0â\x03\0\0¨\x03\0\0\x03\0\0y\x03\0\0t\x03\0\0p\x03\0\0/\x03\0\0ñ\x02\0\0±\x02\0\0°\x02\0\0\0 * rescan) and then exit cleanly and let things go on in the\0 * are calling ifup for a reason, so they probably want to\0 /* We're already running; send a SIGHUP (we presume that they\0 \0 }\0 return -1;\0 strerror(errno), errno);\0 syslog(LOG_ERR, "Could not read old pidfile: %s(%d)",\0 if (fd < 0) {\0 fd = open(pidfile, O_RDONLY);\0 /* Try to open the file for read. */\0 if (fd == -1) {\0 fd = open(pidfile, O_WRONLY|O_TRUNC|O_CREAT|O_EXCL, 0644);\0 do {\0\0 pid_t pid;\0 FILE *f;\0 int fd;\0{\0static int write_pidfile(void)\0\0}\0 terminate = 1;\0{\0static void sig_term(int sig)\0\0}\0 return;\0{\0static void sig_hup(int sig)\0\0}\0 bnep_kill_all_connections();\0 else\0 bnep_kill_connection((void *) strtoba(dst));\0 if (dst)\0{\0static void do_kill(char *dst)\0\0}\0 bnep_show_connections();\0{\0static void do_show(void)\0\0}\0 return r;\0\0 } while (!terminate && persist);\0 bt_free(ii);\0 }\0 }\0 break;\0 terminate = 1;\0 if (r < 0) {\0 r = create_connection(dst, &ii[i].bdaddr);\0\0 }\0 continue;\0 if (bnep_sdp_search(&src_addr, &ii[i].bdaddr, service) <= 0)\0\0 bnep_svc2str(service), dst);\0 syslog(LOG_INFO, "Searching for %s on %s", \0 if (use_sdp) {\0\0 ba2str(&ii[i].bdaddr, dst);\0 char dst[40];\0 for (i = 0; i < n; i++) {\0\0 }\0 continue;\0 strerror(errno), errno);\0 syslog(LOG_ERR, "Inquiry failed. %s(%d)",\0 if (n < 0) {\0 n = hci_inquiry(src_dev, search_duration, 0, NULL, &ii, 0);\0 ii = NULL;\0\0 /* FIXME: Should we use non general LAP here ? */\0\0 syslog(LOG_INFO, "Inquiring");\0\0 }\0 continue;\0 }\0 break;\0 terminate = 1;\0 if (r < 0) {\0 r = create_connection(cache.dst, &cache.bdaddr);\0 /* Use cached bdaddr */\0 if (cache.valid > 0) {\0\0 reconnect = 1;\0 sleep(persist);\0 if (reconnect)\0 do {\0\0 int i, n, r = 0;\0 int reconnect = 0;\0 inquiry_info *ii;\0{\0static int do_connect(void)\0 */\0 * 0 - success\0 * 1 - non critical error\0 * -1 - critical error (exit persist mode)\0 * Returns:\0/* Search and connect\0\0}\0 return r;\0\0 }\0 cache.valid--;\0 } else\0 cache.valid = use_cache;\0 bacpy(&cache.bdaddr, bdaddr);\0 strcpy(cache.dst, dst);\0 /* Succesesful connection, validate cache */\0 if (!r) {\0 if (use_cache) {\0\0 close(sk);\0\0 }\0 r = 1;\0 dst, strerror(errno), errno);\0 syslog(LOG_ERR, "Connect to %s failed. %s(%d)",\0 } else {\0 r = 0;\0\0 }\0 }\0 do_kill(dst);\0 syslog(LOG_INFO, "Disconnecting from %s.", dst);\0 if (terminate && cleanup) {\0\0 w4_hup(sk, &down_cmd);\0 down_cmd.nsk = -1;\0 down_cmd.sk = sk;\0 strncpy(down_cmd.dst, dst, strlen(dst) + 1);\0 strncpy(down_cmd.dev, netdev, strlen(netdev) + 1);\0 memset(&down_cmd, 0, sizeof(struct script_arg));\0 if (persist || devdowncmd) {\0\0 run_script(devupcmd, netdev, dst, sk, -1);\0\0 syslog(LOG_INFO, "%s connected", netdev);\0\0 !bnep_create_connection(sk, role, service, netdev)) {\0 if (!connect(sk, (struct sockaddr *) &l2a, sizeof(l2a)) && \0\0 l2a.l2_psm = htobs(BNEP_PSM);\0 bacpy(&l2a.l2_bdaddr, bdaddr);\0 l2a.l2_family = AF_BLUETOOTH;\0 memset(&l2a, 0, sizeof(l2a));\0\0 strerror(errno), errno);\0 syslog(LOG_ERR, "Bind failed. %s(%d)",\0 if (bind(sk, (struct sockaddr *) &l2a, sizeof(l2a)))\0\0 bacpy(&l2a.l2_bdaddr, &src_addr);\0 l2a.l2_family = AF_BLUETOOTH;\0 memset(&l2a, 0, sizeof(l2a));\0\0 setsockopt(sk, SOL_L2CAP, L2CAP_OPTIONS, &l2o, sizeof(l2o));\0 l2o.imtu = l2o.omtu = BNEP_MTU;\0 getsockopt(sk, SOL_L2CAP, L2CAP_OPTIONS, &l2o, &olen);\0ad\0\0\x0e\0\0\0\x1e\x02\0\0\0\x10\0\0\x7f\0\0\0Â\x0f\0\0\x0f\0\0}\x0f\0\0e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ode = CONNECT;\0 case 'c':\0\0 break;\0 mode = LISTEN;\0 case 's':\0\0 break;\0 detach = 0;\0 mode = SHOW;\0 case 'l':\0 switch(opt) {\0 while ((opt=getopt_long(argc, argv, main_sopts, main_lopts, NULL)) != -1) {\0\0 int opt;\0 int mode = NONE;\0 struct sigaction sa;\0 char *dst = NULL, *src = NULL;\0{\0int main(int argc, char *argv[])\0\0 "\t--devdown -o <script> Script to run when interface comes down\n";\0 "\t--devup -u <script> Script to run when interface comes up\n"\0 "\t--pidfile -P <pidfile> Create PID file\n"\0 "\t--cache -C[valid] Cache addresses\n"\0 "\t--persist -p[interval] Persist mode\n"\0 "\t--nodetach -n Do not become a daemon\n"\0 "\t--master -M Become the master of a piconet\n"\0 "\t--secure -S Secure connection\n"\0 "\t--encrypt -E Enable encryption\n"\0 "\t--auth -A Enable authentication\n"\0 "\t--nosdp -D Disable SDP\n"\0 "\t--device -i <bdaddr> Source bdaddr\n"\0 "\t--ethernet -e <name> Network interface name\n"\0 "\t--service -d <role> Remote PAN service (PANU, NAP, GN)\n"\0 "\t--role -r <role> Local PAN role (PANU, NAP, GN)\n"\0 "\t--killall -K Kill all PAN connections\n"\0 "\t--kill -k <bdaddr> Kill PAN connection\n"\0 "\t--search -Q[duration] Search and connect\n"\0 "\t--autozap -z Disconnect automatically on exit\n"\0 "\t--connect -c <bdaddr> Create PAN connection\n"\0 "\t--listen -s Listen for PAN connections\n"\0 "\t--show --list -l Show active PAN connections\n"\0 "Options:\n"\0 "\tpand <options>\n"\0 "Usage:\n"\0 "Bluetooth PAN daemon version " VERSION " \n"\0static char main_help[] = \0\0static char main_sopts[] = "hsc:k:Kr:d:e:i:lnp::DQ::AESMC::P:u:o:z";\0\0};\0 { 0, 0, 0, 0 }\0 { "autozap", 0, 0, 'z' },\0 { "devdown", 1, 0, 'o' },\0 { "devup", 1, 0, 'u' },\0 { "pidfile", 1, 0, 'P' },\0 { "cache", 0, 0, 'C' },\0 { "master", 0, 0, 'M' },\0 { "secure", 0, 0, 'S' },\0 { "encrypt", 0, 0, 'E' },\0 { "auth", 0, 0, 'A' },\0 { "persist", 2, 0, 'p' },\0 { "nodetach", 0, 0, 'n' },\0 { "show", 0, 0, 'l' },\0 { "list", 0, 0, 'l' },\0 { "nosdp", 0, 0, 'D' },\0 { "device", 1, 0, 'i' },\0 { "ethernet", 1, 0, 'e' },\0 { "service", 1, 0, 'd' },\0 { "role", 1, 0, 'r' },\0 { "killall", 0, 0, 'K' },\0 { "kill", 1, 0, 'k' },\0 { "search", 2, 0, 'Q' },\0 { "connect", 1, 0, 'c' },\0 { "listen", 0, 0, 's' },\0 { "help", 0, 0, 'h' },\0static struct option main_lopts[] = {\0\0}\0 return 0;\0\0 fclose(f);\0 fprintf(f, "%d\n", getpid());\0\0 }\0 return -1;\0 unlink(pidfile);\0 close(fd);\0 strerror(errno), errno);\0 syslog(LOG_ERR, "Could not fdopen new pidfile: %s(%d)",\0 if (!f) {\0 f = fdopen(fd, "w");\0\0 } while(fd == -1);\0 }\0 }\0 }\0 return -1;\0 pidfile = NULL;\0 syslog(LOG_INFO, "Signalling existing process %d and exiting\n", pid);\0 * our way out. */\0 /* Got it. Don't mess with the pid file on\0 } else {\0 fd = -1;\0 unlink(pidfile);\0 syslog(LOG_INFO, "Removing stale pidfile");\0 /* No such pid; remove the bogus pid file. */\0 if (kill(pid, SIGHUP) == -1) {\0 /* Try to kill it. */\0 if (pid) {\0\0 fclose(f);\0 pid = 0;\0 if (fscanf(f, "%d", &pid) != 1)\0 pid = 0;\0\0 }\0 return -1;\0 close(fd);\0 strerror(errno), errno);\0 syslog(LOG_ERR, "Could not fdopen old pidfile: %s(%d)",\0 if (!f) {\0 f = fdopen(fd, "r");\0 */\0 * deleting the pid file for the already-running instance.\0 * background. Muck with the filename so that we don't go\0
\ Pas de fin de ligne à la fin du fichier.
diff -Naur pand.orig/pand.1 pand.new/pand.1
--- pand.orig/pand.1 2006-06-04 15:05:36.000000000 +0200
+++ pand.new/pand.1 2006-11-02 10:58:31.000000000 +0100
@@ -66,6 +66,9 @@
\fB\-\-devup\fR \fB\-u <script>\fR
Script to run when interface comes up
.TP
+\fB\-\-devdown\fR \fB\-o <script>\fR
+Script to run when interface comes down. The script is executed with \fIdevice\fR \fIdestination\fR as arguments.
+.TP
\fB\-\-autozap\fR \fB\-z\fR
Disconnect automatically on exit
[-- Attachment #3: Type: text/plain, Size: 373 bytes --]
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
[-- Attachment #4: Type: text/plain, Size: 164 bytes --]
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [Bluez-devel] Proposal: patch for pand
2006-11-02 10:34 [Bluez-devel] Proposal: patch for pand Olivier Dole
@ 2006-11-02 10:38 ` Olivier Dole
2006-11-07 13:28 ` Olivier Dole
0 siblings, 1 reply; 4+ messages in thread
From: Olivier Dole @ 2006-11-02 10:38 UTC (permalink / raw)
To: BlueZ development
[-- Attachment #1: Type: text/plain, Size: 1836 bytes --]
Sorry tiny error in my patch... a vim swap file was included. Sorry for
this mistake :p
so Here is a cleaner patch.
Regards,
Olivier DOLE
Le jeudi 02 novembre 2006 à 11:34 +0100, Olivier Dole a écrit :
> Hi everyone,
>
> For my work I need a similar mechanism to "devup" script in pand when a
> PAN disconnection occurs.
> That's why I've done the following patch (see attachment for source
> code) which allows PAN daemon to run a "devdown" script either when a
> disconnection is spotted i.e. remote device closes the connection or
> when you explicitly do the disconnection. To use it, simply add the
> following option to your command line:
> pand --options --devdown /path/to/devdown-script
> or
> pand -options -o /path/to/devdown-script
> or you can also read the pand man page ;)
> The behaviour is the same as for "devup" script. I mean when the script
> is run the following arguments are supplied to the script:
> $1 <-> device interface e.g. "bnep0"
> $2 <-> bluetooth address of the disconnected device e.g.
> "00:45:78:AE:B4:01"
> and of course your script must have the correct permissions to run.
>
> Any feedback about this patch is of course welcome ;)
> Hope you will find this patch usefull.
>
> Regards,
> Olivier DOLE
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________ Bluez-devel mailing list Bluez-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bluez-devel
[-- Attachment #2: bluez_pand_dev-down.patch --]
[-- Type: text/x-patch, Size: 5979 bytes --]
diff -Naur pand.orig/main.c pand.new/main.c
--- pand.orig/main.c 2006-09-30 00:23:28.000000000 +0200
+++ pand.new/main.c 2006-11-02 11:03:27.000000000 +0100
@@ -73,6 +73,7 @@
static char netdev[16] = "bnep%d";
static char *pidfile = NULL;
static char *devupcmd = NULL;
+static char *devdowncmd = NULL;
static bdaddr_t src_addr = *BDADDR_ANY;
static int src_dev = -1;
@@ -89,15 +90,22 @@
KILL
} modes;
-static void run_devup(char *dev, char *dst, int sk, int nsk)
+struct script_arg {
+ char dev[20];
+ char dst[20];
+ int sk;
+ int nsk;
+};
+
+static void run_script(char *script, char *dev, char *dst, int sk, int nsk)
{
char *argv[4];
struct sigaction sa;
- if (!devupcmd)
+ if (!script)
return;
-
- if (access(devupcmd, R_OK | X_OK))
+
+ if (access(script, R_OK | X_OK))
return;
if (fork())
@@ -114,16 +122,57 @@
sigaction(SIGCHLD, &sa, NULL);
sigaction(SIGPIPE, &sa, NULL);
- argv[0] = devupcmd;
+ argv[0] = script;
argv[1] = dev;
argv[2] = dst;
argv[3] = NULL;
- execv(devupcmd, argv);
+ execv(script, argv);
exit(1);
}
+/* Wait for disconnect or error condition on the socket */
+static int w4_hup(int sk, struct script_arg *down_cmd)
+{
+ struct pollfd pf;
+ sigset_t sigs;
+ int n;
+
+ sigfillset(&sigs);
+ sigdelset(&sigs, SIGCHLD);
+ sigdelset(&sigs, SIGPIPE);
+ sigdelset(&sigs, SIGTERM);
+ sigdelset(&sigs, SIGINT);
+ sigdelset(&sigs, SIGHUP);
+
+ while (!terminate) {
+ pf.fd = sk;
+ pf.events = POLLERR | POLLHUP;
+ n = ppoll(&pf, 1, NULL, &sigs);
+ if (n < 0) {
+ if (errno == EINTR || errno == EAGAIN)
+ continue;
+ syslog(LOG_ERR, "Poll failed. %s(%d)",
+ strerror(errno), errno);
+ return 1;
+ }
+
+ if (n) {
+ int err = 0;
+ socklen_t olen = sizeof(err);
+ getsockopt(sk, SOL_SOCKET, SO_ERROR, &err, &olen);
+ syslog(LOG_INFO, "%s disconnected%s%s", netdev,
+ err ? " : " : "", err ? strerror(err) : "");
+ if (down_cmd)
+ run_script(devdowncmd, down_cmd->dev, down_cmd->dst, down_cmd->sk, down_cmd->nsk);
+ close(sk);
+ return 0;
+ }
+ }
+ return 0;
+}
+
static int do_listen(void)
{
struct l2cap_options l2o;
@@ -207,12 +256,21 @@
if (!bnep_accept_connection(nsk, role, devname)) {
char str[40];
+ struct script_arg down_cmd;
+
ba2str(&l2a.l2_bdaddr, str);
syslog(LOG_INFO, "New connection from %s %s",
- str, devname);
+ str, netdev);
- run_devup(devname, str, sk, nsk);
+ run_script(devupcmd, devname, str, sk, nsk);
+
+ memset(&down_cmd, 0, sizeof(struct script_arg));
+ strncpy(down_cmd.dev, devname, strlen(devname) + 1);
+ strncpy(down_cmd.dst, str, strlen(str) + 1);
+ down_cmd.sk = sk;
+ down_cmd.nsk = nsk;
+ w4_hup(nsk, &down_cmd);
} else {
syslog(LOG_ERR, "Connection failed. %s(%d)",
strerror(errno), errno);
@@ -227,46 +285,6 @@
return 0;
}
-/* Wait for disconnect or error condition on the socket */
-static int w4_hup(int sk)
-{
- struct pollfd pf;
- sigset_t sigs;
- int n;
-
- sigfillset(&sigs);
- sigdelset(&sigs, SIGCHLD);
- sigdelset(&sigs, SIGPIPE);
- sigdelset(&sigs, SIGTERM);
- sigdelset(&sigs, SIGINT);
- sigdelset(&sigs, SIGHUP);
-
- while (!terminate) {
- pf.fd = sk;
- pf.events = POLLERR | POLLHUP;
- n = ppoll(&pf, 1, NULL, &sigs);
- if (n < 0) {
- if (errno == EINTR || errno == EAGAIN)
- continue;
- syslog(LOG_ERR, "Poll failed. %s(%d)",
- strerror(errno), errno);
- return 1;
- }
-
- if (n) {
- int err = 0;
- socklen_t olen = sizeof(err);
- getsockopt(sk, SOL_SOCKET, SO_ERROR, &err, &olen);
- syslog(LOG_INFO, "%s disconnected%s%s", netdev,
- err ? " : " : "", err ? strerror(err) : "");
-
- close(sk);
- return 0;
- }
- }
- return 0;
-}
-
/* Connect and initiate BNEP session
* Returns:
* -1 - critical error (exit persist mode)
@@ -279,6 +297,7 @@
struct sockaddr_l2 l2a;
socklen_t olen;
int sk, r = 0;
+ struct script_arg down_cmd;
syslog(LOG_INFO, "Connecting to %s", dst);
@@ -314,10 +333,15 @@
syslog(LOG_INFO, "%s connected", netdev);
- run_devup(netdev, dst, sk, -1);
+ run_script(devupcmd, netdev, dst, sk, -1);
- if (persist) {
- w4_hup(sk);
+ if (persist || devdowncmd) {
+ memset(&down_cmd, 0, sizeof(struct script_arg));
+ strncpy(down_cmd.dev, netdev, strlen(netdev) + 1);
+ strncpy(down_cmd.dst, dst, strlen(dst) + 1);
+ down_cmd.sk = sk;
+ down_cmd.nsk = -1;
+ w4_hup(sk, &down_cmd);
if (terminate && cleanup) {
syslog(LOG_INFO, "Disconnecting from %s.", dst);
@@ -525,11 +549,12 @@
{ "cache", 0, 0, 'C' },
{ "pidfile", 1, 0, 'P' },
{ "devup", 1, 0, 'u' },
+ { "devdown", 1, 0, 'o' },
{ "autozap", 0, 0, 'z' },
{ 0, 0, 0, 0 }
};
-static char main_sopts[] = "hsc:k:Kr:d:e:i:lnp::DQ::AESMC::P:u:z";
+static char main_sopts[] = "hsc:k:Kr:d:e:i:lnp::DQ::AESMC::P:u:o:z";
static char main_help[] =
"Bluetooth PAN daemon version " VERSION " \n"
@@ -556,7 +581,8 @@
"\t--persist -p[interval] Persist mode\n"
"\t--cache -C[valid] Cache addresses\n"
"\t--pidfile -P <pidfile> Create PID file\n"
- "\t--devup -u <script> Script to run when interface comes up\n";
+ "\t--devup -u <script> Script to run when interface comes up\n"
+ "\t--devdown -o <script> Script to run when interface comes down\n";
int main(int argc, char *argv[])
{
@@ -661,6 +687,10 @@
devupcmd = strdup(optarg);
break;
+ case 'o':
+ devdowncmd = strdup(optarg);
+ break;
+
case 'z':
cleanup = 1;
break;
diff -Naur pand.orig/pand.1 pand.new/pand.1
--- pand.orig/pand.1 2006-06-04 15:05:36.000000000 +0200
+++ pand.new/pand.1 2006-11-02 10:58:31.000000000 +0100
@@ -66,6 +66,9 @@
\fB\-\-devup\fR \fB\-u <script>\fR
Script to run when interface comes up
.TP
+\fB\-\-devdown\fR \fB\-o <script>\fR
+Script to run when interface comes down. The script is executed with \fIdevice\fR \fIdestination\fR as arguments.
+.TP
\fB\-\-autozap\fR \fB\-z\fR
Disconnect automatically on exit
[-- Attachment #3: Type: text/plain, Size: 373 bytes --]
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
[-- Attachment #4: Type: text/plain, Size: 164 bytes --]
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [Bluez-devel] Proposal: patch for pand
2006-11-02 10:38 ` Olivier Dole
@ 2006-11-07 13:28 ` Olivier Dole
2007-02-26 0:11 ` Marcel Holtmann
0 siblings, 1 reply; 4+ messages in thread
From: Olivier Dole @ 2006-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Lm5ldC9saXN0cy9saXN0aW5mby9i
bHVlei1kZXZlbAo=
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-02-26 0:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-02 10:34 [Bluez-devel] Proposal: patch for pand Olivier Dole
2006-11-02 10:38 ` Olivier Dole
2006-11-07 13:28 ` Olivier Dole
2007-02-26 0:11 ` Marcel Holtmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox