Lines 537-543
Link Here
|
537 |
const struct sadb_msghdr *); |
537 |
const struct sadb_msghdr *); |
538 |
static int key_register(struct socket *, struct mbuf *, |
538 |
static int key_register(struct socket *, struct mbuf *, |
539 |
const struct sadb_msghdr *); |
539 |
const struct sadb_msghdr *); |
540 |
static int key_expire(struct secasvar *); |
540 |
static int key_expire(struct secasvar *, int); |
541 |
static int key_flush(struct socket *, struct mbuf *, |
541 |
static int key_flush(struct socket *, struct mbuf *, |
542 |
const struct sadb_msghdr *); |
542 |
const struct sadb_msghdr *); |
543 |
static int key_dump(struct socket *, struct mbuf *, |
543 |
static int key_dump(struct socket *, struct mbuf *, |
Lines 4259-4265
Link Here
|
4259 |
* (DYING state) |
4259 |
* (DYING state) |
4260 |
*/ |
4260 |
*/ |
4261 |
if (sav->lft_c->usetime != 0) |
4261 |
if (sav->lft_c->usetime != 0) |
4262 |
key_expire(sav); |
4262 |
key_expire(sav, 0); |
4263 |
} |
4263 |
} |
4264 |
/* check SOFT lifetime by bytes */ |
4264 |
/* check SOFT lifetime by bytes */ |
4265 |
/* |
4265 |
/* |
Lines 4276-4282
Link Here
|
4276 |
* message in the status of |
4276 |
* message in the status of |
4277 |
* DYING. Do remove below code. |
4277 |
* DYING. Do remove below code. |
4278 |
*/ |
4278 |
*/ |
4279 |
key_expire(sav); |
4279 |
key_expire(sav, 0); |
4280 |
} |
4280 |
} |
4281 |
} |
4281 |
} |
4282 |
|
4282 |
|
Lines 4295-4300
Link Here
|
4295 |
|
4295 |
|
4296 |
if (sav->lft_h->addtime != 0 && |
4296 |
if (sav->lft_h->addtime != 0 && |
4297 |
now - sav->created > sav->lft_h->addtime) { |
4297 |
now - sav->created > sav->lft_h->addtime) { |
|
|
4298 |
key_expire(sav, 1); |
4298 |
key_sa_chgstate(sav, SADB_SASTATE_DEAD); |
4299 |
key_sa_chgstate(sav, SADB_SASTATE_DEAD); |
4299 |
KEY_FREESAV(&sav); |
4300 |
KEY_FREESAV(&sav); |
4300 |
} |
4301 |
} |
Lines 4311-4322
Link Here
|
4311 |
* If there is no SA then sending |
4312 |
* If there is no SA then sending |
4312 |
* expire message. |
4313 |
* expire message. |
4313 |
*/ |
4314 |
*/ |
4314 |
key_expire(sav); |
4315 |
key_expire(sav, 0); |
4315 |
} |
4316 |
} |
4316 |
#endif |
4317 |
#endif |
4317 |
/* check HARD lifetime by bytes */ |
4318 |
/* check HARD lifetime by bytes */ |
4318 |
else if (sav->lft_h->bytes != 0 && |
4319 |
else if (sav->lft_h->bytes != 0 && |
4319 |
sav->lft_h->bytes < sav->lft_c->bytes) { |
4320 |
sav->lft_h->bytes < sav->lft_c->bytes) { |
|
|
4321 |
key_expire(sav, 1); |
4320 |
key_sa_chgstate(sav, SADB_SASTATE_DEAD); |
4322 |
key_sa_chgstate(sav, SADB_SASTATE_DEAD); |
4321 |
KEY_FREESAV(&sav); |
4323 |
KEY_FREESAV(&sav); |
4322 |
} |
4324 |
} |
Lines 6721-6727
Link Here
|
6721 |
* others : error number |
6723 |
* others : error number |
6722 |
*/ |
6724 |
*/ |
6723 |
static int |
6725 |
static int |
6724 |
key_expire(struct secasvar *sav) |
6726 |
key_expire(struct secasvar *sav, int hard) |
6725 |
{ |
6727 |
{ |
6726 |
int satype; |
6728 |
int satype; |
6727 |
struct mbuf *result = NULL, *m; |
6729 |
struct mbuf *result = NULL, *m; |
Lines 6779-6789
Link Here
|
6779 |
lt->sadb_lifetime_usetime = sav->lft_c->usetime; |
6781 |
lt->sadb_lifetime_usetime = sav->lft_c->usetime; |
6780 |
lt = (struct sadb_lifetime *)(mtod(m, caddr_t) + len / 2); |
6782 |
lt = (struct sadb_lifetime *)(mtod(m, caddr_t) + len / 2); |
6781 |
lt->sadb_lifetime_len = PFKEY_UNIT64(sizeof(struct sadb_lifetime)); |
6783 |
lt->sadb_lifetime_len = PFKEY_UNIT64(sizeof(struct sadb_lifetime)); |
6782 |
lt->sadb_lifetime_exttype = SADB_EXT_LIFETIME_SOFT; |
6784 |
if (hard) { |
6783 |
lt->sadb_lifetime_allocations = sav->lft_s->allocations; |
6785 |
lt->sadb_lifetime_exttype = SADB_EXT_LIFETIME_HARD; |
6784 |
lt->sadb_lifetime_bytes = sav->lft_s->bytes; |
6786 |
lt->sadb_lifetime_allocations = sav->lft_h->allocations; |
6785 |
lt->sadb_lifetime_addtime = sav->lft_s->addtime; |
6787 |
lt->sadb_lifetime_bytes = sav->lft_h->bytes; |
6786 |
lt->sadb_lifetime_usetime = sav->lft_s->usetime; |
6788 |
lt->sadb_lifetime_addtime = sav->lft_h->addtime; |
|
|
6789 |
lt->sadb_lifetime_usetime = sav->lft_h->usetime; |
6790 |
} else { |
6791 |
lt->sadb_lifetime_exttype = SADB_EXT_LIFETIME_SOFT; |
6792 |
lt->sadb_lifetime_allocations = sav->lft_s->allocations; |
6793 |
lt->sadb_lifetime_bytes = sav->lft_s->bytes; |
6794 |
lt->sadb_lifetime_addtime = sav->lft_s->addtime; |
6795 |
lt->sadb_lifetime_usetime = sav->lft_s->usetime; |
6796 |
} |
6787 |
m_cat(result, m); |
6797 |
m_cat(result, m); |
6788 |
|
6798 |
|
6789 |
/* set sadb_address for source */ |
6799 |
/* set sadb_address for source */ |