Commit 95d16cbf authored by Mike Hibler's avatar Mike Hibler

Return some firewall variables/values which can be used in firewall rules.

Bump version # to 22 as a result.
parent f6e353a7
/*
* EMULAB-COPYRIGHT
* Copyright (c) 2000-2004 University of Utah and the Flux Group.
* Copyright (c) 2000-2005 University of Utah and the Flux Group.
* All rights reserved.
*/
......@@ -25,4 +25,4 @@
* NB: See ron/libsetup.pm. That is version 4! I'll merge that in.
*/
#define DEFAULT_VERSION 2
#define CURRENT_VERSION 21
#define CURRENT_VERSION 22
/*
* EMULAB-COPYRIGHT
* Copyright (c) 2000-2004 University of Utah and the Flux Group.
* Copyright (c) 2000-2005 University of Utah and the Flux Group.
* All rights reserved.
*/
......@@ -5188,6 +5188,8 @@ COMMAND_PROTOTYPE(dofwinfo)
/*
* See if this node's experiment has an associated firewall
*
* XXX will only work if there is one firewall per experiment.
*/
res = mydb_query("select r.node_id,f.type,f.style,f.fwname,i.IP,i.mac,f.vlan "
"from firewalls as f "
......@@ -5276,6 +5278,38 @@ COMMAND_PROTOTYPE(dofwinfo)
strncpy(fwname, row[3], sizeof(fwname));
mysql_free_result(res);
/*
* Return firewall variables
* XXX these could come out of the database
*/
if (vers > 21) {
OUTPUT(buf, sizeof(buf), "VAR=%s VALUE=\"%s\"\n",
"EMULAB_BOSS", "boss");
client_writeback(sock, buf, strlen(buf), tcp);
OUTPUT(buf, sizeof(buf), "VAR=%s VALUE=\"%s\"\n",
"EMULAB_FS", "fs");
client_writeback(sock, buf, strlen(buf), tcp);
OUTPUT(buf, sizeof(buf), "VAR=%s VALUE=\"%s\"\n",
"EMULAB_USERS", "users");
client_writeback(sock, buf, strlen(buf), tcp);
#ifdef CONTROL_NETWORK
{
unsigned addr, bits = 32;
struct in_addr mask;
inet_aton(CONTROL_NETMASK, &mask);
addr = ~ntohl(mask.s_addr);
while (addr && (addr & 1)) {
addr >>= 1;
bits--;
}
OUTPUT(buf, sizeof(buf), "VAR=%s VALUE=\"%s/%d\"\n",
"EMULAB_CNET", CONTROL_NETWORK, bits);
client_writeback(sock, buf, strlen(buf), tcp);
}
#endif
}
/*
* Get the user firewall rules from the DB and return them.
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment