Project

General

Profile

Feature #310 » RFC-batctl-tp_meter-Translate-client-mac-and-IPs-to-orig.patch

Sven Eckelmann, 02/28/2018 10:16 AM

View differences:

man/batctl.8
given batctl will not replace the MAC addresses with bat\-host names in the output.
.RE
.br
.IP "\fBthroughputmeter\fP|\fBtp\fP \fBMAC\fP"
.IP "\fBthroughputmeter\fP|\fBtp\fP[\fB\-T\fP] \fBMAC_address\fP|\fBbat\-host_name\fP|\fBhost_name\fP|\fBIP_address\fP"
This command starts a throughput test entirely controlled by batman module in
kernel space: the computational resources needed to align memory and copy data
between user and kernel space that are required by other user space tools may
......
togheter with the experiment duration in millisecond and the amount of bytes
transferred. If too many packets are lost or the specified MAC address is not
reachable, a message notifing the error is returned instead of the result.
With "\-T" you can disable the automatic translation of a client MAC address to
the originator address which is responsible for this client.
.RE
.br
.SH FILES
tp_meter.c
static void tp_meter_usage(void)
{
fprintf(stderr, "Usage: batctl tp [parameters] <MAC>\n");
fprintf(stderr, "Usage: batctl tp [parameters] mac|bat-host|host_name|IPv4_address\n");
fprintf(stderr, "Parameters:\n");
fprintf(stderr, "\t -t <time> test length in milliseconds\n");
fprintf(stderr, "\t -n don't convert addresses to bat-host names\n");
fprintf(stderr, " \t -T don't try to translate mac to originator address\n");
}
int tp_meter(char *mesh_iface, int argc, char **argv)
......
char *dst_string;
int ret = EXIT_FAILURE;
int found_args = 1, read_opt = USE_BAT_HOSTS;
int disable_translate_mac = 0;
uint32_t time = 0;
int optchar;
struct nl_sock *listen_sock = NULL;
......
.found = false,
};
while ((optchar = getopt(argc, argv, "t:n")) != -1) {
while ((optchar = getopt(argc, argv, "t:nT")) != -1) {
switch (optchar) {
case 't':
found_args += 2;
......
read_opt &= ~USE_BAT_HOSTS;
found_args += 1;
break;
case 'T':
disable_translate_mac = 1;
found_args += 1;
break;
default:
tp_meter_usage();
return EXIT_FAILURE;
......
dst_mac = &bat_host->mac_addr;
if (!dst_mac) {
dst_mac = ether_aton(dst_string);
dst_mac = resolve_mac(dst_string);
if (!dst_mac) {
printf("Error - the tp meter destination is not a mac address or bat-host name: %s\n",
printf("Error - mac address of the tp meter destination could not be resolved and is not a bat-host name %s\n",
dst_string);
goto out;
}
}
if (!disable_translate_mac)
dst_mac = translate_mac(mesh_iface, dst_mac);
if (bat_host && (read_opt & USE_BAT_HOSTS))
dst_string = bat_host->name;
else
(2-2/2)