From 013bae6d3df69cc675f1d5d75881437b3540d9cf Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Thu, 1 Nov 2018 10:27:22 +0100 Subject: [PATCH] eapol: Make eapol_frame_watch_{add,remove} functions static --- src/eapol.c | 70 ++++++++++++++++++++++++++--------------------------- src/eapol.h | 5 ---- 2 files changed, 35 insertions(+), 40 deletions(-) diff --git a/src/eapol.c b/src/eapol.c index 7c6cbee3..0f137e20 100644 --- a/src/eapol.c +++ b/src/eapol.c @@ -627,6 +627,41 @@ struct eapol_key *eapol_create_gtk_2_of_2( return step2; } +struct eapol_frame_watch { + uint32_t ifindex; + struct watchlist_item super; +}; + +static void eapol_frame_watch_free(struct watchlist_item *item) +{ + struct eapol_frame_watch *efw = + container_of(item, struct eapol_frame_watch, super); + + l_free(efw); +} + +static const struct watchlist_ops eapol_frame_watch_ops = { + .item_free = eapol_frame_watch_free, +}; + +static int32_t eapol_frame_watch_add(uint32_t ifindex, + eapol_frame_watch_func_t handler, + void *user_data) +{ + struct eapol_frame_watch *efw; + + efw = l_new(struct eapol_frame_watch, 1); + efw->ifindex = ifindex; + + return watchlist_link(&frame_watches, &efw->super, + handler, user_data, NULL); +} + +static bool eapol_frame_watch_remove(uint32_t id) +{ + return watchlist_remove(&frame_watches, id); +} + struct eapol_sm { struct handshake_state *handshake; enum eapol_protocol_version protocol_version; @@ -2085,41 +2120,6 @@ eap_error: return false; } -struct eapol_frame_watch { - uint32_t ifindex; - struct watchlist_item super; -}; - -static void eapol_frame_watch_free(struct watchlist_item *item) -{ - struct eapol_frame_watch *efw = - container_of(item, struct eapol_frame_watch, super); - - l_free(efw); -} - -static const struct watchlist_ops eapol_frame_watch_ops = { - .item_free = eapol_frame_watch_free, -}; - -uint32_t eapol_frame_watch_add(uint32_t ifindex, - eapol_frame_watch_func_t handler, - void *user_data) -{ - struct eapol_frame_watch *efw; - - efw = l_new(struct eapol_frame_watch, 1); - efw->ifindex = ifindex; - - return watchlist_link(&frame_watches, &efw->super, - handler, user_data, NULL); -} - -bool eapol_frame_watch_remove(uint32_t id) -{ - return watchlist_remove(&frame_watches, id); -} - struct preauth_sm { uint32_t ifindex; uint8_t aa[6]; diff --git a/src/eapol.h b/src/eapol.h index f2d5b413..c5bd10b7 100644 --- a/src/eapol.h +++ b/src/eapol.h @@ -123,11 +123,6 @@ void eapol_sm_set_event_func(struct eapol_sm *sm, eapol_sm_event_func_t func); void eapol_register(struct eapol_sm *sm); bool eapol_start(struct eapol_sm *sm); -uint32_t eapol_frame_watch_add(uint32_t ifindex, - eapol_frame_watch_func_t handler, - void *user_data); -bool eapol_frame_watch_remove(uint32_t id); - struct preauth_sm *eapol_preauth_start(const uint8_t *aa, const struct handshake_state *hs, eapol_preauth_cb_t cb, void *user_data,