netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH 07/15] ipv4: Adjust semantics of rt->rt_gateway.
Date: Wed, 18 Jul 2012 11:57:14 -0700	[thread overview]
Message-ID: <1342637834.2013.4.camel@joe2Laptop> (raw)
In-Reply-To: <20120718.112346.920698833832945112.davem@davemloft.net>

On Wed, 2012-07-18 at 11:23 -0700, David Miller wrote:
> In order to allow prefixed routes, we have to adjust how rt_gateway
> is set an interpreted.

typo an/and and a trivial style note:

> diff --git a/net/ipv4/route.c b/net/ipv4/route.c
[]
> @@ -1079,8 +1079,10 @@ void ip_rt_get_source(u8 *addr, struct sk_buff *skb, struct rtable *rt)
>  		if (fib_lookup(dev_net(rt->dst.dev), &fl4, &res) == 0)
>  			src = FIB_RES_PREFSRC(dev_net(rt->dst.dev), res);
>  		else
> -			src = inet_select_addr(rt->dst.dev, rt->rt_gateway,
> -					RT_SCOPE_UNIVERSE);
> +			src = inet_select_addr(rt->dst.dev, (rt->rt_gateway ?
> +							     rt->rt_gateway :
> +							     iph->daddr),
> +					       RT_SCOPE_UNIVERSE);

maybe use the moderately common gcc ?: extension

			src = inet_select_addr(rt->dst.dev,
					       rt->rt_gateway ?: iph->daddr,
					       RT_SCOPE_UNIVERSE);

  reply	other threads:[~2012-07-18 18:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-18 18:23 [PATCH 07/15] ipv4: Adjust semantics of rt->rt_gateway David Miller
2012-07-18 18:57 ` Joe Perches [this message]
2012-07-18 19:00   ` David Miller

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=1342637834.2013.4.camel@joe2Laptop \
    --to=joe@perches.com \
    --cc=davem@davemloft.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).