aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/vrf.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2016-01-06 22:54:18 -0500
committerDavid S. Miller <davem@davemloft.net>2016-01-06 22:54:18 -0500
commit9e0efaf6b41bf22c2eb81258fc2a6f1538a643e5 (patch)
treee2daa5fb47f707f44b6b7e9da82a6d8017af3f8c /drivers/net/vrf.c
parentc7f5d105495a38ed09e70d825f75d9d7d5407264 (diff)
parent51cb67c0b0fcb91581b15bd2e85f29af4d4b2df6 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Diffstat (limited to 'drivers/net/vrf.c')
-rw-r--r--drivers/net/vrf.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index 56abdf224d35..66addb7a7911 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -742,7 +742,7 @@ static struct rtable *vrf_get_rtable(const struct net_device *dev,
742} 742}
743 743
744/* called under rcu_read_lock */ 744/* called under rcu_read_lock */
745static void vrf_get_saddr(struct net_device *dev, struct flowi4 *fl4) 745static int vrf_get_saddr(struct net_device *dev, struct flowi4 *fl4)
746{ 746{
747 struct fib_result res = { .tclassid = 0 }; 747 struct fib_result res = { .tclassid = 0 };
748 struct net *net = dev_net(dev); 748 struct net *net = dev_net(dev);
@@ -750,9 +750,10 @@ static void vrf_get_saddr(struct net_device *dev, struct flowi4 *fl4)
750 u8 flags = fl4->flowi4_flags; 750 u8 flags = fl4->flowi4_flags;
751 u8 scope = fl4->flowi4_scope; 751 u8 scope = fl4->flowi4_scope;
752 u8 tos = RT_FL_TOS(fl4); 752 u8 tos = RT_FL_TOS(fl4);
753 int rc;
753 754
754 if (unlikely(!fl4->daddr)) 755 if (unlikely(!fl4->daddr))
755 return; 756 return 0;
756 757
757 fl4->flowi4_flags |= FLOWI_FLAG_SKIP_NH_OIF; 758 fl4->flowi4_flags |= FLOWI_FLAG_SKIP_NH_OIF;
758 fl4->flowi4_iif = LOOPBACK_IFINDEX; 759 fl4->flowi4_iif = LOOPBACK_IFINDEX;
@@ -760,7 +761,8 @@ static void vrf_get_saddr(struct net_device *dev, struct flowi4 *fl4)
760 fl4->flowi4_scope = ((tos & RTO_ONLINK) ? 761 fl4->flowi4_scope = ((tos & RTO_ONLINK) ?
761 RT_SCOPE_LINK : RT_SCOPE_UNIVERSE); 762 RT_SCOPE_LINK : RT_SCOPE_UNIVERSE);
762 763
763 if (!fib_lookup(net, fl4, &res, 0)) { 764 rc = fib_lookup(net, fl4, &res, 0);
765 if (!rc) {
764 if (res.type == RTN_LOCAL) 766 if (res.type == RTN_LOCAL)
765 fl4->saddr = res.fi->fib_prefsrc ? : fl4->daddr; 767 fl4->saddr = res.fi->fib_prefsrc ? : fl4->daddr;
766 else 768 else
@@ -770,6 +772,8 @@ static void vrf_get_saddr(struct net_device *dev, struct flowi4 *fl4)
770 fl4->flowi4_flags = flags; 772 fl4->flowi4_flags = flags;
771 fl4->flowi4_tos = orig_tos; 773 fl4->flowi4_tos = orig_tos;
772 fl4->flowi4_scope = scope; 774 fl4->flowi4_scope = scope;
775
776 return rc;
773} 777}
774 778
775#if IS_ENABLED(CONFIG_IPV6) 779#if IS_ENABLED(CONFIG_IPV6)