netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: Lookup actual route when oif is VRF device
@ 2015-10-05 17:49 David Ahern
  2015-10-05 18:01 ` kbuild test robot
  2015-10-07 11:31 ` David Miller
  0 siblings, 2 replies; 5+ messages in thread
From: David Ahern @ 2015-10-05 17:49 UTC (permalink / raw)
  To: netdev; +Cc: dsahern, David Ahern

If the user specifies a VRF device in a get route query the custom route
pointing to the VRF device is returned:

    $ ip route ls table vrf-red
    unreachable default
    broadcast 10.2.1.0 dev eth1  proto kernel  scope link  src 10.2.1.2
    10.2.1.0/24 dev eth1  proto kernel  scope link  src 10.2.1.2
    local 10.2.1.2 dev eth1  proto kernel  scope host  src 10.2.1.2
    broadcast 10.2.1.255 dev eth1  proto kernel  scope link  src 10.2.1.2

    $ ip route get oif vrf-red 10.2.1.40
    10.2.1.40 dev vrf-red
        cache

Add the flags to skip the custom route and go directly to the FIB. With
this patch the actual route is returned:

    $ ip route get oif vrf-red 10.2.1.40
    10.2.1.40 dev eth1  src 10.2.1.2
        cache

Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
---
 net/ipv4/route.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 54e6f456a760..bf1486bd7e81 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2507,6 +2507,9 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh)
 	fl4.flowi4_oif = tb[RTA_OIF] ? nla_get_u32(tb[RTA_OIF]) : 0;
 	fl4.flowi4_mark = mark;
 
+	if (netif_index_is_l3_master(net, fl4.flowi4_oif))
+		fl4.flowi4_flags = FLOWI_FLAG_L3MDEV_SRC | FLOWI_FLAG_SKIP_NH_OIF;
+
 	if (iif) {
 		struct net_device *dev;
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] net: Lookup actual route when oif is VRF device
  2015-10-05 17:49 [PATCH net-next] net: Lookup actual route when oif is VRF device David Ahern
@ 2015-10-05 18:01 ` kbuild test robot
  2015-10-05 18:10   ` David Ahern
  2015-10-07 11:31 ` David Miller
  1 sibling, 1 reply; 5+ messages in thread
From: kbuild test robot @ 2015-10-05 18:01 UTC (permalink / raw)
  To: David Ahern; +Cc: kbuild-all, netdev, dsahern, David Ahern

[-- Attachment #1: Type: text/plain, Size: 2234 bytes --]

Hi David,

[auto build test ERROR on v4.3-rc4 -- if it's inappropriate base, please ignore]

config: x86_64-randconfig-x002-201540 (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All error/warnings (new ones prefixed by >>):

   In file included from include/uapi/linux/stddef.h:1:0,
                    from include/linux/stddef.h:4,
                    from include/uapi/linux/posix_types.h:4,
                    from include/uapi/linux/types.h:13,
                    from include/linux/types.h:5,
                    from include/linux/list.h:4,
                    from include/linux/module.h:9,
                    from net/ipv4/route.c:67:
   net/ipv4/route.c: In function 'inet_rtm_getroute':
>> net/ipv4/route.c:2483:6: error: implicit declaration of function 'netif_index_is_l3_master' [-Werror=implicit-function-declaration]
     if (netif_index_is_l3_master(net, fl4.flowi4_oif))
         ^
   include/linux/compiler.h:147:28: note: in definition of macro '__trace_if'
     if (__builtin_constant_p((cond)) ? !!(cond) :   \
                               ^
>> net/ipv4/route.c:2483:2: note: in expansion of macro 'if'
     if (netif_index_is_l3_master(net, fl4.flowi4_oif))
     ^
>> net/ipv4/route.c:2484:22: error: 'FLOWI_FLAG_L3MDEV_SRC' undeclared (first use in this function)
      fl4.flowi4_flags = FLOWI_FLAG_L3MDEV_SRC | FLOWI_FLAG_SKIP_NH_OIF;
                         ^
   net/ipv4/route.c:2484:22: note: each undeclared identifier is reported only once for each function it appears in
   cc1: some warnings being treated as errors

vim +/netif_index_is_l3_master +2483 net/ipv4/route.c

  2477		fl4.daddr = dst;
  2478		fl4.saddr = src;
  2479		fl4.flowi4_tos = rtm->rtm_tos;
  2480		fl4.flowi4_oif = tb[RTA_OIF] ? nla_get_u32(tb[RTA_OIF]) : 0;
  2481		fl4.flowi4_mark = mark;
  2482	
> 2483		if (netif_index_is_l3_master(net, fl4.flowi4_oif))
> 2484			fl4.flowi4_flags = FLOWI_FLAG_L3MDEV_SRC | FLOWI_FLAG_SKIP_NH_OIF;
  2485	
  2486		if (iif) {
  2487			struct net_device *dev;

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 22104 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] net: Lookup actual route when oif is VRF device
  2015-10-05 18:01 ` kbuild test robot
@ 2015-10-05 18:10   ` David Ahern
  2015-10-11 14:27     ` [kbuild-all] " Fengguang Wu
  0 siblings, 1 reply; 5+ messages in thread
From: David Ahern @ 2015-10-05 18:10 UTC (permalink / raw)
  To: kbuild test robot, David Ahern; +Cc: kbuild-all, netdev

On 10/5/15 12:01 PM, kbuild test robot wrote:
> Hi David,
>
> [auto build test ERROR on v4.3-rc4 -- if it's inappropriate base, please ignore]
>

net-next patches can *not* be applied to Linus' tree. If you are going 
to run the build bot for patches submitted to netdev, please be sure to 
apply those patches to net-next tree.

David

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] net: Lookup actual route when oif is VRF device
  2015-10-05 17:49 [PATCH net-next] net: Lookup actual route when oif is VRF device David Ahern
  2015-10-05 18:01 ` kbuild test robot
@ 2015-10-07 11:31 ` David Miller
  1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2015-10-07 11:31 UTC (permalink / raw)
  To: dsa; +Cc: netdev, dsahern

From: David Ahern <dsa@cumulusnetworks.com>
Date: Mon,  5 Oct 2015 10:49:04 -0700

> If the user specifies a VRF device in a get route query the custom route
> pointing to the VRF device is returned:
> 
>     $ ip route ls table vrf-red
>     unreachable default
>     broadcast 10.2.1.0 dev eth1  proto kernel  scope link  src 10.2.1.2
>     10.2.1.0/24 dev eth1  proto kernel  scope link  src 10.2.1.2
>     local 10.2.1.2 dev eth1  proto kernel  scope host  src 10.2.1.2
>     broadcast 10.2.1.255 dev eth1  proto kernel  scope link  src 10.2.1.2
> 
>     $ ip route get oif vrf-red 10.2.1.40
>     10.2.1.40 dev vrf-red
>         cache
> 
> Add the flags to skip the custom route and go directly to the FIB. With
> this patch the actual route is returned:
> 
>     $ ip route get oif vrf-red 10.2.1.40
>     10.2.1.40 dev eth1  src 10.2.1.2
>         cache
> 
> Signed-off-by: David Ahern <dsa@cumulusnetworks.com>

Applied, thank

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [kbuild-all] [PATCH net-next] net: Lookup actual route when oif is VRF device
  2015-10-05 18:10   ` David Ahern
@ 2015-10-11 14:27     ` Fengguang Wu
  0 siblings, 0 replies; 5+ messages in thread
From: Fengguang Wu @ 2015-10-11 14:27 UTC (permalink / raw)
  To: David Ahern; +Cc: David Ahern, netdev, kbuild-all

Hi David,

On Mon, Oct 05, 2015 at 12:10:12PM -0600, David Ahern wrote:
> On 10/5/15 12:01 PM, kbuild test robot wrote:
> >Hi David,
> >
> >[auto build test ERROR on v4.3-rc4 -- if it's inappropriate base, please ignore]
> >
> 
> net-next patches can *not* be applied to Linus' tree. If you are going to
> run the build bot for patches submitted to netdev, please be sure to apply
> those patches to net-next tree.

OK. Hope these rules will work:

- "[PATCH net-next]" will be tested on net-next/master
- "[PATCH net]"      will be tested on net/master
- "[PATCH nf]"       will be tested on nf/master
- "[PATCH nf-next]"  will be tested on nf-next/master

Thanks,
Fengguang

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-10-11 14:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-05 17:49 [PATCH net-next] net: Lookup actual route when oif is VRF device David Ahern
2015-10-05 18:01 ` kbuild test robot
2015-10-05 18:10   ` David Ahern
2015-10-11 14:27     ` [kbuild-all] " Fengguang Wu
2015-10-07 11:31 ` David Miller

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).