RE: [PATCH] Fix hard_use for xfrm_state

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Herbert.

 > As it stands, unless a state is used within a second of its creation,
 > it may never get expired via hard_use_expire_seconds.
 >
 > This patch fixes that by using add_time if use_time is zero.
 >
 > Index: net/xfrm/xfrm_state.c
 > ===================================================================
 > RCS file:
/home/gondolin/herbert/src/CVS/debian/kernel-source-2.5/net/xfrm/xfrm_state.
c,v
 > retrieving revision 1.1.1.3
 > diff -u -r1.1.1.3 xfrm_state.c
 > --- net/xfrm/xfrm_state.c	27 May 2003 08:38:41 -0000	1.1.1.3
 > +++ net/xfrm/xfrm_state.c	31 May 2003 23:04:09 -0000
 > @@ -112,9 +112,9 @@
 >  		if (tmo < next)
 >  			next = tmo;
 >  	}
 > -	if (x->lft.hard_use_expires_seconds && x->curlft.use_time) {
 > +	if (x->lft.hard_use_expires_seconds) {
 >  		long tmo = x->lft.hard_use_expires_seconds +
 > -			x->curlft.use_time - now;
 > +			(x->curlft.use_time ?: x->curlft.add_time) - now;
 >  		if (tmo <= 0)
 >  			goto expired;
 >  		if (tmo < next)

The latter change looks a bit suspicious. If I'm reading it correctly,
we get the following results:

 1. If x->curlft.use_time is zero then we return x->curlft.add_time
    which matches your description.

 2. If x->curlft.use_time is non-zero, what do we return? Nothing
    is specified in the actual statement.

Should that line be...

 > +			(x->curlft.use_time ? x->curlft.use_time
 > +			                    : x->curlft.add_time) - now;

...which would fully match your description?

Best wishes from Riley.
---
 * Nothing as pretty as a smile, nothing as ugly as a frown.

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.486 / Virus Database: 284 - Release Date: 29-May-2003

-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux