aboutsummaryrefslogtreecommitdiffstats
path: root/net/l3mdev
diff options
context:
space:
mode:
Diffstat (limited to 'net/l3mdev')
-rw-r--r--net/l3mdev/l3mdev.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/net/l3mdev/l3mdev.c b/net/l3mdev/l3mdev.c
index c4a1c3e84e12..43610e5acc4e 100644
--- a/net/l3mdev/l3mdev.c
+++ b/net/l3mdev/l3mdev.c
@@ -222,3 +222,38 @@ out:
222 222
223 return rc; 223 return rc;
224} 224}
225
226void l3mdev_update_flow(struct net *net, struct flowi *fl)
227{
228 struct net_device *dev;
229 int ifindex;
230
231 rcu_read_lock();
232
233 if (fl->flowi_oif) {
234 dev = dev_get_by_index_rcu(net, fl->flowi_oif);
235 if (dev) {
236 ifindex = l3mdev_master_ifindex_rcu(dev);
237 if (ifindex) {
238 fl->flowi_oif = ifindex;
239 fl->flowi_flags |= FLOWI_FLAG_SKIP_NH_OIF;
240 goto out;
241 }
242 }
243 }
244
245 if (fl->flowi_iif) {
246 dev = dev_get_by_index_rcu(net, fl->flowi_iif);
247 if (dev) {
248 ifindex = l3mdev_master_ifindex_rcu(dev);
249 if (ifindex) {
250 fl->flowi_iif = ifindex;
251 fl->flowi_flags |= FLOWI_FLAG_SKIP_NH_OIF;
252 }
253 }
254 }
255
256out:
257 rcu_read_unlock();
258}
259EXPORT_SYMBOL_GPL(l3mdev_update_flow);