Skip to content

Commit

Permalink
ipv4: apply lwtunnel encap for locally-generated packets
Browse files Browse the repository at this point in the history
lwtunnel encap is applied for forwarded packets, but not for
locally-generated packets. This is because the output function is not
overridden in __mkroute_output, unlike it is in __mkroute_input.

The lwtunnel state is correctly set on the rth through the call to
rt_set_nexthop, so all that needs to be done is to override the dst
output function to be lwtunnel_output if there is lwtunnel state
present and it requires output redirection.

Signed-off-by: Robert Shearman <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
rshearman authored and davem330 committed Aug 4, 2015
1 parent abf7c1c commit 0335f5b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions net/ipv4/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -2022,6 +2022,8 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
}

rt_set_nexthop(rth, fl4->daddr, res, fnhe, fi, type, 0);
if (lwtunnel_output_redirect(rth->rt_lwtstate))
rth->dst.output = lwtunnel_output;

return rth;
}
Expand Down

0 comments on commit 0335f5b

Please sign in to comment.