mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-11 13:27:06 +09:00
Revert "ipv6: remove max_size check inline with ipv4"
This reverts commit0f22c8a6efwhich is commitaf6d10345cupstream. It breaks the Android kernel abi and can be brought back in the future in an abi-safe way if it is really needed. Bug: 161946584 Change-Id: I7e768b45f1b301807a89234d2af0fd025a13396e Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
committed by
Treehugger Robot
parent
9b95c4490c
commit
8284d64954
@@ -16,7 +16,7 @@ struct dst_ops {
|
|||||||
unsigned short family;
|
unsigned short family;
|
||||||
unsigned int gc_thresh;
|
unsigned int gc_thresh;
|
||||||
|
|
||||||
void (*gc)(struct dst_ops *ops);
|
int (*gc)(struct dst_ops *ops);
|
||||||
struct dst_entry * (*check)(struct dst_entry *, __u32 cookie);
|
struct dst_entry * (*check)(struct dst_entry *, __u32 cookie);
|
||||||
unsigned int (*default_advmss)(const struct dst_entry *);
|
unsigned int (*default_advmss)(const struct dst_entry *);
|
||||||
unsigned int (*mtu)(const struct dst_entry *);
|
unsigned int (*mtu)(const struct dst_entry *);
|
||||||
|
|||||||
@@ -82,8 +82,12 @@ void *dst_alloc(struct dst_ops *ops, struct net_device *dev,
|
|||||||
|
|
||||||
if (ops->gc &&
|
if (ops->gc &&
|
||||||
!(flags & DST_NOCOUNT) &&
|
!(flags & DST_NOCOUNT) &&
|
||||||
dst_entries_get_fast(ops) > ops->gc_thresh)
|
dst_entries_get_fast(ops) > ops->gc_thresh) {
|
||||||
ops->gc(ops);
|
if (ops->gc(ops)) {
|
||||||
|
pr_notice_ratelimited("Route cache is full: consider increasing sysctl net.ipv6.route.max_size.\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dst = kmem_cache_alloc(ops->kmem_cachep, GFP_ATOMIC);
|
dst = kmem_cache_alloc(ops->kmem_cachep, GFP_ATOMIC);
|
||||||
if (!dst)
|
if (!dst)
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ static struct dst_entry *ip6_negative_advice(struct dst_entry *);
|
|||||||
static void ip6_dst_destroy(struct dst_entry *);
|
static void ip6_dst_destroy(struct dst_entry *);
|
||||||
static void ip6_dst_ifdown(struct dst_entry *,
|
static void ip6_dst_ifdown(struct dst_entry *,
|
||||||
struct net_device *dev, int how);
|
struct net_device *dev, int how);
|
||||||
static void ip6_dst_gc(struct dst_ops *ops);
|
static int ip6_dst_gc(struct dst_ops *ops);
|
||||||
|
|
||||||
static int ip6_pkt_discard(struct sk_buff *skb);
|
static int ip6_pkt_discard(struct sk_buff *skb);
|
||||||
static int ip6_pkt_discard_out(struct net *net, struct sock *sk, struct sk_buff *skb);
|
static int ip6_pkt_discard_out(struct net *net, struct sock *sk, struct sk_buff *skb);
|
||||||
@@ -3288,10 +3288,11 @@ out:
|
|||||||
return dst;
|
return dst;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ip6_dst_gc(struct dst_ops *ops)
|
static int ip6_dst_gc(struct dst_ops *ops)
|
||||||
{
|
{
|
||||||
struct net *net = container_of(ops, struct net, ipv6.ip6_dst_ops);
|
struct net *net = container_of(ops, struct net, ipv6.ip6_dst_ops);
|
||||||
int rt_min_interval = net->ipv6.sysctl.ip6_rt_gc_min_interval;
|
int rt_min_interval = net->ipv6.sysctl.ip6_rt_gc_min_interval;
|
||||||
|
int rt_max_size = net->ipv6.sysctl.ip6_rt_max_size;
|
||||||
int rt_elasticity = net->ipv6.sysctl.ip6_rt_gc_elasticity;
|
int rt_elasticity = net->ipv6.sysctl.ip6_rt_gc_elasticity;
|
||||||
int rt_gc_timeout = net->ipv6.sysctl.ip6_rt_gc_timeout;
|
int rt_gc_timeout = net->ipv6.sysctl.ip6_rt_gc_timeout;
|
||||||
unsigned long rt_last_gc = net->ipv6.ip6_rt_last_gc;
|
unsigned long rt_last_gc = net->ipv6.ip6_rt_last_gc;
|
||||||
@@ -3299,10 +3300,11 @@ static void ip6_dst_gc(struct dst_ops *ops)
|
|||||||
int entries;
|
int entries;
|
||||||
|
|
||||||
entries = dst_entries_get_fast(ops);
|
entries = dst_entries_get_fast(ops);
|
||||||
if (entries > ops->gc_thresh)
|
if (entries > rt_max_size)
|
||||||
entries = dst_entries_get_slow(ops);
|
entries = dst_entries_get_slow(ops);
|
||||||
|
|
||||||
if (time_after(rt_last_gc + rt_min_interval, jiffies))
|
if (time_after(rt_last_gc + rt_min_interval, jiffies) &&
|
||||||
|
entries <= rt_max_size)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
fib6_run_gc(atomic_inc_return(&net->ipv6.ip6_rt_gc_expire), net, true);
|
fib6_run_gc(atomic_inc_return(&net->ipv6.ip6_rt_gc_expire), net, true);
|
||||||
@@ -3312,6 +3314,7 @@ static void ip6_dst_gc(struct dst_ops *ops)
|
|||||||
out:
|
out:
|
||||||
val = atomic_read(&net->ipv6.ip6_rt_gc_expire);
|
val = atomic_read(&net->ipv6.ip6_rt_gc_expire);
|
||||||
atomic_set(&net->ipv6.ip6_rt_gc_expire, val - (val >> rt_elasticity));
|
atomic_set(&net->ipv6.ip6_rt_gc_expire, val - (val >> rt_elasticity));
|
||||||
|
return entries > rt_max_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ip6_nh_lookup_table(struct net *net, struct fib6_config *cfg,
|
static int ip6_nh_lookup_table(struct net *net, struct fib6_config *cfg,
|
||||||
@@ -6491,7 +6494,7 @@ static int __net_init ip6_route_net_init(struct net *net)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
net->ipv6.sysctl.flush_delay = 0;
|
net->ipv6.sysctl.flush_delay = 0;
|
||||||
net->ipv6.sysctl.ip6_rt_max_size = INT_MAX;
|
net->ipv6.sysctl.ip6_rt_max_size = 4096;
|
||||||
net->ipv6.sysctl.ip6_rt_gc_min_interval = HZ / 2;
|
net->ipv6.sysctl.ip6_rt_gc_min_interval = HZ / 2;
|
||||||
net->ipv6.sysctl.ip6_rt_gc_timeout = 60*HZ;
|
net->ipv6.sysctl.ip6_rt_gc_timeout = 60*HZ;
|
||||||
net->ipv6.sysctl.ip6_rt_gc_interval = 30*HZ;
|
net->ipv6.sysctl.ip6_rt_gc_interval = 30*HZ;
|
||||||
|
|||||||
Reference in New Issue
Block a user