hc
2024-01-31 f9004dbfff8a3fbbd7e2a88c8a4327c7f2f8e5b2
kernel/net/ipv6/addrconf.c
....@@ -318,9 +318,8 @@
318318 static void addrconf_mod_rs_timer(struct inet6_dev *idev,
319319 unsigned long when)
320320 {
321
- if (!timer_pending(&idev->rs_timer))
321
+ if (!mod_timer(&idev->rs_timer, jiffies + when))
322322 in6_dev_hold(idev);
323
- mod_timer(&idev->rs_timer, jiffies + when);
324323 }
325324
326325 static void addrconf_mod_dad_work(struct inet6_ifaddr *ifp,
....@@ -1364,7 +1363,7 @@
13641363 * idev->desync_factor if it's larger
13651364 */
13661365 cnf_temp_preferred_lft = READ_ONCE(idev->cnf.temp_prefered_lft);
1367
- max_desync_factor = min_t(__u32,
1366
+ max_desync_factor = min_t(long,
13681367 idev->cnf.max_desync_factor,
13691368 cnf_temp_preferred_lft - regen_advance);
13701369
....@@ -2580,12 +2579,18 @@
25802579 ipv6_ifa_notify(0, ift);
25812580 }
25822581
2583
- if ((create || list_empty(&idev->tempaddr_list)) &&
2584
- idev->cnf.use_tempaddr > 0) {
2582
+ /* Also create a temporary address if it's enabled but no temporary
2583
+ * address currently exists.
2584
+ * However, we get called with valid_lft == 0, prefered_lft == 0, create == false
2585
+ * as part of cleanup (ie. deleting the mngtmpaddr).
2586
+ * We don't want that to result in creating a new temporary ip address.
2587
+ */
2588
+ if (list_empty(&idev->tempaddr_list) && (valid_lft || prefered_lft))
2589
+ create = true;
2590
+
2591
+ if (create && idev->cnf.use_tempaddr > 0) {
25852592 /* When a new public address is created as described
25862593 * in [ADDRCONF], also create a new temporary address.
2587
- * Also create a temporary address if it's enabled but
2588
- * no temporary address currently exists.
25892594 */
25902595 read_unlock_bh(&idev->lock);
25912596 ipv6_create_tempaddr(ifp, false);