Commit c0b4aa78 authored by Leigh B. Stoller's avatar Leigh B. Stoller

Oops, I committed my variable netmask changes to tmcd. I'm backing

that part out since it is not finished/tested.
parent 9da75cd2
......@@ -57,8 +57,7 @@
#define DOTSFS ".sfs"
#define TESTMODE
#define DEFAULTNETMASK "255.255.255.0"
#define CHECKMASK(arg) ((arg) && (arg[0]) ? (arg) : DEFAULTNETMASK)
#define NETMASK "255.255.255.0"
#define DISKTYPE "ad"
#define DISKNUM 0
......@@ -976,9 +975,9 @@ COMMAND_PROTOTYPE(doifconfig)
* Find all the interfaces.
*/
res = mydb_query("select card,IP,IPalias,MAC,current_speed,duplex, "
" IPaliases,iface,role,mask "
" IPaliases,iface,role "
"from interfaces where node_id='%s'",
10, reqp->nodeid);
9, reqp->nodeid);
if (!res) {
error("IFCONFIG: %s: DB Error getting interfaces!\n",
reqp->nodeid);
......@@ -999,7 +998,6 @@ COMMAND_PROTOTYPE(doifconfig)
char *speed = "100";
char *unit = "Mbps";
char *duplex = "full";
char *mask = CHECKMASK(row[9]);
/* Never for the control net; sharks are dead */
if (strcmp(role, TBDB_IFACEROLE_EXPERIMENT))
......@@ -1024,7 +1022,7 @@ COMMAND_PROTOTYPE(doifconfig)
sprintf(&buf[strlen(buf)],
"INET=%s MASK=%s MAC=%s SPEED=%s%s DUPLEX=%s",
row[1], mask, row[3], speed, unit, duplex);
row[1], NETMASK, row[3], speed, unit, duplex);
/* Tack on IPaliases */
if (vers >= 8) {
......@@ -1077,12 +1075,12 @@ COMMAND_PROTOTYPE(doifconfig)
/*
* Find all the veth interfaces.
*/
res = mydb_query("select v.veth_id,v.IP,v.mac,i.mac,v.mask "
res = mydb_query("select v.veth_id,v.IP,v.mac,i.mac "
" from veth_interfaces as v "
"left join interfaces as i on "
" i.node_id=v.node_id and i.iface=v.iface "
"where v.node_id='%s' and %s",
5, reqp->pnodeid, buf);
4, reqp->pnodeid, buf);
if (!res) {
error("IFCONFIG: %s: DB Error getting veth interfaces!\n",
reqp->nodeid);
......@@ -1103,7 +1101,7 @@ COMMAND_PROTOTYPE(doifconfig)
sprintf(buf,
"IFACETYPE=veth "
"INET=%s MASK=%s ID=%s VMAC=%s PMAC=%s\n",
row[1], CHECKMASK(row[4]), row[0], row[2],
row[1], NETMASK, row[0], row[2],
row[3] ? row[3] : "none");
client_writeback(sock, buf, strlen(buf), tcp);
......@@ -1773,7 +1771,7 @@ COMMAND_PROTOTYPE(dolinkdelay)
"MEANPSIZE=%s WAIT=%s SETBIT=%s "
"DROPTAIL=%s GENTLE=%s\n",
(row[27] ? row[27] : row[0]), row[1],
row[2], row[3], row[4], CHECKMASK(row[5]),
row[2], row[3], row[4], row[5],
row[6], row[7], row[8], row[9],
row[10], row[11], row[12], row[14],
row[14], row[15], row[16], row[17], row[18],
......@@ -3344,9 +3342,9 @@ COMMAND_PROTOTYPE(dotunnels)
}
res = mydb_query("select vname,isserver,peer_ip,port,password, "
" encrypt,compress,assigned_ip,proto,mask "
" encrypt,compress,assigned_ip,proto "
"from tunnels where node_id='%s'",
10, reqp->nodeid);
9, reqp->nodeid);
if (!res) {
error("TUNNELS: %s: DB Error getting tunnels\n", reqp->nodeid);
......@@ -3364,7 +3362,7 @@ COMMAND_PROTOTYPE(dotunnels)
"PASSWORD=%s ENCRYPT=%s COMPRESS=%s "
"INET=%s MASK=%s PROTO=%s\n",
row[0], row[1], row[2], row[3], row[4],
row[5], row[6], row[7], CHECKMASK(row[9]), row[8]);
row[5], row[6], row[7], NETMASK, row[8]);
client_writeback(sock, buf, strlen(buf), tcp);
......@@ -4634,15 +4632,14 @@ COMMAND_PROTOTYPE(doixpconfig)
* Get the "control" net address for the IXP from the interfaces
* table. This is really a virtual pci/eth interface.
*/
res = mydb_query("select i1.IP,i1.iface,i2.iface,i2.mask "
" from nodes as n "
res = mydb_query("select i1.IP,i1.iface,i2.iface from nodes as n "
"left join node_types as nt on n.type=nt.type "
"left join interfaces as i1 on i1.node_id=n.node_id "
" and i1.iface=nt.control_iface "
"left join interfaces as i2 on i2.node_id='%s' "
" and i2.card=255 "
"where n.node_id='%s'",
4, reqp->pnodeid, reqp->nodeid);
3, reqp->pnodeid, reqp->nodeid);
if (!res) {
error("IXPCONFIG: %s: DB Error getting config!\n",
......@@ -4662,13 +4659,10 @@ COMMAND_PROTOTYPE(doixpconfig)
error("IXPCONFIG: %s: No host interface!\n", reqp->nodeid);
return 1;
}
if (!row[3]) {
error("IXPCONFIG: %s: No mask!\n", reqp->nodeid);
return 1;
}
inet_aton(CHECKMASK(row[3]), &mask_addr);
inet_aton(row[0], &bcast_addr);
inet_aton(row[0], &gw_addr);
inet_aton(NETMASK, &mask_addr);
inet_aton(row[0], &bcast_addr);
inet_aton(row[0], &gw_addr);
/*
* Not sure we should do this here?
......@@ -4690,7 +4684,7 @@ COMMAND_PROTOTYPE(doixpconfig)
"HOST_IFACE=\"%s\"\n"
"NETMASK=\"%s\"\n",
row[0], row[1], bcast_ip, reqp->nickname,
gw_ip, row[2], row[3]);
gw_ip, row[2], NETMASK);
client_writeback(sock, buf, strlen(buf), tcp);
mysql_free_result(res);
......
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