Commit c5a89400 authored by Leigh B. Stoller's avatar Leigh B. Stoller
Browse files

Return configuration info for physical interfaces used for delay

nodes, rather then hardwiring the speed/duplex in delaysetup. We
already started doing this for phys interfaces underlying veth
interfaces, but Mike requested we do this for delay nodes as well so
that we do not hardwire 100Mb into the script.
parent e52f7cae
......@@ -88,6 +88,8 @@ if (REMOTE() || MFS()) {
exit(0);
}
print "Checking Testbed delay configuration ... \n";
# Uninstall just looks for the files, runs them, and exits.
if ($uninstall) {
system(TMDELAY . " disable")
......@@ -316,10 +318,6 @@ sub DelaySetup
$redparams2 .= "$weight2/$minthresh2/$maxthresh2/$max_p";
}
print DEL "ifconfig $iface1 media 100baseTX mediaopt full-duplex";
print DEL "\n";
print DEL "ifconfig $iface2 media 100baseTX mediaopt full-duplex";
print DEL "\n";
print DEL "ipfw add pipe $p1 ip from any to any in recv $iface1\n";
print DEL "ipfw add pipe $p2 ip from any to any in recv $iface2\n";
print DEL "ipfw pipe $p1 config delay ${delay1}ms ";
......
......@@ -254,9 +254,6 @@ sub LinkDelaySetup()
# XXX: temporarily select between delay, plr, and [g]red
# until they become classful queues.
print DEL "mii-tool --force 100baseTx-FD $iface";
print DEL "\n";
print DEL "ifconfig $iface txqueuelen $queue\n";
print DEL "$TC qdisc add dev $iface handle $pipeno root ";
......
......@@ -284,8 +284,10 @@ sub os_ifconfig_line($$$$$$$;$$)
$uplines = "/sbin/mii-tool --force=$media $iface\n ";
}
if ($inet ne "") {
$uplines .= sprintf($IFCONFIG, $iface, $inet, $mask);
$downlines = "$IFCONFIGBIN $iface down";
}
return ($uplines, $downlines);
}
......
......@@ -1297,13 +1297,17 @@ COMMAND_PROTOTYPE(doifconfig)
* back every single time!
*/
if (vers >= 18 && !reqp->isvnode) {
/*
* First do phys interfaces underlying veth interfaces
*/
res = mydb_query("select distinct "
" i.interface_type,i.mac, "
" i.current_speed,i.duplex "
" from veth_interfaces as v "
"left join interfaces as i on "
" i.node_id=v.node_id and i.iface=v.iface "
"where v.iface is not null and v.node_id='%s'",
"where v.iface is not null and "
" v.node_id='%s'",
4, reqp->pnodeid);
if (!res) {
error("IFCONFIG: %s: "
......@@ -1330,6 +1334,54 @@ COMMAND_PROTOTYPE(doifconfig)
nrows--;
}
mysql_free_result(res);
/*
* Now do phys interfaces underlying delay interfaces.
*/
res = mydb_query("select i.interface_type,i.MAC,"
" i.current_speed,i.duplex, "
" j.interface_type,j.MAC,"
" j.current_speed,j.duplex "
" from delays as d "
"left join interfaces as i on "
" i.node_id=d.node_id and i.iface=iface0 "
"left join interfaces as j on "
" j.node_id=d.node_id and j.iface=iface1 "
"where d.node_id='%s'",
8, reqp->pnodeid);
if (!res) {
error("IFCONFIG: %s: "
"DB Error getting interfaces underlying delays!\n",
reqp->nodeid);
return 1;
}
nrows = (int)mysql_num_rows(res);
while (nrows) {
char *bufp = buf;
row = mysql_fetch_row(res);
bufp += OUTPUT(bufp, ebufp - bufp,
"INTERFACE IFACETYPE=%s "
"INET= MASK= MAC=%s "
"SPEED=%sMbps DUPLEX=%s "
"IPALIASES=\"\" IFACE= "
"RTABID= LAN=\n",
row[0], row[1], row[2], row[3]);
bufp += OUTPUT(bufp, ebufp - bufp,
"INTERFACE IFACETYPE=%s "
"INET= MASK= MAC=%s "
"SPEED=%sMbps DUPLEX=%s "
"IPALIASES=\"\" IFACE= "
"RTABID= LAN=\n",
row[4], row[5], row[6], row[7]);
client_writeback(sock, buf, strlen(buf), tcp);
if (verbose)
info("IFCONFIG: %s", buf);
nrows--;
}
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