osmo-epdg: provider: fix "this" pointer in the attribute provider callbacks
Yes it hurts!
This commit is contained in:
parent
aaba569495
commit
d334adb748
|
@ -142,10 +142,19 @@ METHOD(simaka_provider_t, resync, bool,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
#ifndef container_of
|
||||
#define container_of(ptr, type, member) ({ \
|
||||
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
|
||||
(type *)( (char *)__mptr - offsetof(type, member) );})
|
||||
#endif
|
||||
|
||||
|
||||
METHOD(attribute_provider_t, acquire_address, host_t*,
|
||||
private_osmo_epdg_provider_t *this, linked_list_t *pools, ike_sa_t *ike_sa,
|
||||
host_t *requested)
|
||||
{
|
||||
/* yes this hurts. We can either move the attribute provider out of this class or do some pointer arithmetic to get the right this object */
|
||||
this = container_of(this, struct osmo_epdg_provider_t, attribute);
|
||||
osmo_epdg_ue_t *ue = this->db->get_subscriber_ike(this->db, ike_sa);
|
||||
host_t *address = NULL;
|
||||
/* TODO: check if we want to limit the pool here as well to "epdg" similar what dhcp does */
|
||||
|
@ -165,6 +174,7 @@ METHOD(attribute_provider_t, release_address, bool,
|
|||
private_osmo_epdg_provider_t *this, linked_list_t *pools, host_t *address,
|
||||
ike_sa_t *ike_sa)
|
||||
{
|
||||
this = container_of(this, struct osmo_epdg_provider_t, attribute);
|
||||
osmo_epdg_ue_t *ue = this->db->get_subscriber_ike(this->db, ike_sa);
|
||||
host_t *ue_address = ue->get_address(ue);
|
||||
bool found = FALSE;
|
||||
|
@ -186,6 +196,7 @@ METHOD(attribute_provider_t, create_attribute_enumerator, enumerator_t*,
|
|||
private_osmo_epdg_provider_t *this, linked_list_t *pools, ike_sa_t *ike_sa,
|
||||
linked_list_t *vips)
|
||||
{
|
||||
/* don't forget fixing the this point if needed */
|
||||
/* no additional attributes for this ike_sa */
|
||||
return enumerator_create_empty();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue