From patchwork Thu Jan 17 17:43:03 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?WU9TSElGVUpJIEhpZGVha2kgLyDlkInol6Toi7HmmI4=?= X-Patchwork-Id: 213337 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 920F12C0082 for ; Fri, 18 Jan 2013 04:43:09 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755877Ab3AQRnG (ORCPT ); Thu, 17 Jan 2013 12:43:06 -0500 Received: from 94.43.138.210.xn.2iij.net ([210.138.43.94]:44410 "EHLO mail.st-paulia.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754482Ab3AQRnE (ORCPT ); Thu, 17 Jan 2013 12:43:04 -0500 Received: from [192.168.2.160] (unknown [192.168.2.160]) by mail.st-paulia.net (Postfix) with ESMTPSA id 7F3281BDBF; Fri, 18 Jan 2013 02:43:03 +0900 (JST) Message-ID: <50F83827.3000506@linux-ipv6.org> Date: Fri, 18 Jan 2013 02:43:03 +0900 From: YOSHIFUJI Hideaki Organization: USAGI Project User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2 MIME-Version: 1.0 To: davem@davemloft.net, netdev@vger.kernel.org CC: yoshfuji@linux-ipv6.org, xiyou.wangcong@gmail.com Subject: [PATCH net-next 08/11] ipv6: Introduce rt6_nexthop() to select nexthop address. Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org For RTF_GATEWAY route, return rt->rt6i_gateway. Otherwise, return 2nd argument (destination address). This will be used by following patches which remove rt->n dependency patches in ip6_dst_lookup_tail() and ip6_finish_output2(). Signed-off-by: YOSHIFUJI Hideaki --- include/net/ip6_route.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index 27d8318..30cbb15 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h @@ -23,6 +23,7 @@ struct route_info { #include #include #include +#include #define RT6_LOOKUP_F_IFACE 0x00000001 #define RT6_LOOKUP_F_REACHABLE 0x00000002 @@ -194,4 +195,11 @@ static inline int ip6_skb_dst_mtu(struct sk_buff *skb) skb_dst(skb)->dev->mtu : dst_mtu(skb_dst(skb)); } +static inline struct in6_addr *rt6_nexthop(struct rt6_info *rt, struct in6_addr *dest) +{ + if (rt->rt6i_flags & RTF_GATEWAY) + return &rt->rt6i_gateway; + return dest; +} + #endif