netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Cc: netdev@vger.kernel.org, Patrick McHardy <kaber@trash.net>
Subject: Re: How to find I/F to destination
Date: Fri, 04 May 2007 14:33:45 +0100	[thread overview]
Message-ID: <11217.1178285625@redhat.com> (raw)
In-Reply-To: <20070504132934.GD2291@2ka.mipt.ru>

Evgeniy Polyakov <johnpol@2ka.mipt.ru> wrote:

> That is the same, dst is dereferenced as rtable.
> Cloned dst is returned, so it must be put back at the ned of the usage.

If that's the case, then why do you bother to clone it in route_get_raw()?
Surely that'll give you *two* clones...

BTW, it seems to work.  The attached function gives me:

	[0mount ] <== rxrpc_assess_MTU_size() [if_mtu 1500]

Thanks!

David

---
static void rxrpc_assess_MTU_size(struct rxrpc_peer *peer)
{
	struct rtable *rt;
	struct flowi fl;
	int ret;

	peer->if_mtu = 1500;

	memset(&fl, 0, sizeof(fl));

	switch (peer->srx.transport.family) {
	case AF_INET:
		fl.oif = 0;
		fl.proto = IPPROTO_UDP,
		fl.nl_u.ip4_u.saddr = 0;
		fl.nl_u.ip4_u.daddr = peer->srx.transport.sin.sin_addr.s_addr;
		fl.nl_u.ip4_u.tos = 0;
		/* assume AFS.CM talking to AFS.FS */
		fl.uli_u.ports.sport = htonl(7001);
		fl.uli_u.ports.dport = htonl(7000);
		break;
	default:
		BUG();
	}

	ret = ip_route_output_key(&rt, &fl);
	if (ret < 0) {
		kleave(" [route err %d]", ret);
		return;
	}

	peer->if_mtu = dst_mtu(&rt->u.dst);
	kleave(" [if_mtu %u]", peer->if_mtu);
}

  reply	other threads:[~2007-05-04 13:33 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-04 12:48 How to find I/F to destination David Howells
2007-05-04 12:54 ` Evgeniy Polyakov
2007-05-04 13:04   ` David Howells
2007-05-04 13:06     ` David Howells
2007-05-04 13:08   ` David Howells
2007-05-04 13:16     ` Evgeniy Polyakov
2007-05-04 13:24       ` David Howells
2007-05-04 13:29         ` Evgeniy Polyakov
2007-05-04 13:33           ` David Howells [this message]
2007-05-04 13:43             ` Patrick McHardy
2007-05-04 13:55               ` David Howells
2007-05-04 13:59                 ` Patrick McHardy
2007-05-05  9:13                   ` Evgeniy Polyakov
2007-05-05  9:15             ` Evgeniy Polyakov
2007-05-04 13:20     ` Evgeniy Polyakov
2007-05-04 13:23   ` David Howells
2007-05-04 13:25     ` Evgeniy Polyakov
2007-05-04 13:00 ` Patrick McHardy

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=11217.1178285625@redhat.com \
    --to=dhowells@redhat.com \
    --cc=johnpol@2ka.mipt.ru \
    --cc=kaber@trash.net \
    --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).