diff options
| author | David Ahern <dsa@cumulusnetworks.com> | 2016-09-10 15:09:52 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2016-09-11 02:12:51 -0400 |
| commit | 9ee0034b8f49aaaa7e7c2da8db1038915db99c19 (patch) | |
| tree | 897ea4c59abca970385ab76daff0add716b32992 /net/l3mdev | |
| parent | cf9932a9414e241571008edd7412ab22f02b5704 (diff) | |
net: flow: Add l3mdev flow update
Add l3mdev hook to set FLOWI_FLAG_SKIP_NH_OIF flag and update oif/iif
in flow struct if its oif or iif points to a device enslaved to an L3
Master device. Only 1 needs to be converted to match the l3mdev FIB
rule. This moves the flow adjustment for l3mdev to a single point
catching all lookups. It is redundant for existing hooks (those are
removed in later patches) but is needed for missed lookups such as
PMTU updates.
Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/l3mdev')
| -rw-r--r-- | net/l3mdev/l3mdev.c | 35 |
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 | |||
| 226 | void 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 | |||
| 256 | out: | ||
| 257 | rcu_read_unlock(); | ||
| 258 | } | ||
| 259 | EXPORT_SYMBOL_GPL(l3mdev_update_flow); | ||
