diff options
Diffstat (limited to 'net/ipv4/route.c')
-rw-r--r-- | net/ipv4/route.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 6cb7cff22db9..8ea0735a6754 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -1647,6 +1647,39 @@ struct rtable *rt_dst_alloc(struct net_device *dev, | |||
1647 | } | 1647 | } |
1648 | EXPORT_SYMBOL(rt_dst_alloc); | 1648 | EXPORT_SYMBOL(rt_dst_alloc); |
1649 | 1649 | ||
1650 | struct rtable *rt_dst_clone(struct net_device *dev, struct rtable *rt) | ||
1651 | { | ||
1652 | struct rtable *new_rt; | ||
1653 | |||
1654 | new_rt = dst_alloc(&ipv4_dst_ops, dev, 1, DST_OBSOLETE_FORCE_CHK, | ||
1655 | rt->dst.flags); | ||
1656 | |||
1657 | if (new_rt) { | ||
1658 | new_rt->rt_genid = rt_genid_ipv4(dev_net(dev)); | ||
1659 | new_rt->rt_flags = rt->rt_flags; | ||
1660 | new_rt->rt_type = rt->rt_type; | ||
1661 | new_rt->rt_is_input = rt->rt_is_input; | ||
1662 | new_rt->rt_iif = rt->rt_iif; | ||
1663 | new_rt->rt_pmtu = rt->rt_pmtu; | ||
1664 | new_rt->rt_mtu_locked = rt->rt_mtu_locked; | ||
1665 | new_rt->rt_gw_family = rt->rt_gw_family; | ||
1666 | if (rt->rt_gw_family == AF_INET) | ||
1667 | new_rt->rt_gw4 = rt->rt_gw4; | ||
1668 | else if (rt->rt_gw_family == AF_INET6) | ||
1669 | new_rt->rt_gw6 = rt->rt_gw6; | ||
1670 | INIT_LIST_HEAD(&new_rt->rt_uncached); | ||
1671 | |||
1672 | new_rt->dst.flags |= DST_HOST; | ||
1673 | new_rt->dst.input = rt->dst.input; | ||
1674 | new_rt->dst.output = rt->dst.output; | ||
1675 | new_rt->dst.error = rt->dst.error; | ||
1676 | new_rt->dst.lastuse = jiffies; | ||
1677 | new_rt->dst.lwtstate = lwtstate_get(rt->dst.lwtstate); | ||
1678 | } | ||
1679 | return new_rt; | ||
1680 | } | ||
1681 | EXPORT_SYMBOL(rt_dst_clone); | ||
1682 | |||
1650 | /* called in rcu_read_lock() section */ | 1683 | /* called in rcu_read_lock() section */ |
1651 | int ip_mc_validate_source(struct sk_buff *skb, __be32 daddr, __be32 saddr, | 1684 | int ip_mc_validate_source(struct sk_buff *skb, __be32 daddr, __be32 saddr, |
1652 | u8 tos, struct net_device *dev, | 1685 | u8 tos, struct net_device *dev, |