From: Mick McCreath <mick_mccreath@au.securecomputing.com>
To: netdev@vger.kernel.org
Subject: raw sockets ignore IP_HDRINCL data
Date: Fri, 01 Jun 2007 15:36:27 +1000 [thread overview]
Message-ID: <1180676187.5956.52.camel@localhost> (raw)
Hi,
I have a multi-homed system like this:
eth1: 1.2.3.4 GW: 1.2.3.1
eth2: 2.3.4.5 GW: 2.3.4.1
route ouput snippet is:
default 2.3.4.1 0.0.0.0 UG 3 0 0 eth2
default 1.2.3.1 0.0.0.0 UG 4 0 0 eth1
default 2.3.4.1 0.0.0.0 UG 4 0 0 eth2
When I run traceroute -i eth1 5.4.3.2, the UDP packets are routed out
eth2.
Has anybody seen this behaviour with traceroute??
I have done some debugging, and believe this to be an ipv4 kernel bug.
My research came up with the following:
By the traceroute source code, it uses raw sockets and relies on
IP_HDRINCL (which is defined in the kernel source <netinet/in.h>) to
select the routing interface and does not bind the socket to the source
IP address.
I hacked the traceroute source code to do a bind if the -i option is used,
and the correct GW is used.
I am using a 2.4.29 kernel and have traced through the kernel and
in .../net/ipv4/raw.c, raw_sendmsg() does not read the data to get the
IP header and the source address, which then results in a 0.0.0.0 source
address and hence the routing, ip_route_output(), pulls the default
gateway with the lowest metric, in this case eth2.
I have also used a 2.6.21 kernel and similiar behaviour happens. The
2.6.21 kernel source code does not read the IP header from the data
either.
Am I reading/interpreting the source code correctly?
Any other suggestions/more information would be great.
Cheers,
Mick
--
--
Mick McCreath
Sr Engineer
Secure Computing®
your trusted source for enterprise security™
www.securecomputing.com
NASDAQ: SCUR
61 7 3435 2803 (Direct Phone)
mick_mccreath@securecomputing.com
Secure Computing Corporation
825 Stanley Street
Woolloongabba
Queensland 4102
Australia
The information contained in this email message may be privileged,
confidential and protected from disclosure. If you are not the intended
recipient, any review, dissemination, distribution or copying is
strictly prohibited. If you have received this email message in error,
please notify the sender by reply email and delete the message and any
attachments.
next reply other threads:[~2007-06-01 6:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-01 5:36 Mick McCreath [this message]
2007-06-02 11:07 ` raw sockets ignore IP_HDRINCL data Herbert Xu
2007-06-03 22:52 ` Mick McCreath
2007-06-03 23:59 ` Herbert Xu
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=1180676187.5956.52.camel@localhost \
--to=mick_mccreath@au.securecomputing.com \
--cc=netdev@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).