netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Herz <andi@geekosphere.org>
To: netfilter-devel@vger.kernel.org
Subject: function for getting the source ip defined in the routing table
Date: Tue, 20 May 2014 14:46:34 +0200	[thread overview]
Message-ID: <20140520124634.GM10939@kvmbude> (raw)

Hi,

i was looking for a function to get the source ip that is defined in the
routing table. I looked into the MASQUERADE module but the
"inet_select_addr" function returns the source ip from the interface
(the first one, in most use cases).

See the following routing table entry:

10.0.13.0/24 dev eth1  proto kernel  scope link  src 10.0.13.4

while the interface has multiple IPs:

    inet 10.0.12.1/24 scope global eth0
    inet 10.0.13.2/24 scope global eth0
    inet 10.0.13.4/24 scope global secondary eth0

So what i want is the value of the src part in the routing table (for connections to the related network).

thanks.

-- 
Andreas Herz

             reply	other threads:[~2014-05-20 12:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-20 12:46 Andreas Herz [this message]
2014-05-20 14:03 ` function for getting the source ip defined in the routing table Jan Engelhardt
2014-05-20 14:18   ` Andreas Herz
2014-05-20 15:38     ` Maciej Żenczykowski
2014-05-21  8:36       ` Andreas Herz
2014-05-21 17:06         ` Maciej Żenczykowski
2014-05-21 17:07           ` Maciej Żenczykowski
2014-05-22  9:11           ` Andreas Herz
     [not found]             ` <CAJ26g5T1Ugfy-tfeFUBWABLrwuNkG26V7u=SvF6cr9pFwkGobA@mail.gmail.com>
2014-05-22 10:31               ` Andreas Herz
2014-06-03  7:55   ` Andreas Herz

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=20140520124634.GM10939@kvmbude \
    --to=andi@geekosphere.org \
    --cc=netfilter-devel@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).