aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
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 /include/net
parentc7f5d105495a38ed09e70d825f75d9d7d5407264 (diff)
parent51cb67c0b0fcb91581b15bd2e85f29af4d4b2df6 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Diffstat (limited to 'include/net')
-rw-r--r--include/net/l3mdev.h16
-rw-r--r--include/net/route.h7
2 files changed, 16 insertions, 7 deletions
diff --git a/include/net/l3mdev.h b/include/net/l3mdev.h
index 786226f8e77b..5567d46b3cff 100644
--- a/include/net/l3mdev.h
+++ b/include/net/l3mdev.h
@@ -29,7 +29,7 @@ struct l3mdev_ops {
29 /* IPv4 ops */ 29 /* IPv4 ops */
30 struct rtable * (*l3mdev_get_rtable)(const struct net_device *dev, 30 struct rtable * (*l3mdev_get_rtable)(const struct net_device *dev,
31 const struct flowi4 *fl4); 31 const struct flowi4 *fl4);
32 void (*l3mdev_get_saddr)(struct net_device *dev, 32 int (*l3mdev_get_saddr)(struct net_device *dev,
33 struct flowi4 *fl4); 33 struct flowi4 *fl4);
34 34
35 /* IPv6 ops */ 35 /* IPv6 ops */
@@ -130,10 +130,11 @@ static inline bool netif_index_is_l3_master(struct net *net, int ifindex)
130 return rc; 130 return rc;
131} 131}
132 132
133static inline void l3mdev_get_saddr(struct net *net, int ifindex, 133static inline int l3mdev_get_saddr(struct net *net, int ifindex,
134 struct flowi4 *fl4) 134 struct flowi4 *fl4)
135{ 135{
136 struct net_device *dev; 136 struct net_device *dev;
137 int rc = 0;
137 138
138 if (ifindex) { 139 if (ifindex) {
139 140
@@ -142,11 +143,13 @@ static inline void l3mdev_get_saddr(struct net *net, int ifindex,
142 dev = dev_get_by_index_rcu(net, ifindex); 143 dev = dev_get_by_index_rcu(net, ifindex);
143 if (dev && netif_is_l3_master(dev) && 144 if (dev && netif_is_l3_master(dev) &&
144 dev->l3mdev_ops->l3mdev_get_saddr) { 145 dev->l3mdev_ops->l3mdev_get_saddr) {
145 dev->l3mdev_ops->l3mdev_get_saddr(dev, fl4); 146 rc = dev->l3mdev_ops->l3mdev_get_saddr(dev, fl4);
146 } 147 }
147 148
148 rcu_read_unlock(); 149 rcu_read_unlock();
149 } 150 }
151
152 return rc;
150} 153}
151 154
152static inline struct dst_entry *l3mdev_get_rt6_dst(const struct net_device *dev, 155static inline struct dst_entry *l3mdev_get_rt6_dst(const struct net_device *dev,
@@ -223,9 +226,10 @@ static inline bool netif_index_is_l3_master(struct net *net, int ifindex)
223 return false; 226 return false;
224} 227}
225 228
226static inline void l3mdev_get_saddr(struct net *net, int ifindex, 229static inline int l3mdev_get_saddr(struct net *net, int ifindex,
227 struct flowi4 *fl4) 230 struct flowi4 *fl4)
228{ 231{
232 return 0;
229} 233}
230 234
231static inline 235static inline
diff --git a/include/net/route.h b/include/net/route.h
index ee81307863d5..a3b9ef74a389 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -283,7 +283,12 @@ static inline struct rtable *ip_route_connect(struct flowi4 *fl4,
283 sport, dport, sk); 283 sport, dport, sk);
284 284
285 if (!src && oif) { 285 if (!src && oif) {
286 l3mdev_get_saddr(net, oif, fl4); 286 int rc;
287
288 rc = l3mdev_get_saddr(net, oif, fl4);
289 if (rc < 0)
290 return ERR_PTR(rc);
291
287 src = fl4->saddr; 292 src = fl4->saddr;
288 } 293 }
289 if (!dst || !src) { 294 if (!dst || !src) {