Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 351574
b: refs/heads/master
c: 930d52c
h: refs/heads/master
v: v3
  • Loading branch information
David S. Miller committed Jan 22, 2013
1 parent 86e3f51 commit 2f26335
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 33 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 463d413cb7dcd5509bc01e1108c2e2dcf8104683
refs/heads/master: 930d52c012b8e69ea87efd7562ded977ee9c9df9
5 changes: 5 additions & 0 deletions trunk/Documentation/networking/ip-sysctl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ route/max_size - INTEGER
Maximum number of routes allowed in the kernel. Increase
this when using large numbers of interfaces and/or routes.

neigh/default/gc_thresh1 - INTEGER
Minimum number of entries to keep. Garbage collector will not
purge entries if there are fewer than this number.
Default: 256

neigh/default/gc_thresh3 - INTEGER
Maximum number of neighbor entries allowed. Increase this
when using large numbers of interfaces and when communicating
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/core/flow.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ flow_cache_lookup(struct net *net, const struct flowi *key, u16 family, u8 dir,
else
fle->genid--;
} else {
if (flo && !IS_ERR(flo))
if (!IS_ERR_OR_NULL(flo))
flo->ops->delete(flo);
}
ret_object:
Expand Down
4 changes: 4 additions & 0 deletions trunk/net/core/neighbour.c
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,9 @@ static void neigh_periodic_work(struct work_struct *work)
nht = rcu_dereference_protected(tbl->nht,
lockdep_is_held(&tbl->lock));

if (atomic_read(&tbl->entries) < tbl->gc_thresh1)
goto out;

/*
* periodically recompute ReachableTime from random function
*/
Expand Down Expand Up @@ -832,6 +835,7 @@ static void neigh_periodic_work(struct work_struct *work)
nht = rcu_dereference_protected(tbl->nht,
lockdep_is_held(&tbl->lock));
}
out:
/* Cycle through all hash buckets every base_reachable_time/2 ticks.
* ARP entry timeouts range from 1/2 base_reachable_time to 3/2
* base_reachable_time.
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/ipv4/af_inet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1333,7 +1333,7 @@ static struct sk_buff *inet_gso_segment(struct sk_buff *skb,
segs = ops->callbacks.gso_segment(skb, features);
rcu_read_unlock();

if (!segs || IS_ERR(segs))
if (IS_ERR_OR_NULL(segs))
goto out;

skb = segs;
Expand Down
23 changes: 12 additions & 11 deletions trunk/net/ipv4/ipmr.c
Original file line number Diff line number Diff line change
Expand Up @@ -832,12 +832,12 @@ static struct mfc_cache *ipmr_cache_find(struct mr_table *mrt,
static struct mfc_cache *ipmr_cache_find_any_parent(struct mr_table *mrt,
int vifi)
{
int line = MFC_HASH(INADDR_ANY, INADDR_ANY);
int line = MFC_HASH(htonl(INADDR_ANY), htonl(INADDR_ANY));
struct mfc_cache *c;

list_for_each_entry_rcu(c, &mrt->mfc_cache_array[line], list)
if (c->mfc_origin == INADDR_ANY &&
c->mfc_mcastgrp == INADDR_ANY &&
if (c->mfc_origin == htonl(INADDR_ANY) &&
c->mfc_mcastgrp == htonl(INADDR_ANY) &&
c->mfc_un.res.ttls[vifi] < 255)
return c;

Expand All @@ -848,14 +848,14 @@ static struct mfc_cache *ipmr_cache_find_any_parent(struct mr_table *mrt,
static struct mfc_cache *ipmr_cache_find_any(struct mr_table *mrt,
__be32 mcastgrp, int vifi)
{
int line = MFC_HASH(mcastgrp, INADDR_ANY);
int line = MFC_HASH(mcastgrp, htonl(INADDR_ANY));
struct mfc_cache *c, *proxy;

if (mcastgrp == INADDR_ANY)
if (mcastgrp == htonl(INADDR_ANY))
goto skip;

list_for_each_entry_rcu(c, &mrt->mfc_cache_array[line], list)
if (c->mfc_origin == INADDR_ANY &&
if (c->mfc_origin == htonl(INADDR_ANY) &&
c->mfc_mcastgrp == mcastgrp) {
if (c->mfc_un.res.ttls[vifi] < 255)
return c;
Expand Down Expand Up @@ -1148,7 +1148,7 @@ static int ipmr_mfc_add(struct net *net, struct mr_table *mrt,
return 0;
}

if (mfc->mfcc_mcastgrp.s_addr != INADDR_ANY &&
if (mfc->mfcc_mcastgrp.s_addr != htonl(INADDR_ANY) &&
!ipv4_is_multicast(mfc->mfcc_mcastgrp.s_addr))
return -EINVAL;

Expand Down Expand Up @@ -1807,7 +1807,7 @@ static int ip_mr_forward(struct net *net, struct mr_table *mrt,
cache->mfc_un.res.pkt++;
cache->mfc_un.res.bytes += skb->len;

if (cache->mfc_origin == INADDR_ANY && true_vifi >= 0) {
if (cache->mfc_origin == htonl(INADDR_ANY) && true_vifi >= 0) {
struct mfc_cache *cache_proxy;

/* For an (*,G) entry, we only check that the incomming
Expand Down Expand Up @@ -1863,8 +1863,8 @@ static int ip_mr_forward(struct net *net, struct mr_table *mrt,
/*
* Forward the frame
*/
if (cache->mfc_origin == INADDR_ANY &&
cache->mfc_mcastgrp == INADDR_ANY) {
if (cache->mfc_origin == htonl(INADDR_ANY) &&
cache->mfc_mcastgrp == htonl(INADDR_ANY)) {
if (true_vifi >= 0 &&
true_vifi != cache->mfc_parent &&
ip_hdr(skb)->ttl >
Expand All @@ -1881,7 +1881,8 @@ static int ip_mr_forward(struct net *net, struct mr_table *mrt,
for (ct = cache->mfc_un.res.maxvif - 1;
ct >= cache->mfc_un.res.minvif; ct--) {
/* For (*,G) entry, don't forward to the incoming interface */
if ((cache->mfc_origin != INADDR_ANY || ct != true_vifi) &&
if ((cache->mfc_origin != htonl(INADDR_ANY) ||
ct != true_vifi) &&
ip_hdr(skb)->ttl > cache->mfc_un.res.ttls[ct]) {
if (psend != -1) {
struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC);
Expand Down
10 changes: 5 additions & 5 deletions trunk/net/ipv4/netfilter/arp_tables.c
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@ static int get_info(struct net *net, void __user *user,
#endif
t = try_then_request_module(xt_find_table_lock(net, NFPROTO_ARP, name),
"arptable_%s", name);
if (t && !IS_ERR(t)) {
if (!IS_ERR_OR_NULL(t)) {
struct arpt_getinfo info;
const struct xt_table_info *private = t->private;
#ifdef CONFIG_COMPAT
Expand Down Expand Up @@ -958,7 +958,7 @@ static int get_entries(struct net *net, struct arpt_get_entries __user *uptr,
}

t = xt_find_table_lock(net, NFPROTO_ARP, get.name);
if (t && !IS_ERR(t)) {
if (!IS_ERR_OR_NULL(t)) {
const struct xt_table_info *private = t->private;

duprintf("t->private->number = %u\n",
Expand Down Expand Up @@ -1001,7 +1001,7 @@ static int __do_replace(struct net *net, const char *name,

t = try_then_request_module(xt_find_table_lock(net, NFPROTO_ARP, name),
"arptable_%s", name);
if (!t || IS_ERR(t)) {
if (IS_ERR_OR_NULL(t)) {
ret = t ? PTR_ERR(t) : -ENOENT;
goto free_newinfo_counters_untrans;
}
Expand Down Expand Up @@ -1158,7 +1158,7 @@ static int do_add_counters(struct net *net, const void __user *user,
}

t = xt_find_table_lock(net, NFPROTO_ARP, name);
if (!t || IS_ERR(t)) {
if (IS_ERR_OR_NULL(t)) {
ret = t ? PTR_ERR(t) : -ENOENT;
goto free;
}
Expand Down Expand Up @@ -1646,7 +1646,7 @@ static int compat_get_entries(struct net *net,

xt_compat_lock(NFPROTO_ARP);
t = xt_find_table_lock(net, NFPROTO_ARP, get.name);
if (t && !IS_ERR(t)) {
if (!IS_ERR_OR_NULL(t)) {
const struct xt_table_info *private = t->private;
struct xt_table_info info;

Expand Down
10 changes: 5 additions & 5 deletions trunk/net/ipv4/netfilter/ip_tables.c
Original file line number Diff line number Diff line change
Expand Up @@ -1090,7 +1090,7 @@ static int get_info(struct net *net, void __user *user,
#endif
t = try_then_request_module(xt_find_table_lock(net, AF_INET, name),
"iptable_%s", name);
if (t && !IS_ERR(t)) {
if (!IS_ERR_OR_NULL(t)) {
struct ipt_getinfo info;
const struct xt_table_info *private = t->private;
#ifdef CONFIG_COMPAT
Expand Down Expand Up @@ -1149,7 +1149,7 @@ get_entries(struct net *net, struct ipt_get_entries __user *uptr,
}

t = xt_find_table_lock(net, AF_INET, get.name);
if (t && !IS_ERR(t)) {
if (!IS_ERR_OR_NULL(t)) {
const struct xt_table_info *private = t->private;
duprintf("t->private->number = %u\n", private->number);
if (get.size == private->size)
Expand Down Expand Up @@ -1189,7 +1189,7 @@ __do_replace(struct net *net, const char *name, unsigned int valid_hooks,

t = try_then_request_module(xt_find_table_lock(net, AF_INET, name),
"iptable_%s", name);
if (!t || IS_ERR(t)) {
if (IS_ERR_OR_NULL(t)) {
ret = t ? PTR_ERR(t) : -ENOENT;
goto free_newinfo_counters_untrans;
}
Expand Down Expand Up @@ -1347,7 +1347,7 @@ do_add_counters(struct net *net, const void __user *user,
}

t = xt_find_table_lock(net, AF_INET, name);
if (!t || IS_ERR(t)) {
if (IS_ERR_OR_NULL(t)) {
ret = t ? PTR_ERR(t) : -ENOENT;
goto free;
}
Expand Down Expand Up @@ -1931,7 +1931,7 @@ compat_get_entries(struct net *net, struct compat_ipt_get_entries __user *uptr,

xt_compat_lock(AF_INET);
t = xt_find_table_lock(net, AF_INET, get.name);
if (t && !IS_ERR(t)) {
if (!IS_ERR_OR_NULL(t)) {
const struct xt_table_info *private = t->private;
struct xt_table_info info;
duprintf("t->private->number = %u\n", private->number);
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/ipv4/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -3243,7 +3243,7 @@ __tcp_alloc_md5sig_pool(struct sock *sk)
struct crypto_hash *hash;

hash = crypto_alloc_hash("md5", 0, CRYPTO_ALG_ASYNC);
if (!hash || IS_ERR(hash))
if (IS_ERR_OR_NULL(hash))
goto out_free;

per_cpu_ptr(pool, cpu)->md5_desc.tfm = hash;
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/ipv4/udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
sizeof(struct udphdr), &ipc, &rt,
msg->msg_flags);
err = PTR_ERR(skb);
if (skb && !IS_ERR(skb))
if (!IS_ERR_OR_NULL(skb))
err = udp_send_skb(skb, fl4);
goto out;
}
Expand Down
4 changes: 2 additions & 2 deletions trunk/net/ipv6/addrconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,7 @@ static int ipv6_create_tempaddr(struct inet6_ifaddr *ifp, struct inet6_ifaddr *i
ipv6_add_addr(idev, &addr, tmp_plen,
ipv6_addr_type(&addr)&IPV6_ADDR_SCOPE_MASK,
addr_flags) : NULL;
if (!ift || IS_ERR(ift)) {
if (IS_ERR_OR_NULL(ift)) {
in6_ifa_put(ifp);
in6_dev_put(idev);
pr_info("%s: retry temporary address regeneration\n", __func__);
Expand Down Expand Up @@ -2079,7 +2079,7 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len, bool sllao)
addr_type&IPV6_ADDR_SCOPE_MASK,
addr_flags);

if (!ifp || IS_ERR(ifp)) {
if (IS_ERR_OR_NULL(ifp)) {
in6_dev_put(in6_dev);
return;
}
Expand Down
10 changes: 5 additions & 5 deletions trunk/net/ipv6/netfilter/ip6_tables.c
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,7 @@ static int get_info(struct net *net, void __user *user,
#endif
t = try_then_request_module(xt_find_table_lock(net, AF_INET6, name),
"ip6table_%s", name);
if (t && !IS_ERR(t)) {
if (!IS_ERR_OR_NULL(t)) {
struct ip6t_getinfo info;
const struct xt_table_info *private = t->private;
#ifdef CONFIG_COMPAT
Expand Down Expand Up @@ -1157,7 +1157,7 @@ get_entries(struct net *net, struct ip6t_get_entries __user *uptr,
}

t = xt_find_table_lock(net, AF_INET6, get.name);
if (t && !IS_ERR(t)) {
if (!IS_ERR_OR_NULL(t)) {
struct xt_table_info *private = t->private;
duprintf("t->private->number = %u\n", private->number);
if (get.size == private->size)
Expand Down Expand Up @@ -1197,7 +1197,7 @@ __do_replace(struct net *net, const char *name, unsigned int valid_hooks,

t = try_then_request_module(xt_find_table_lock(net, AF_INET6, name),
"ip6table_%s", name);
if (!t || IS_ERR(t)) {
if (IS_ERR_OR_NULL(t)) {
ret = t ? PTR_ERR(t) : -ENOENT;
goto free_newinfo_counters_untrans;
}
Expand Down Expand Up @@ -1355,7 +1355,7 @@ do_add_counters(struct net *net, const void __user *user, unsigned int len,
}

t = xt_find_table_lock(net, AF_INET6, name);
if (!t || IS_ERR(t)) {
if (IS_ERR_OR_NULL(t)) {
ret = t ? PTR_ERR(t) : -ENOENT;
goto free;
}
Expand Down Expand Up @@ -1939,7 +1939,7 @@ compat_get_entries(struct net *net, struct compat_ip6t_get_entries __user *uptr,

xt_compat_lock(AF_INET6);
t = xt_find_table_lock(net, AF_INET6, get.name);
if (t && !IS_ERR(t)) {
if (!IS_ERR_OR_NULL(t)) {
const struct xt_table_info *private = t->private;
struct xt_table_info info;
duprintf("t->private->number = %u\n", private->number);
Expand Down

0 comments on commit 2f26335

Please sign in to comment.