if (vp->da == attr_eap_fast_pac_acknowledge) {
if (vp->vp_uint32 == EAP_FAST_TLV_RESULT_SUCCESS) {
code = FR_RADIUS_CODE_ACCESS_ACCEPT;
- t->pac.expires = UINT32_MAX;
+ t->pac.expires = ~((fr_time_t) 0);
t->pac.expired = false;
t->stage = EAP_FAST_COMPLETE;
}
t->mode = EAP_FAST_PROVISIONING_AUTH;
}
- if (!t->pac.expires || t->pac.expired || (t->pac.expires - fr_time_to_sec(request->packet->timestamp)) < (t->pac_lifetime * 6) / 10) {
+ /*
+ * Send a new pac at ~0.6 times the lifetime.
+ */
+ if (!t->pac.expires || t->pac.expired ||
+ t->pac.expires <= (request->packet->timestamp + fr_time_delta_from_sec((t->pac_lifetime >> 1) + (t->pac_lifetime >> 3)))) {
t->pac.send = true;
}
}
t->pac.type = vp->vp_uint32;
} else if (vp->da == attr_eap_fast_pac_info_pac_lifetime) {
fr_assert(t->pac.expires == 0);
- t->pac.expires = vp->vp_uint32;
- t->pac.expired = (vp->vp_uint32 <= fr_time_to_sec(request->packet->timestamp));
+ t->pac.expires = request->packet->timestamp + fr_time_delta_from_sec(vp->vp_uint32);
+ t->pac.expired = false;
/*
* Not sure if this is the correct attr
* The original enum didn't match a specific TLV nesting level