Skip to contentSkip to conversation

ipv6: remove unnecessary check in addrconf_prefix_rcv_add_addr()

PATCH Applied Lorenzo Bianconi 2 participants 4 messages Apr 16, 2018 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 ipv6: remove unnecessary check in addrconf_prefix_rcv_add_addr()

Remove unnecessary check on update_lft variable in addrconf_prefix_rcv_add_addr routine since it is always set to 0. Moreover remove update_lft re-initialization to 0

---
 net/ipv6/addrconf.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
net/ipv6/addrconf.c +1 -2
index dffa38004c13..b2c0175125db 100644
@@ -2529,7 +2529,6 @@ int addrconf_prefix_rcv_add_addr(struct net *net, struct net_device *dev,
 		if (IS_ERR_OR_NULL(ifp))
 			return -1;
 
-		update_lft = 0;
 		create = 1;
 		spin_lock_bh(&ifp->lock);
 		ifp->flags |= IFA_F_MANAGETEMPADDR;
@@ -2551,7 +2550,7 @@ int addrconf_prefix_rcv_add_addr(struct net *net, struct net_device *dev,
 			stored_lft = ifp->valid_lft - (now - ifp->tstamp) / HZ;
 		else
 			stored_lft = 0;
-		if (!update_lft && !create && stored_lft) {
+		if (!create && stored_lft) {
 			const u32 minimum_lft = min_t(u32,
 				stored_lft, MIN_VALID_LIFETIME);
 			valid_lft = max(valid_lft, minimum_lft);
Signature · 1 line
2.14.3
#2 lore raw
Quoted 31 lines

Remove unnecessary check on update_lft variable in addrconf_prefix_rcv_add_addr routine since it is always set to 0. Moreover remove update_lft re-initialization to 0

---
 net/ipv6/addrconf.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
net/ipv6/addrconf.c +1 -3
index dffa38004c13..b2c0175125db 100644
@@ -2529,7 +2529,6 @@ int addrconf_prefix_rcv_add_addr(struct net *net, struct net_device *dev,
                if (IS_ERR_OR_NULL(ifp))
                        return -1;
 
-               update_lft = 0;
                create = 1;
                spin_lock_bh(&ifp->lock);
                ifp->flags |= IFA_F_MANAGETEMPADDR;
@@ -2551,7 +2550,7 @@ int addrconf_prefix_rcv_add_addr(struct net *net, struct net_device *dev,
                        stored_lft = ifp->valid_lft - (now - ifp->tstamp) / HZ;
                else
                        stored_lft = 0;
-               if (!update_lft && !create && stored_lft) {
+               if (!create && stored_lft) {
                        const u32 minimum_lft = min_t(u32,
                                stored_lft, MIN_VALID_LIFETIME);
                        valid_lft = max(valid_lft, minimum_lft);
--
Quoted 2 lines

2.14.3

I forgot 'net-next' tag in the subject. Dave should I send a v2?

Regards,
Lorenzo

maintainer
#3 lore raw

From: Lorenzo Bianconi <[email protected]>
Date: Mon, 16 Apr 2018 17:56:33 +0200

Quoted 1 line

I forgot 'net-next' tag in the subject. Dave should I send a v2?

Not necessary.