Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit 2cd8c5fc authored by Martin Heusse's avatar Martin Heusse
Browse files

Initial import into LigForge

parents
version 0.90.3.2
28 march 2007 - GBS
Various cosmetic and portability changes. Minor bugfixes.
version 0.90.3
09 june 2006 - GBS
functions common to udptarget.c and tcptarget.c are put in
target.c
udpmt insert a timestamp in packets
option -j to udptarget allows to display jitter
version 0.90.2
02 june 2006 - Yan Grunenberger
option -i in udptarget and tcptarget to specify display interval.
31 may 2006 - GBS
option -p in udptarget to specify a port number
option -d in tcpmt and udpmt to spécify the test duration.
30 may 2006 - GBS
option -o in udptarget and tcptarget allows to send the result
to a file
version 0.90.1
29 may 2006 - GBS
option "-v" displays version number for every executable.
ipmt : IP measurement tools
$Id: LISEZ_MOI 119 2009-12-07 12:32:54Z heusse $
Outils de mesure des performances réseau au niveau transport
------------------------------------------------------------
Performance network measurements tools at the transport level
Ipmt est un ensemble d'outils de mesure des performances de réseaux
aux niveau transport sous TCP/IP et UDP/IP.
Tcpmt et udpmt sont les programmes clients, respectivement en TCP et UDP.
Ils fournissent toutes les secondes un rapport du débit obtenu, ce qui
permet une mesure en continu du débit, à l'inverse d'outils comme netperf,
iperf ou ttcp. Ils permettent donc non seulement une évaluation du débit
moyen, mais aussi une surveillance en continu de l'évolution du débit face
à des changements de conditions du réseau, comme l'intervention de
transmissions concurrentes, ou des changements des conditions de transmission
(par exemple pour les réseaux sans-fil).
Par défaut, ils transmettent en continu vers le port discard de la machine
destinataire. Ceci signifie que, sous UDP, le débit mesuré au niveau
de l'émetteur peut ne pas correspondre au débit effectivement transmis,
puisque UDP n'offre aucune garantie.
Udpmt et tcpmt n'ouvrent aucune connexion TCP de contrôle, contrairement à -
par exemple - netperf. On ne rencontre donc pas le problème de connexions
TCP qui ont du mal à s'établir du fait d'une transmission UDP ayant démarré
vant.
Tcptarget et udptarget sont deux programmes qui permettent la mesure du débit
au niveau de la destination (seule mesure fiable dans le cas de UDP).
Utilisation simplifiée :
------------------------
tcpmt [-p port] [-s pktsz] [-n pktnb] [-d secs] host
udpmt [-p port] [-s pktsz] [-n pktnb] [-d secs] host
Où :
- port est le numéro du port destinataire (discard, par défaut).
- pktsz est la taille des paquets émis (1472 octets par défaut)
Ce paramètre n'est vraiment significatif que sous UDP.
- pktnb est le nombre de paquets à émettre (par défaut, le programme
émet jusqu'à ce qu'on l'arrête par Control-C).
- secs est la durée du test en secondes. Si secs et pktnb sont spécifiés, le
test s'arrête dès que l'une des deux conditions est vérifiée (nombre de
paquet atteint, ou durée atteinte).
- host est la machine destinataire.
Le programme émet toutes les secondes un rapport comportant :
- l'instant d'émission (en ms depuis 0h),
- le nombre de paquets émis durant l'intervalle,
- le nombre totale de paquets émis,
- le débit mesuré durant l'intervalle, en kbit/s,
- le débit moyen sur les 10 dernieres secondes,
- le débit moyen depuis le début.
Tcptarget et udptarget sont deux programmes qui permettent la mesure du
débit au niveau de la destination.
tcptarget [-i ms] [-o filename] [-p port]
udptarget [-i ms] [-o filename] [-p port]
Où :
* ms est l'intervalle d'affichage du débit en millisecondes. Par défaut, le
débit est affiché toutes les secondes.
* filename est le nom du fichier dans lequel la trace du débit est enregistrée.
Si aucun nom de fichier n'est spécifié, le débit s'affiche sur la sortie
standard. Si un nom de fichier est spécifié, la trace est enregistrée dans
ce fichier, et le débit est également affiché sur la sortie standard.
* port est le numéro du port sur lequel le programme se met en écoute. Si
aucun port n'est spécifié, un numéro de port est choisi et affiché.
Dès que tcptarget/udptarget commencent à recevoir des paquets, ils
affichent un compte rendu toutes les secondes. Ce compte rendu est plus
simple que celui du programme émetteur (et donc plus facile à exploiter,
bien que moins complet), et comporte l'heure de réception en secondes
(avec 3 décimales, donc une précision à la milliseconde), et le débit en
kbit/s.
L'utilisation de tcp/udptarget présente un gros avantage lorsqu'on veut
mesurer le comportement de flots concurrents envoyés vers une même
machine cible: les instants d'arrivée étant mesurés sur la même machine,
les résultats peuvent être mis en correspondance sans avoir à s'assurer
de la bonne synchronisation des machines émettrices.
Utilisation avancée udpmt :
---------------------------
Udpmt possède un certain nombre d'options supplémentaires qui permettent de
l'utiliser comme un générateur de trafic simple :
* -i microsecs : miscrosecs est l'intervalle, en microsecondes, entre les
transmissions (ou rafales). Par défaut, l'intervalle est nul, ce qui signifie que la
transmission est continue.
* -r rate : rate est un débit, en Kilobit par seconde.
* -B burst : spécifie une taille de rafale en nombre de paquets, c'est à dire
que burst paquets seront transmis de suite sans temps d'attente. Cette
option n'a évidemment d'intérêt que si l'option -i ou -r est spécifiée.
par défaut, burst est à 1. Peut être utilisé pour des mesures sans saturation
avec l'option -e de udptarget.
* -b burst : comme ci-dessus, mais la taille des rafales est exprimée en
octets. Dans le cas ou la taille de rafale ne correspond pas à un nombre
entier de paquets, la transmission se fait jusqu'à ce que le nombre d'octets
transmis soit supérieur ou égal à la taille des rafales. L'excédent
éventuel est déduit de la rafale suivante.
- -t interval : spécifie la valeur en microsecondes de l'intervalle entre les
interruptions périodiques utilisées pour le scheduling des transmissions. La
valeur par défaut est 500 microsecondes, ce qui est inférieur à la
granularité du timer sur la plupart des systèmes (généralement en une et
dix millisecondes). La valeur effective sera donc le maximum de
l'intervalle spécifié et de l'intervalle du timer systeme (1 seconde/HZ).
- -T TOS : spécifie la valeur de Type de Service (champs ToS des en-têtes IP).
Cette valeur est utilisée par les équipements réseau implémentant la qualité
de service.
Compilation :
-------------
En dehors de Linux, le programme a été compilé sous
FreeBSD, MacOS X Tiger (10.4) et sous Windows/Cygwin, mais la portabilité
n'est pas systématiquement vérifiée lors des modifications du pogramme.
La compilation et l'installation d'ipmt s'effectuent de la manière classique,
en se plaçant dans le répertoire d'ipmt :
./configure
make
make install
Seule la dernière commande nécessite d'être root.
This diff is collapsed.
This diff is collapsed.
# $Id: Makefile.in 87 2009-01-21 13:36:58Z gberger $
CC= @CC@
prefix=@prefix@
BINDIR= @prefix@/bin
OBJS=tcpmt udpmt tcptarget udptarget
MANPAGES=tcpmt.1 udpmt.1 tcptarget.1 udptarget.1
MANDIR= @datarootdir@/man/man1
#MANDIR= @prefix@/share/man/man1
CFLAGS= @DEFS@
LDFLAGS=@LIBS@
all: $(OBJS)
tcpmt: tcpmt.o common.o commodity.o @LIBOBJS@
$(CC) $(LDFLAGS) tcpmt.o common.o commodity.o @LIBOBJS@ -o tcpmt
udpmt: udpmt.o common.o commodity.o @LIBOBJS@
$(CC) $(LDFLAGS) udpmt.o common.o commodity.o @LIBOBJS@ -o udpmt
tcptarget: tcptarget.o target.o commodity.o
$(CC) $(LDFLAGS) tcptarget.o target.o commodity.o @LIBOBJS@ -o tcptarget
udptarget: udptarget.o target.o
$(CC) $(LDFLAGS) udptarget.o target.o @LIBOBJS@ -o udptarget
tcpmt.o: tcpmt.c ipmt.h version.h
udpmt.o: udpmt.c ipmt.h version.h
common.o: common.c ipmt.h
target.o: target.c target.h
tcptarget.o: tcptarget.c target.h version.h
udptarget.o: udptarget.c target.h version.h
getaddrinfo.o: getaddrinfo.c getaddrinfo.h
commodity.o: commodity.c commodity.h
clean:
rm *.o $(OBJS)
install: install_objs install_man
install_objs: $(OBJS)
cp $(OBJS) $(BINDIR)
install_man : $(MANPAGES)
cp $(MANPAGES) $(MANDIR)
IPMT: IP measurement tools
$Id: README 119 2009-12-07 12:32:54Z heusse $
Network performance measurement tools at the transport level
-------------------------------------------------- ----------
IPMT is a set of tools to measure performance of networks
at the transport level (TCP/IP and UDP/IP).
Udpmt are Tcpmt and client programs, respectively under TCP and UDP.
They provide every second a report of the obtained throughput, which
allows a continuous measurement, unlike tools like Netperf,
iperf or ttcp. They allow therefore not only an evaluation of the average throughput,
but also continuous monitoring of changes in the throughput in presence of
changing network conditions, such as intervention of
competing transmissions, or changes in the transmission conditions
(eg WLAN).
By default, they continuously transmit to the discard port of the recipient
machine. This means that under UDP, the flow measured at
the sender may not match the speed actually transmitted,
since UDP offers no delivery guarantee.
Udpmt and tcpmt open no TCP control connection, contrary to -
for example - Netperf. It therefore does not meet the problem of TCP connections
who are struggling to settle because of a UDP transmission that started
before.
Tcptarget and udptarget are two programs that allow flow measurement
at the destination (the only reliable measure in the case of UDP).
Simplified use :
----------------
tcpmt [-p port] [-s pktsz] [-n pktnb] [-d secs] host
udpmt [-p port] [-s pktsz] [-n pktnb] [-d secs] host
Where:
- Port is the recipient port number (discard, by default).
- Pktsz is the size of packets issued (1472 bytes by default)
This is really significant only under UDP.
- Pktnb is the number of packets to issue (by default, the program
transmit until stopped by Control-C).
- Secs is the test time in seconds. If secs and pktnb are specified, the
test stops when one of the two conditions is checked (number of
packets reached, or duration reached).
- Host is the recipient.
The program makes every second a report displaying :
- The time of issue (in ms since 0h)
- The number of packets delivered during the interval,
- The total number of packets delivered,
- Throughput measured during the interval, in kbit / s
- The average over the last 10 seconds
- The average since the beginning.
Tcptarget and udptarget are two programs that allow measurement
flow at the destination.
tcptarget [-i ms] [-o filename] [-p port]
udptarget [-i ms] [-o filename] [-p port]
Where:
* Ms is the interval display of flow in milliseconds. By default,
the throughput is displayed every second.
* Filename is the name of the file where the trace of throughput is recorded.
If no file name is specified, the throughput is displayed on the standard output.
If a file name is specified, the track is recorded in
this file, and the throughput is also displayed on standard output.
* Port is the port number on which the program starts listening. If
none is specified, a port number is selected and displayed.
Once tcptarget / udptarget begin to receive packets, they
display the bitrate every second. This display is
simpler as the display of the sender program (and therefore easier to exploit,
though less comprehensive), and includes time of receipt in seconds
(with 3 decimals, so a millisecond precision), and the bitrate in
kbit / s.
Using TCP / udptarget has a big advantage when you want to
measure the behavior of concurrent flows sent to the same
target machine: the moment of arrival is measured on the same machine,
the results can be matched without having to ensure
the proper synchronization of transmitting machines.
Advanced use of udpmt:
---------------
Udpmt has a number of additional options that allow
use it as a simple traffic generator :
* -i microsecs: miscrosecs is the interval, in microseconds, between
transmissions (ie, bursts). By default, the interval is zero, meaning that
transmission is continuous.
* -r rate: specification of th bitrate in Kilobit per second.
* -B burst specify a burst size burst in number of packets, ie
that burst packets will be sent immediately without waiting. This
option is obviously of interest only if -i or -r is specified.
Default burst size is 1 packet. This can be used for non-saturating
measurements with -e option of udptarget.
* -b burst: As above, but the size of bursts is expressed in
bytes. Where the burst size is not a whole number
package, transmission is done until the number of bytes
transmitted is either higher or equal to the burst size. The possible surplus
is deducted from the following burst.
- -t interval: Specifies the value in microseconds of the interval between
periodic interruptions used for scheduling transmissions. The
default is 500 microseconds, which is below the
granularity timer on most systems (usually between one and
ten milliseconds). The actual value will be the maximum
of the specified interval and the interval of the system timer (1 second / HZ).
- -T TOS: Specifies the value of Type of Service (ToS fields in the IP header).
This value is used by networking equipment implementing quality of
service.
Compilation:
-------------
In addition to Linux, the program has been successfully compiled
under FreeBSD, MacOS X Tiger (10.4) and Windows / Cygwin, but portability
is not routinely checked when changes are done. So, your millage may vary...
The compilation and installation of IPMT is done the traditional way :
Unpack the tarball (tar vxfz ipmt-xxx.tgz),
cd ipmt-xxx.tgz
. / configure
make
make install
Only the last command needs to be run as root.
# generated automatically by aclocal 1.8.5 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
# Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
m4_include([m4/herrno.m4])
m4_include([m4/in6addr.m4])
m4_include([m4/sockinttypes.m4])
/***********************************************************
*
* $Id: commodity.c 117 2009-12-07 11:30:21Z gberger $
*
* Created by Martin Heusse on 19/11/07.
*
* This file is part of the ipmt package
*
* Copyright LIG Laboratory (2007)
*
* This software is a computer program whose purpose is to provide a set
* of tools to measure performance of networks at the transport level
* (TCP/IP and UDP/IP)..
*
* This software is governed by the CeCILL license under French law and
* abiding by the rules of distribution of free software. You can use,
* modify and/ or redistribute the software under the terms of the CeCILL
* license as circulated by CEA, CNRS and INRIA at the following URL
* "http://www.cecill.info".
*
* As a counterpart to the access to the source code and rights to copy,
* modify and redistribute granted by the license, users are provided only
* with a limited warranty and the software's author, the holder of the
* economic rights, and the successive licensors have only limited
* liability.
*
* In this respect, the user's attention is drawn to the risks associated
* with loading, using, modifying and/or developing or reproducing the
* software by the user in light of its specific status of free software,
* that may mean that it is complicated to manipulate, and that also
* therefore means that it is reserved for developers and experienced
* professionals having in-depth computer knowledge. Users are therefore
* encouraged to load and test the software's suitability as regards their
* requirements in conditions enabling the security of their systems and/or
* data to be ensured and, more generally, to use and operate it in the
* same conditions as regards security.
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL license and that you accept its terms.
************************************************************************/
#include <sys/time.h>
#include "config.h"
#include <sys/socket.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <netinet/in.h>
#include <unistd.h>
#ifndef HAVE_GETADDRINFO
#include "getaddrinfo.h"
#endif
#include "commodity.h"
struct sockaddr *sockin_addr;
/*
* Compute elapsed time in seconds from two dates
*/
double
t_elapse(t1, t2)
struct timeval t1;
struct timeval t2;
{
t2.tv_sec -= t1.tv_sec;
t2.tv_usec -= t1.tv_usec;
if (t2.tv_usec < 0) {
t2.tv_sec--;
t2.tv_usec += 1000000;
}
return ((double) t2.tv_sec + (double) t2.tv_usec / 1000000.);
}
int
impt_connect(char * hostname, char * portname, int bufsz)
{
int i, s;
struct addrinfo hints,
*rai = NULL;
#ifdef IPv6
if (force_ipv4) {
hints.ai_family = AF_INET;
} else if (force_ipv6) {
hints.ai_family = AF_INET6;
}
else {
hints.ai_family = AF_UNSPEC;
}
#else
hints.ai_family = AF_INET;
#endif
hints.ai_flags = 0;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = IPPROTO_TCP;
hints.ai_addrlen = 0;
hints.ai_addr = NULL;
hints.ai_canonname = NULL;
hints.ai_next = NULL;
if ( (i = getaddrinfo(hostname, portname, &hints, &rai)) ) {
fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(i));
if (i == EAI_SYSTEM) {
perror("getaddrinfo");
}
exit(1);
}
#ifdef IPv6
// look for IPv6
while (rai->ai_family != AF_INET6 && rai->ai_next != NULL) {
rai = rai->ai_next;
}
if (rai->ai_family == AF_INET6) {
fprintf(stderr,"IPv6 protocol\n");
}
else if (rai->ai_family == AF_INET) {
fprintf(stderr,"IPv4 protocol\n");
}
else {
fprintf(stderr,"Unknown protocol family");
}
#else
fprintf(stderr,"IPv4 protocol\n");
#endif
if ((s = socket(rai->ai_family, rai->ai_socktype, rai->ai_protocol)) < 0)
{
perror("Socket");
exit(1);
}
if (bufsz != 0) {
if (setsockopt(s, SOL_SOCKET, SO_SNDBUF,
(char *) &bufsz, sizeof(bufsz)) < 0) {
perror("setsockopt");
exit(2);
}
}
/*
* Connect to the remote socket
*/
if (connect(s, rai->ai_addr, rai->ai_addrlen) < 0) {
perror("connect");
close(s);
exit(2);
}
return s;
}
int
ipmt_listen(char * portname, int bufsz)
{
int sa,
i,
portnb;
char lportname[NI_MAXSERV];
unsigned int namelen;
struct addrinfo hints,*res=NULL;
#ifdef IPv6
if (force_ipv4) {
hints.ai_family = AF_INET;
} else if (force_ipv6) {
hints.ai_family = AF_INET6;
}
else {
hints.ai_family = AF_UNSPEC;
}
#else
hints.ai_family = AF_INET;
#endif
hints.ai_flags = AI_PASSIVE;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = IPPROTO_TCP;
hints.ai_addrlen = 0;
hints.ai_addr = NULL;
hints.ai_canonname = NULL;
hints.ai_next = NULL;
if (getaddrinfo(NULL, portname, &hints, &res) != 0 ) {
perror("Getaddrinfo");
exit(1);
}
#ifdef IPv6
// look for IPv6
while (res->ai_family != AF_INET6 && res->ai_next != NULL) {
res = res->ai_next;
}
if (res->ai_family == AF_INET6) {
fprintf(stderr,"IPv6%s protocol\n", force_ipv6? "" : " (and IPv4)");
}
else if (res->ai_family == AF_INET) {
fprintf(stderr,"IPv4 protocol\n");
}
else {
fprintf(stderr,"Unknown protocol family\n");
}
#else
fprintf(stderr,"IPv4 protocol\n");
#endif
sockin_addr = res->ai_addr;
rlen = res->ai_addrlen;
if ((sa = socket(res->ai_family, res->ai_socktype, res->ai_protocol)) < 0) {
perror("Socket");
exit(1);
}
#ifdef IPv6
#ifdef IPV6_BINDV6ONLY
if (res->ai_family == AF_INET6 && !force_ipv6) {
int only = 0;
if (setsockopt(sa, IPPROTO_IPV6, IPV6_BINDV6ONLY,
&only, sizeof only) < 0) {
perror("setsockopt not IPv6 only");
exit(1);
}
}
#endif
#endif
if (bind(sa, sockin_addr, rlen)< 0) {
perror("Bind");
exit(1);
}
if ((getsockname(sa, sockin_addr, &rlen)) < 0) {
perror("Getsockname");
exit(1);
}
if ((i = getnameinfo(sockin_addr, rlen, NULL, 0,
lportname, sizeof(lportname), NI_NUMERICSERV)) < 0) {
fprintf(stderr,"getnameinfo: %s\n", gai_strerror(i));
exit(2);
}
fprintf(stderr, "Using port %s\n", lportname);
if (bufsz != 0) {
setsockopt(sa, SOL_SOCKET, SO_RCVBUF,
(char *) &bufsz, sizeof(bufsz));
}
if (listen(sa, 0) < 0) {
perror("Listen");
exit(1);
}
return sa;
}
/************************************************************
*
* $Id: commodity.h 117 2009-12-07 11:30:21Z gberger $
*
* Created by Martin Heusse on 19/11/07.
*
* This file is part of the ipmt package
*
* Copyright LIG Laboratory (2007)
*
* This software is a computer program whose purpose is to provide a set
* of tools to measure performance of networks at the transport level
* (TCP/IP and UDP/IP)..
*
* This software is governed by the CeCILL license under French law and
* abiding by the rules of distribution of free software. You can use,
* modify and/ or redistribute the software under the terms of the CeCILL
* license as circulated by CEA, CNRS and INRIA at the following URL
* "http://www.cecill.info".
*
* As a counterpart to the access to the source code and rights to copy,
* modify and redistribute granted by the license, users are provided only
* with a limited warranty and the software's author, the holder of the
* economic rights, and the successive licensors have only limited
* liability.
*
* In this respect, the user's attention is drawn to the risks associated
* with loading, using, modifying and/or developing or reproducing the
* software by the user in light of its specific status of free software,
* that may mean that it is complicated to manipulate, and that also
* therefore means that it is reserved for developers and experienced
* professionals having in-depth computer knowledge. Users are therefore