All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephan von Krawczynski <skraw@ithnet.com>
To: linux-kernel@vger.kernel.org
Subject: How to find the correct source address to a destination in a kernel driver?
Date: Fri, 17 Oct 2014 10:08:01 +0200	[thread overview]
Message-ID: <20141017100801.f1c310de.skraw@ithnet.com> (raw)

Hello all,

in former kernels with routing cache things were easy. We just used :

        rt = ip_route_output_key(XXX)
        src = rt->rt_src;

Now if there is no routing cache, we tried this:

        rt = ip_route_output_key(XXX)
        src = inet_select_addr(rt->dst.dev, dst, RT_SCOPE_UNIVERSE);

Unfortunately this does not work with interfaces having multiple ip addresses
and the routing in question is not over the first configured ip.
How do I get the correct src for all possible cases?

-- 
Regards,
Stephan

                 reply	other threads:[~2014-10-17  8:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20141017100801.f1c310de.skraw@ithnet.com \
    --to=skraw@ithnet.com \
    --cc=linux-kernel@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.