Commit 1325fcc3 authored by Leigh Stoller's avatar Leigh Stoller

Change delay configuration to use findif like we do for ifconfig. At

some point need to change the delays table in the DB.
parent 0b73a121
......@@ -213,8 +213,11 @@ sub dodelays ()
print DEL "sysctl -w net.link.ether.bridge_cfg=${CTLIFACE}:6,";
foreach $delay (@delays) {
$delay =~ /DELAY INT0=(\w+) INT1=(\w+) DELAY/;
print DEL "$1:$count,$2:$count,";
$delay =~ /DELAY INT0=([\d\w]+) INT1=([\d\w]+) DELAY/;
my $iface1 = libsetup::findiface($1);
my $iface2 = libsetup::findiface($2);
print DEL "$iface1:$count,$iface2:$count,";
$count++;
}
print DEL "\n";
......@@ -226,13 +229,13 @@ sub dodelays ()
$pipe = 100;
foreach $delay (@delays) {
$delay =~
/DELAY INT0=(\w+) INT1=(\w+) DELAY=(\d+) BW=([\d\.]+) PLR=([\d\.]+)/;
/DELAY INT0=([\d\w]+) INT1=([\d\w]+) DELAY=(\d+) BW=([\d\.]+) PLR=([\d\.]+)/;
#
# tmcd returns the INTs as fxpX. Nice, eh?
# tmcd returns the INTs as MAC addrs.
#
$iface1 = $1;
$iface2 = $2;
my $iface1 = libsetup::findiface($1);
my $iface2 = libsetup::findiface($2);
$p1 = $pipe += 10;
$p2 = $pipe += 10;
$delay = $3;
......
......@@ -857,15 +857,14 @@ dodelay(int sock, struct in_addr ipaddr, char *rdata, int tcp)
* join is to get the type out so that we can pass it back. Of
* course, this assumes that the type is the BSD name, not linux.
*/
res = mydb_query("select iface0,i.interface_type,"
" iface1,j.interface_type,delay,bandwidth,lossrate "
res = mydb_query("select i.MAC,j.MAC,delay,bandwidth,lossrate "
" from delays "
"left join interfaces as i on "
" i.node_id=delays.node_id and i.iface=iface0 "
"left join interfaces as j on "
" j.node_id=delays.node_id and j.iface=iface1 "
" where delays.node_id='%s'",
7, nodeid);
5, nodeid);
if (!res) {
syslog(LOG_ERR, "DELAY: %s: DB Error getting delays!",
nodeid);
......@@ -877,8 +876,6 @@ dodelay(int sock, struct in_addr ipaddr, char *rdata, int tcp)
return 0;
}
while (nrows) {
char card0[64], card1[64];
row = mysql_fetch_row(res);
/*
......@@ -891,14 +888,10 @@ dodelay(int sock, struct in_addr ipaddr, char *rdata, int tcp)
mysql_free_result(res);
return 1;
}
strcpy(card0, row[1]);
strcat(card0, strpbrk(row[0], "0123456789"));
strcpy(card1, row[3]);
strcat(card1, strpbrk(row[2], "0123456789"));
sprintf(buf,
"DELAY INT0=%s INT1=%s DELAY=%s BW=%s PLR=%s\n",
card0, card1, row[4], row[5], row[6]);
row[0], row[1], row[2], row[3], row[4]);
client_writeback(sock, buf, strlen(buf), tcp);
nrows--;
......
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