hostapd/src/fst/fst_group.h
Jouni Malinen fe73b469e8 FST: Fix dialog token wrap-around
Dialog token is only 8 bits and maintaining u32 version of it in struct
fst_group resulted in incorrect wrap-around behavior in
fst_group_assign_dialog_token(). It was possible to assign u8
dialog_token value 0 because of this. Fix this by using u8 variable
consistently.

Signed-off-by: Jouni Malinen <j@w1.fi>
2015-07-26 18:12:08 +03:00

75 lines
2.1 KiB
C

/*
* FST module - FST group object definitions
* Copyright (c) 2014, Qualcomm Atheros, Inc.
*
* This software may be distributed under the terms of the BSD license.
* See README for more details.
*/
#ifndef FST_GROUP_H
#define FST_GROUP_H
struct fst_group {
char group_id[IFNAMSIZ + 1];
struct dl_list ifaces;
u8 dialog_token;
u32 fsts_id;
struct dl_list global_groups_lentry;
};
struct session_transition_ie;
#define foreach_fst_group_iface(g, i) \
dl_list_for_each((i), &(g)->ifaces, struct fst_iface, group_lentry)
struct fst_group * fst_group_create(const char *group_id);
void fst_group_attach_iface(struct fst_group *g, struct fst_iface *i);
void fst_group_detach_iface(struct fst_group *g, struct fst_iface *i);
void fst_group_delete(struct fst_group *g);
void fst_group_update_ie(struct fst_group *g);
static inline Boolean fst_group_has_ifaces(struct fst_group *g)
{
return !dl_list_empty(&g->ifaces);
}
static inline struct fst_iface * fst_group_first_iface(struct fst_group *g)
{
return dl_list_first(&g->ifaces, struct fst_iface, group_lentry);
}
static inline const char * fst_group_get_id(struct fst_group *g)
{
return g->group_id;
}
Boolean fst_group_delete_if_empty(struct fst_group *group);
struct fst_iface * fst_group_get_iface_by_name(struct fst_group *g,
const char *ifname);
struct fst_iface *
fst_group_find_new_iface_by_stie(struct fst_group *g,
struct fst_iface *iface,
const u8 *peer_addr,
const struct session_transition_ie *stie,
u8 *iface_peer_addr);
struct fst_iface *
fst_group_get_new_iface_by_stie_and_mbie(
struct fst_group *g, const u8 *mb_ies_buff, size_t mb_ies_size,
const struct session_transition_ie *stie, u8 *iface_peer_addr);
u8 fst_group_assign_dialog_token(struct fst_group *g);
u32 fst_group_assign_fsts_id(struct fst_group *g);
extern struct dl_list fst_global_groups_list;
#define foreach_fst_group(g) \
dl_list_for_each((g), &fst_global_groups_list, \
struct fst_group, global_groups_lentry)
static inline struct fst_group * fst_first_group(void)
{
return dl_list_first(&fst_global_groups_list, struct fst_group,
global_groups_lentry);
}
#endif /* FST_GROUP_H */