- Included patch to be able to specify outgoing interface address.
source: ftp://ftp.bitwizard.nl/mtr/mtr-0.46.tar.gz
Robert Sparks (rjsparks@nostrum.com)
David Stone (stone@AsIf.com)
Greg Stark (gsstark@mit.edu)
- Andrew Brown (codewarrior@daemon.org ?)
+ Andrew Brown (atatat@atatdot.net)
Marc Bejarano (marc.bejarano@openwave.com)
and anyone who has slipped through the cracks of my mail file.
+2002-02-09 bodq <bohdan@vstu.edu.ua>
+ * Added --address option to bind to given IP addess
+
2001-04-15 root <alane@geeksrus.net>
* Added this file so that automake won't complain.
WHAT'S NEW?
+ v0.45 Included patch to be able to specify outgoing interface
+ address.
+
v0.45 People are pressuring me to release new versions with their
changes. That's fine. Now this version just adds dynamic
switching between numeric / dns names, and some minor
AC_INIT(mtr.c)
-AM_INIT_AUTOMAKE(mtr, 0.45)
+AM_INIT_AUTOMAKE(mtr, 0.46)
AC_SUBST(GTK_OBJ)
AC_SUBST(CURSES_OBJ)
restell("Resolver error: Specified rdata length exceeds packet size.");
return;
}
- if (datatype == qdatatype){
+ if (datatype == qdatatype || datatype == T_CNAME){
if (debug){
sprintf(tempstring,"Resolver: TTL: %s",strtdiff(sendstring,ttl));
restell(tempstring);
}
break;
case T_PTR:
+ case T_CNAME:
*namestring = '\0';
r = dn_expand(s,s + l,c,namestring,MAXDNAME);
if (r == -1){
failrp(rp);
return;
}
+ if (datatype == T_CNAME){
+ strcpy(stackstring,namestring);
+ break;
+ }
if (!rp->hostname){
rp->hostname = (char *)statmalloc(strlen(namestring) + 1);
if (!rp->hostname){
.B \-\-gtk\c
]
[\c
+.B \-\-address\ IP.ADD.RE.SS\c
+]
+[\c
.B \-\-interval\ SECONDS\c
]
[\c
archival of the measurement results. It could be parsed to
be presented into any of the other display methods.
+.TP
+.B \-a\ IP.ADD.RE.SS
+.TP
+.B \-\-address\ IP.ADD.RE.SS
+.br
+Use this option to bind outgoing packets' socket to specific interface,
+so that any packet will be sent through this interface. NOTE that this
+option doesn't apply to DNS requests (which could be and could not be
+what you want).
+
.TP
.B \-i\ SECONDS
.TP
int MaxPing = 16;
float WaitTime = 1.0;
char *Hostname = NULL;
+char *InterfaceAddress = NULL;
char LocalHostname[128];
int dns = 1;
int packetsize = MINPACKET;
{ "psize", 1, 0, 'p' },
{ "no-dns", 0, 0, 'n' },
{ "split", 0, 0, 's' }, /* BL */
+ { "address", 1, 0, 'a' },
{ "raw", 0, 0, 'l' },
{ 0, 0, 0, 0 }
};
opt = 0;
while(1) {
- opt = getopt_long(argc, argv, "hvrc:tgklnsi:p:", long_options, NULL);
+ opt = getopt_long(argc, argv, "a:hvrc:tgklnsi:p:", long_options, NULL);
if(opt == -1)
break;
case 't':
DisplayMode = DisplayCurses;
break;
+ case 'a':
+ InterfaceAddress = optarg;
+ break;
case 'g':
DisplayMode = DisplayGTK;
break;
if(PrintHelp) {
printf("usage: %s [-hvrctglsni] [--help] [--version] [--report]\n"
"\t\t[--report-cycles=COUNT] [--curses] [--gtk]\n"
- "\t\t[--raw] [--split] [--no-dns]\n" /* BL */
+ "\t\t[--raw] [--split] [--no-dns] [--address interface]\n" /* BL */
"\t\t[--psize=bytes/-p=bytes]\n" /* ok */
"\t\t[--interval=SECONDS] HOSTNAME [PACKETSIZE]\n", argv[0]);
exit(0);
}
+ if(InterfaceAddress) { /* Mostly borrowed from ping(1) code */
+ struct sockaddr_in source;
+ int i1, i2, i3, i4;
+ char dummy;
+ extern int sendsock; /* from net.c:115 */
+
+ source.sin_family = AF_INET;
+ source.sin_port = 0;
+
+ if(sscanf(InterfaceAddress, "%u.%u.%u.%u%c", &i1, &i2, &i3, &i4, &dummy) != 4) {
+ printf("mtr: bad interface address: %s\n", InterfaceAddress);
+ exit(1);
+ } else {
+ unsigned char*ptr;
+ ptr = (unsigned char*)&source.sin_addr;
+ ptr[0] = i1;
+ ptr[1] = i2;
+ ptr[2] = i3;
+ ptr[3] = i4;
+ }
+
+ if(bind(sendsock, (struct sockaddr*)&source, sizeof(source)) == -1) {
+ perror("mtr: failed to bind to interface");
+ exit(1);
+ }
+ }
+
host = gethostbyname(Hostname);
if(host == NULL) {
#ifndef NO_HERROR