traceroute: Gateway selection.

This commit is contained in:
Mats Erik Andersson
2013-07-04 14:58:44 +02:00
parent 625b1fa225
commit f8d2f1e566
3 changed files with 27 additions and 1 deletions

View File

@@ -1,3 +1,13 @@
2013-07-04 Mats Erik Andersson <gnu@gisladisker.se>
traceroute: Gateway selection.
Make `-g' additive in repeated use to better
conform with other implementations.
* src/traceroute.c (parse_opt) [IP_OPTIONS] <'g'>:
Append `arg' to `opt_gateways' if the latter has
already been assigned a value.
2013-06-28 Mats Erik Andersson <gnu@gisladisker.se>
traceroute: Portability of PID range.

View File

@@ -1060,6 +1060,7 @@ using spaces, commata, or semicola as separators.
These hosts must be traversed in the given order
before the intended host receives any datagram.
At most eight host names or addresses may be specified.
Multiple uses of @option{-g} produce a concatenated list.
@item -I
@itemx --icmp

View File

@@ -179,7 +179,22 @@ parse_opt (int key, char *arg, struct argp_state *state)
#ifdef IP_OPTIONS
case 'g':
opt_gateways = xstrdup (arg);
if (opt_gateways)
{
size_t len = 0;
len = strlen (opt_gateways);
opt_gateways = xrealloc (opt_gateways, len + strlen (arg) + 3);
/* Append new gateways to old list,
* separating the two parts by a comma.
*/
opt_gateways[len] = ',';
opt_gateways[len + 1] = '\0';
strcat (opt_gateways, arg);
}
else
opt_gateways = xstrdup (arg);
break;
#endif /* IP_OPTIONS */