[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1294130315.2711.48.camel@edumazet-laptop>
Date: Tue, 04 Jan 2011 09:38:35 +0100
From: Eric Dumazet <eric.dumazet@...il.com>
To: Changli Gao <xiaosuo@...il.com>
Cc: Joe Perches <joe@...ches.com>, Joel Sing <jsing@...gle.com>,
netdev@...r.kernel.org
Subject: Re: [PATCH] ipv4/route.c: respect prefsrc for local routes
Le mardi 04 janvier 2011 à 16:07 +0800, Changli Gao a écrit :
> On Tue, Jan 4, 2011 at 3:33 PM, Eric Dumazet <eric.dumazet@...il.com> wrote:
> > Le mardi 04 janvier 2011 à 08:24 +0100, Eric Dumazet a écrit :
> >
> >> Please use FIB_RES_PREFSRC(res)
> >>
> >
> > Hmm no, this is not applicable, but this could be shorter :
> >
> > fl.fl4_src = res.fi->fib_prefsrc ? : fl.fl4_dst;
> >
> >
>
> I think Joe may object the use of "? :"
>
Ternary operator is standard C idiom, used in networking stuff, for
example in FIB_RES_PREFSRC() ;)
This could be properly done using another macro in include/net/ip_fib.h
to centralize this ternary op in one point :
#define __FIB_RES_PREFSRC(res, default) ((res).fi->fib_prefsrc ? : default)
#define FIB_RES_PREFSRC(res) __FIB_RES_PREFSRC(res, default, __fib_res_prefsrc(&res))
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists