From: Peter Rabbitson <rabbit@rabbit.us>
To: lartc@vger.kernel.org
Subject: Re: [LARTC] Re: multiple routing tables for internal router programs
Date: Tue, 12 Jun 2007 10:02:18 +0000 [thread overview]
Message-ID: <466E6F2A.7090202@rabbit.us> (raw)
In-Reply-To: <Pine.LNX.4.64.0706111505070.3751@tigger.tntechs.com>
Salim S I wrote:
> Here is my issue with ping.
>
> When I use -I with ping, the DNS queries for that domain is still sent
> out with wrong source address through the interface, and hence, no
> reply. This happens in both WAN interfaces.
> When I add rules in OUTPUT chain to reroute packets with the unmatching
> source address and output interface, things work fine.
>
> When I use IP address instead of URL, everything is fine.
>
The problem is ping itself, which uses gethostbyname() which in turn
does not understand how to bind to specific interfaces etc. Besides
specifying IP addresses instead of hostnames is much much better IMHO.
Here is the ping.c snippet:
while (argc > 0) {
target = *argv;
bzero((char *)&whereto, sizeof(whereto));
whereto.sin_family = AF_INET;
if (inet_aton(target, &whereto.sin_addr) = 1) {
hostname = target;
if (argc = 1)
options |= F_NUMERIC;
} else {
hp = gethostbyname2(target, AF_INET);
if (!hp) {
fprintf(stderr, "ping: unknown host
%s\n", target);
exit(2);
}
memcpy(&whereto.sin_addr, hp->h_addr, 4);
strncpy(hnamebuf, hp->h_name, sizeof(hnamebuf)
- 1);
hnamebuf[sizeof(hnamebuf) - 1] = 0;
hostname = hnamebuf;
}
if (argc > 1)
route[nroute++] = whereto.sin_addr.s_addr;
argc--;
argv++;
}
_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
next prev parent reply other threads:[~2007-06-12 10:02 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-11 19:06 [LARTC] Re: multiple routing tables for internal router programs Tom Diehl
2007-06-11 19:23 ` Javier Charne
2007-06-12 7:59 ` Andrea
2007-06-12 8:09 ` Salim S I
2007-06-12 9:01 ` Peter Rabbitson
2007-06-12 9:15 ` Andrea
2007-06-12 9:29 ` Peter Rabbitson
2007-06-12 9:49 ` Salim S I
2007-06-12 10:02 ` Peter Rabbitson [this message]
2007-06-12 10:10 ` Andrea
2007-06-12 10:20 ` Salim S I
2007-06-12 11:23 ` Peter Rabbitson
2007-06-13 4:08 ` Salim S I
2007-06-14 3:50 ` Salim S I
2007-06-14 4:23 ` Alex Samad
2007-06-14 7:26 ` Peter Rabbitson
2007-06-14 10:34 ` Salim S I
2007-06-15 3:26 ` Salim S I
2007-06-15 6:00 ` Peter Rabbitson
2007-06-15 6:01 ` Peter Rabbitson
2007-06-15 6:21 ` Salim S I
2007-06-15 6:29 ` Peter Rabbitson
2007-06-15 9:36 ` Salim S I
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=466E6F2A.7090202@rabbit.us \
--to=rabbit@rabbit.us \
--cc=lartc@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.