Commit 2fa6d707 authored by Leigh Stoller's avatar Leigh Stoller

Some minor changes to support writing out a mapping file for the event

system, of the form:

	link0	fxp0  pipenumber1
	link0	fxp1  pipenumber2
	link1   fxp1  pipenumber
parent 0f29595a
......@@ -60,6 +60,7 @@ my $IFACE = "fxp";
my $CTLIFACENUM = "4";
my $CTLIFACE = "${IFACE}${CTLIFACENUM}";
my $TMDELAY = "$SETUPDIR/rc.delay";
my $TMDELMAP = "$SETUPDIR/delay_mapping";
my $TMCCCMD_DELAY = "delay";
#
......@@ -269,6 +270,9 @@ sub dodelays ()
print DEL "sysctl -w net.link.ether.bridge_ipfw=0\n";
print DEL "sysctl -w net.link.ether.bridge_cfg=";
open(MAP, ">$TMDELMAP")
or die("Could not open $TMDELMAP");
foreach $delay (@delays) {
$delay =~ /DELAY INT0=([\d\w]+) INT1=([\d\w]+) /;
my $iface1 = libsetup::findiface($1);
......@@ -286,7 +290,8 @@ sub dodelays ()
foreach $delay (@delays) {
$pat = q(DELAY INT0=([\d\w]+) INT1=([\d\w]+) );
$pat .= q(PIPE0=(\d+) DELAY0=([\d\.]+) BW0=(\d+) PLR0=([\d\.]+) );
$pat .= q(PIPE1=(\d+) DELAY1=([\d\.]+) BW1=(\d+) PLR1=([\d\.]+));
$pat .= q(PIPE1=(\d+) DELAY1=([\d\.]+) BW1=(\d+) PLR1=([\d\.]+) );
$pat .= q(LINKNAME=([\d\w]+));
$delay =~ /$pat/;
......@@ -303,6 +308,7 @@ sub dodelays ()
$delay2 = $8;
$bandw2 = $9;
$plr2 = $10;
$linkname = $11;
#
# Delays are floating point numbers (unit is ms). ipfw does not
......@@ -328,6 +334,9 @@ sub dodelays ()
print STDOUT "${delay1}ms bw ${bandw1}Kbit/s plr $plr1\n";
print STDOUT " $iface1/$iface2 pipe $p2 config delay ";
print STDOUT "${delay2}ms bw ${bandw2}Kbit/s plr $plr2\n";
print MAP "$linkname $iface1 $p1\n";
print MAP "$linkname $iface2 $p2\n";
$count++;
}
......@@ -341,6 +350,7 @@ sub dodelays ()
print DEL "echo \"Delay Configuration Complete\"\n";
close(DEL);
chmod(0755, "$TMDELAY");
close(MAP);
#
# Now do kernel configuration. All of the above work is wasted, but
......
......@@ -933,14 +933,15 @@ dodelay(int sock, struct in_addr ipaddr, char *rdata, int tcp)
*/
res = mydb_query("select i.MAC,j.MAC, "
"pipe0,delay0,bandwidth0,lossrate0, "
"pipe1,delay1,bandwidth1,lossrate1 "
"pipe1,delay1,bandwidth1,lossrate1, "
"vname "
" 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'",
10, nodeid);
11, nodeid);
if (!res) {
syslog(LOG_ERR, "DELAY: %s: DB Error getting delays!",
nodeid);
......@@ -967,10 +968,12 @@ dodelay(int sock, struct in_addr ipaddr, char *rdata, int tcp)
sprintf(buf, "DELAY INT0=%s INT1=%s "
"PIPE0=%s DELAY0=%s BW0=%s PLR0=%s "
"PIPE1=%s DELAY1=%s BW1=%s PLR1=%s\n",
"PIPE1=%s DELAY1=%s BW1=%s PLR1=%s "
"LINKNAME=%s\n",
row[0], row[1],
row[2], row[3], row[4], row[5],
row[6], row[7], row[8], row[9]);
row[6], row[7], row[8], row[9],
row[10]);
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