From: Eric Dumazet <eric.dumazet@gmail.com>
To: George Kargiotakis <kargig@void.gr>
Cc: netdev@vger.kernel.org
Subject: Re: Linux kernel handling of IPv6 temporary addresses
Date: Fri, 28 Dec 2012 09:19:25 -0800 [thread overview]
Message-ID: <1356715165.21409.296.camel@edumazet-glaptop> (raw)
In-Reply-To: <1356627241.30414.1079.camel@edumazet-glaptop>
On Thu, 2012-12-27 at 08:54 -0800, Eric Dumazet wrote:
> We should only rate limit, and not disable forever.
>
Something like :
diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt
index dd52d51..32d51e2 100644
--- a/Documentation/networking/ip-sysctl.txt
+++ b/Documentation/networking/ip-sysctl.txt
@@ -1282,7 +1282,7 @@ max_desync_factor - INTEGER
Default: 600
regen_max_retry - INTEGER
- Number of attempts before give up attempting to generate
+ Number of attempts per second before give up attempting to generate
valid temporary addresses.
Default: 5
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h
index 9356322..8f206cf 100644
--- a/include/net/if_inet6.h
+++ b/include/net/if_inet6.h
@@ -70,6 +70,7 @@ struct inet6_ifaddr {
struct list_head tmp_list;
struct inet6_ifaddr *ifpub;
int regen_count;
+ u32 regen_stamp;
#endif
struct rcu_head rcu;
};
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 408cac4a..c41925c 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -980,6 +980,7 @@ static int ipv6_create_tempaddr(struct inet6_ifaddr *ifp, struct inet6_ifaddr *i
int max_addresses;
u32 addr_flags;
unsigned long now = jiffies;
+ u32 stamp;
write_lock(&idev->lock);
if (ift) {
@@ -994,18 +995,22 @@ retry:
in6_dev_hold(idev);
if (idev->cnf.use_tempaddr <= 0) {
write_unlock(&idev->lock);
- pr_info("%s: use_tempaddr is disabled\n", __func__);
+ pr_info_ratelimited("%s: use_tempaddr is disabled\n", __func__);
in6_dev_put(idev);
ret = -1;
goto out;
}
spin_lock_bh(&ifp->lock);
+ stamp = jiffies / HZ;
+ if (stamp != ifp->regen_stamp) {
+ ifp->regen_stamp = stamp;
+ ifp->regen_count = 0;
+ }
if (ifp->regen_count++ >= idev->cnf.regen_max_retry) {
- idev->cnf.use_tempaddr = -1; /*XXX*/
spin_unlock_bh(&ifp->lock);
write_unlock(&idev->lock);
- pr_warn("%s: regeneration time exceeded - disabled temporary address support\n",
- __func__);
+ pr_warn_ratelimited("%s: regeneration time exceeded - disabled temporary address support\n",
+ __func__);
in6_dev_put(idev);
ret = -1;
goto out;
prev parent reply other threads:[~2012-12-28 17:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-14 21:14 Linux kernel handling of IPv6 temporary addresses George Kargiotakis
2012-11-14 21:29 ` David Miller
2012-11-14 23:03 ` George Kargiotakis
2012-11-14 23:08 ` David Miller
2012-11-16 21:27 ` Ben Hutchings
2012-12-27 15:57 ` George Kargiotakis
2012-12-27 16:54 ` Eric Dumazet
2012-12-28 17:19 ` Eric Dumazet [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1356715165.21409.296.camel@edumazet-glaptop \
--to=eric.dumazet@gmail.com \
--cc=kargig@void.gr \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox