make octopus use a changeable token

This commit is contained in:
Neale Pickett 2011-10-13 21:24:29 -06:00
parent 884ba02a51
commit 61680f9cff
5 changed files with 13 additions and 9 deletions

View File

@ -5,6 +5,7 @@ octopus-install: octopus-build
$(call COPYTREE, packages/octopus/service, $(OCTOPUS_PKGDIR)/service)
cp packages/octopus/tokens.txt $(OCTOPUS_PKGDIR)/
cp packages/octopus/src/octopus $(OCTOPUS_PKGDIR)/bin/
octopus-clean:

View File

@ -1,4 +0,0 @@
#! /bin/sh
IP=$(cat ip.txt)
ip addr del $IP dev eth0

View File

@ -3,6 +3,6 @@
exec 2>&1
IP=$(cat ip.txt)
ip addr add $IP dev eth0
ip monitor | grep -q $IP
exec /opt/octopus/bin/octopus ${IP%/*}
ip addr add $IP dev eth0 || true
exec /opt/octopus/bin/octopus ${IP%/*} < /opt/octopus/tokens.txt

View File

@ -19,8 +19,8 @@
#define max(a,b) (((a)>(b))?(a):(b))
#endif
const char token[] = "octopus:xylep-radar-nanox";
const size_t tokenlen = sizeof(token) - 1;
const char token[100];
size_t tokenlen;
char const octopus[] =
(" ___\n"
@ -338,6 +338,12 @@ main(int argc, char *argv[])
memcpy(&addr, &in6addr_any, sizeof addr);
}
if (NULL == fgets(token, sizeof(token), stdin)) {
perror("Unable to read token");
return EX_IOERR;
}
tokenlen = strlen(token);
bound_ports[0].fd = socket(AF_INET6, SOCK_DGRAM, 0);
ret = bind_port(&addr, bound_ports[0].fd, 8888);
if (-1 == ret) {

View File

@ -0,0 +1 @@
net:xemim-civiz-tyrox