Commit c0da7f3c authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Merge branch 'master' of git-public.flux.utah.edu:/flux/git/emulab-devel

parents f2a9dae6 b3943c83
......@@ -759,9 +759,14 @@ sub send_mail($$@) {
# Given a full refname, pull off the last part for pretty printing
#
sub short_refname($) {
my ($refname) = @_;
$refname =~ /([^\/]+)$/;
return $1;
my ($ref) = @_;
my $refname = `git rev-parse --abbrev-ref $ref $STDERRNULL`;
chomp $refname;
# This shouldn't be necessary, but return the full ref if
# rev-parse doesn't return anything.
$refname = $ref if (!$refname);
return $refname;
}
#
......
#!/usr/bin/perl -wT
#
# EMULAB-COPYRIGHT
# Copyright (c) 2008 University of Utah and the Flux Group.
# Copyright (c) 2008, 2010 University of Utah and the Flux Group.
# All rights reserved.
#
use strict;
......@@ -19,18 +19,20 @@ sub usage()
print STDOUT "-r Show only traffic received by each node\n";
print STDOUT "-s Show only traffic sent by each node\n";
print STDOUT "-i seconds Show stats over a <seconds>-period interval\n";
print STDOUT "-E Aggregate by experiment\n";
# print STDOUT "-C Show control net traffic\n";
exit(-1);
}
sub gather($$);
my $optlist = "Ci:ars";
my $optlist = "CEi:ars";
my $debug = 0;
my $interval = 0;
my $doall = 0;
my $send = 1;
my $recv = 1;
my $byexpt = 0;
# XXX only does control net right now
my $controlnet = 1;
......@@ -95,6 +97,9 @@ if (defined($options{"i"})) {
die("Bogus interval $interval\n");
}
}
if (defined($options{"E"})) {
$byexpt = 1;
}
if (defined($options{"C"})) {
$controlnet = 1;
}
......@@ -141,6 +146,8 @@ if ($interval > 0) {
my %after = ();
gather(\%pcs, \%after);
my %expcounts = ();
# weed out bad boys
my @list = ();
foreach my $node (keys %pcs) {
......@@ -164,21 +171,56 @@ foreach my $node (keys %pcs) {
}
$pcs{$node}{'total'} = $total;
push(@list, $node);
if ($byexpt) {
my $cb = $before{$node}{'totals'};
my $ca = $after{$node}{'totals'};
my $exp = $pcs{$node}{'exp'};
if (!exists($expcounts{$exp})) {
$expcounts{$exp} = [ 0, 0, 0, 0 ];
}
$expcounts{$exp}->[0] += ($ca->[0] - $cb->[0]);
$expcounts{$exp}->[1] += ($ca->[1] - $cb->[1]);
$expcounts{$exp}->[2] += ($ca->[2] - $cb->[2]);
$expcounts{$exp}->[3] += ($ca->[3] - $cb->[3]);
}
}
if ($byexpt) {
printf("%25s %12s %12s %12s %12s\n",
"Experiment", "Tot Pkts", "Unicast", "Non-Uni", "Tot Bytes");
foreach my $exp (sort esortem keys %expcounts) {
printf("%25s %12d %12d %12d %12d\n",
$exp, $expcounts{$exp}->[3],
$expcounts{$exp}->[1],
$expcounts{$exp}->[2],
$expcounts{$exp}->[0]);
}
} else {
@list = sort sortem @list;
printf("%12s %25s %12s %12s %12s %12s\n",
"Node", "Experiment", "Tot Pkts", "Unicast", "Non-Uni", "Tot Bytes");
foreach my $node (@list) {
my $cb = $before{$node}{'totals'};
my $ca = $after{$node}{'totals'};
my $exp = $pcs{$node}{'exp'};
my $s = $pcs{$node}{'state'};
printf("%12s %25s %12d %12d %12d %12d\n",
$node, $exp,
$ca->[3]-$cb->[3], $ca->[1]-$cb->[1],
$ca->[2]-$cb->[2], $ca->[0]-$cb->[0]);
}
}
@list = sort sortem @list;
printf("%12s %25s %12s %12s %12s %12s\n",
"Node", "Experiment", "Tot Pkts", "Unicast", "Non-Uni", "Tot Bytes");
foreach my $node (@list) {
my $cb = $before{$node}{'totals'};
my $ca = $after{$node}{'totals'};
my $exp = $pcs{$node}{'exp'};
my $s = $pcs{$node}{'state'};
sub esortem($$)
{
my ($a, $b) = @_;
printf("%12s %25s %12d %12d %12d %12d\n",
$node, $exp,
$ca->[3]-$cb->[3], $ca->[1]-$cb->[1],
$ca->[2]-$cb->[2], $ca->[0]-$cb->[0]);
my $atot = $expcounts{$a}->[3];
my $btot = $expcounts{$b}->[3];
return $btot <=> $atot;
}
sub sortem($$)
......
......@@ -947,7 +947,7 @@ function DOLOGIN($token, $password, $adminmode = 0) {
function DOLOGIN_MAGIC($uid, $uid_idx, $email = null, $adminon = 0)
{
global $TBAUTHCOOKIE, $TBAUTHDOMAIN, $TBAUTHTIMEOUT;
global $TBAUTHCOOKIE, $TBAUTHDOMAIN, $TBAUTHTIMEOUT, $WWWHOST;
global $TBNAMECOOKIE, $TBLOGINCOOKIE, $TBSECURECOOKIES, $TBEMAILCOOKIE;
global $TBMAIL_OPS, $TBMAIL_AUDIT, $TBMAIL_WWW;
global $WIKISUPPORT, $WIKICOOKIENAME;
......@@ -979,6 +979,16 @@ function DOLOGIN_MAGIC($uid, $uid_idx, $email = null, $adminon = 0)
# Issue the cookie requests so that subsequent pages come back
# with the hash value and auth usr embedded.
#
# Since we changed the domain of the cookies make sure that the cookies
# from the old domain no longer exist.
#
setcookie($TBAUTHCOOKIE, '', 1, "/", $TBAUTHDOMAIN, $TBSECURECOOKIES);
setcookie($TBLOGINCOOKIE, '', 1, "/", $TBAUTHDOMAIN, 0);
setcookie($TBNAMECOOKIE, '', 1, "/", $TBAUTHDOMAIN, 0);
if ($email)
setcookie($TBEMAILCOOKIE, '', 1, "/", $TBAUTHDOMAIN, 0);
#
# For the hashkey, we use a zero timeout so that the cookie is
# a session cookie; killed when the browser is exited. Hopefully this
......@@ -987,7 +997,7 @@ function DOLOGIN_MAGIC($uid, $uid_idx, $email = null, $adminon = 0)
# at the server so it will become invalid at some point.
#
setcookie($TBAUTHCOOKIE, $hashkey, 0, "/",
$TBAUTHDOMAIN, $TBSECURECOOKIES);
$WWWHOST, $TBSECURECOOKIES);
#
# Another cookie, to help in menu generation. See above in
......@@ -996,14 +1006,14 @@ function DOLOGIN_MAGIC($uid, $uid_idx, $email = null, $adminon = 0)
# All this does is change the menu options presented, imparting
# no actual privs.
#
setcookie($TBLOGINCOOKIE, $crc, 0, "/", $TBAUTHDOMAIN, 0);
setcookie($TBLOGINCOOKIE, $crc, 0, "/", $WWWHOST, 0);
#
# We want to remember who the user was each time they load a page
# NOTE: This cookie is integral to authorization, since we do not pass
# around the UID anymore, but look for it in the cookie.
#
setcookie($TBNAMECOOKIE, $uid_idx, 0, "/", $TBAUTHDOMAIN, 0);
setcookie($TBNAMECOOKIE, $uid_idx, 0, "/", $WWWHOST, 0);
#
# This is a long term cookie so we can remember who the user was, and
......@@ -1011,7 +1021,7 @@ function DOLOGIN_MAGIC($uid, $uid_idx, $email = null, $adminon = 0)
#
if ($email) {
$timeout = $now + (60 * 60 * 24 * 365);
setcookie($TBEMAILCOOKIE, $email, $timeout, "/", $TBAUTHDOMAIN, 0);
setcookie($TBEMAILCOOKIE, $email, $timeout, "/", $WWWHOST, 0);
}
#
......@@ -1082,7 +1092,7 @@ function VERIFYPASSWD($uid, $password) {
#
function DOLOGOUT($user) {
global $CHECKLOGIN_STATUS, $CHECKLOGIN_USER;
global $TBAUTHCOOKIE, $TBLOGINCOOKIE, $TBAUTHDOMAIN;
global $TBAUTHCOOKIE, $TBLOGINCOOKIE, $TBAUTHDOMAIN, $WWWHOST;
global $WIKISUPPORT, $WIKICOOKIENAME, $HTTP_COOKIE_VARS;
global $BUGDBSUPPORT, $BUGDBCOOKIENAME, $TRACSUPPORT, $TRACCOOKIENAME;
......@@ -1140,8 +1150,8 @@ function DOLOGOUT($user) {
#
$timeout = time() - 3600;
setcookie($TBAUTHCOOKIE, "", $timeout, "/", $TBAUTHDOMAIN, 0);
setcookie($TBLOGINCOOKIE, "", $timeout, "/", $TBAUTHDOMAIN, 0);
setcookie($TBAUTHCOOKIE, "", $timeout, "/", $WWWHOST, 0);
setcookie($TBLOGINCOOKIE, "", $timeout, "/", $WWWHOST, 0);
if ($TRACSUPPORT) {
setcookie("trac_auth_emulab", "", $timeout, "/",
......
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