|
@@ -222,3 +222,38 @@ out:
|
|
|
|
|
|
return rc;
|
|
|
}
|
|
|
+
|
|
|
+void l3mdev_update_flow(struct net *net, struct flowi *fl)
|
|
|
+{
|
|
|
+ struct net_device *dev;
|
|
|
+ int ifindex;
|
|
|
+
|
|
|
+ rcu_read_lock();
|
|
|
+
|
|
|
+ if (fl->flowi_oif) {
|
|
|
+ dev = dev_get_by_index_rcu(net, fl->flowi_oif);
|
|
|
+ if (dev) {
|
|
|
+ ifindex = l3mdev_master_ifindex_rcu(dev);
|
|
|
+ if (ifindex) {
|
|
|
+ fl->flowi_oif = ifindex;
|
|
|
+ fl->flowi_flags |= FLOWI_FLAG_SKIP_NH_OIF;
|
|
|
+ goto out;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (fl->flowi_iif) {
|
|
|
+ dev = dev_get_by_index_rcu(net, fl->flowi_iif);
|
|
|
+ if (dev) {
|
|
|
+ ifindex = l3mdev_master_ifindex_rcu(dev);
|
|
|
+ if (ifindex) {
|
|
|
+ fl->flowi_iif = ifindex;
|
|
|
+ fl->flowi_flags |= FLOWI_FLAG_SKIP_NH_OIF;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+out:
|
|
|
+ rcu_read_unlock();
|
|
|
+}
|
|
|
+EXPORT_SYMBOL_GPL(l3mdev_update_flow);
|