Commit c63f476a authored by Shashi Guruprasad's avatar Shashi Guruprasad
Browse files

Nuked "tmcc routelist". Was to be used in fixing the nse routing problem

but eventually did not use it. Current images still make a call to it
from libsetup but will get an empty string that doesn't affect anything.
parent 3ec9f111
......@@ -201,7 +201,6 @@ sub TMCCCMD_VNODELIST() { "vnodelist"; }
sub TMCCCMD_ISALIVE() { "isalive"; }
sub TMCCCMD_SFSHOSTID() { "sfshostid"; }
sub TMCCCMD_SFSMOUNTS() { "sfsmounts"; }
sub TMCCCMD_ROUTELIST() { "routelist"; }
sub TMCCCMD_JAILCONFIG(){ "jailconfig"; }
#
......@@ -1500,13 +1499,6 @@ sub dotrafficconfig()
print IFCFG <$TM>;
close(IFCFG);
CLOSETMCC($TM);
$TM = OPENTMCC(TMCCCMD_ROUTELIST);
open(ROUTELIST, ">$BOOTDIR/tmcc.routelist") or
die "Cannot open file $BOOTDIR/tmcc.routelist: $!";
print ROUTELIST <$TM>;
close(ROUTELIST);
CLOSETMCC($TM);
$/ = $record_sep;
open(TRAFCFG, ">$BOOTDIR/tmcc.trafgens") or
......
......@@ -201,7 +201,6 @@ sub TMCCCMD_VNODELIST() { "vnodelist"; }
sub TMCCCMD_ISALIVE() { "isalive"; }
sub TMCCCMD_SFSHOSTID() { "sfshostid"; }
sub TMCCCMD_SFSMOUNTS() { "sfsmounts"; }
sub TMCCCMD_ROUTELIST() { "routelist"; }
sub TMCCCMD_JAILCONFIG(){ "jailconfig"; }
#
......@@ -1500,13 +1499,6 @@ sub dotrafficconfig()
print IFCFG <$TM>;
close(IFCFG);
CLOSETMCC($TM);
$TM = OPENTMCC(TMCCCMD_ROUTELIST);
open(ROUTELIST, ">$BOOTDIR/tmcc.routelist") or
die "Cannot open file $BOOTDIR/tmcc.routelist: $!";
print ROUTELIST <$TM>;
close(ROUTELIST);
CLOSETMCC($TM);
$/ = $record_sep;
open(TRAFCFG, ">$BOOTDIR/tmcc.trafgens") or
......
......@@ -156,7 +156,6 @@ COMMAND_PROTOTYPE(doipodinfo);
COMMAND_PROTOTYPE(doatarball);
COMMAND_PROTOTYPE(dontpinfo);
COMMAND_PROTOTYPE(dontpdrift);
COMMAND_PROTOTYPE(doroutelist);
COMMAND_PROTOTYPE(dojailconfig);
struct command {
......@@ -196,7 +195,6 @@ struct command {
{ "ntpinfo", dontpinfo},
{ "ntpdrift", dontpdrift},
{ "tarball", doatarball},
{ "routelist", doroutelist},
{ "jailconfig", dojailconfig},
};
static int numcommands = sizeof(command_array)/sizeof(struct command);
......@@ -4066,111 +4064,6 @@ safesyscall(int sysnum, ...)
return retval;
}
/*
* Return routing stuff.
*/
COMMAND_PROTOTYPE(doroutelist)
{
MYSQL_RES *res;
MYSQL_ROW row;
char buf[MYBUFSIZE];
int n, nrows;
/*
* Now check reserved table
*/
if (!reqp->allocated) {
error("ROUTES: %s: Node is free\n", reqp->nodeid);
return 1;
}
/*
* Get the routing type from the nodes table.
*/
res = mydb_query("select routertype from nodes where node_id='%s'",
1, reqp->nodeid);
if (!res) {
error("ROUTES: %s: DB Error getting router type!\n",
reqp->nodeid);
return 1;
}
if ((int)mysql_num_rows(res) == 0) {
mysql_free_result(res);
return 0;
}
/*
* Return type.
*/
row = mysql_fetch_row(res);
if (! row[0] || !row[0][0]) {
mysql_free_result(res);
return 0;
}
sprintf(buf, "ROUTERTYPE=%s\n", row[0]);
mysql_free_result(res);
client_writeback(sock, buf, strlen(buf), tcp);
info("ROUTES: %s", buf);
/*
* Get the route list.
*/
res = mydb_query("select vname,src,dst,dst_type,dst_mask,nexthop,cost "
"from virt_routes "
" where pid='%s' and eid='%s'",
7, reqp->pid, reqp->eid);
if (!res) {
error("ROUTES: %s: DB Error getting manual routes!\n",
reqp->nodeid);
return 1;
}
if ((nrows = (int)mysql_num_rows(res)) == 0) {
mysql_free_result(res);
return 0;
}
n = nrows;
while (n) {
char dstip[32];
row = mysql_fetch_row(res);
/*
* OMG, the Linux route command is too stupid to accept a
* host-on-a-subnet as the subnet address, so we gotta mask
* off the bits manually for network routes.
*
* Eventually we'll perform this operation in the NS parser
* so it appears in the DB correctly.
*/
if (strcmp(row[3], "net") == 0) {
struct in_addr tip, tmask;
inet_aton(row[2], &tip);
inet_aton(row[4], &tmask);
tip.s_addr &= tmask.s_addr;
strncpy(dstip, inet_ntoa(tip), sizeof(dstip));
} else
strncpy(dstip, row[2], sizeof(dstip));
sprintf(buf, "ROUTE NODE=%s SRC=%s DEST=%s DESTTYPE=%s "
"DESTMASK=%s NEXTHOP=%s COST=%s\n",
row[0], row[1], dstip, row[3], row[4], row[5], row[6]);
client_writeback(sock, buf, strlen(buf), tcp);
n--;
}
mysql_free_result(res);
info("ROUTES: %d routes in list\n", nrows);
return 0;
}
/*
* Return the config for a virtual (jailed) node.
*/
......
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