Fix minor bug.

Add draft of ac kernel module.
This commit is contained in:
vemax78
2014-06-15 09:09:48 +02:00
parent 2d6c4c4dd8
commit 71006a9121
16 changed files with 769 additions and 91 deletions

View File

@ -239,7 +239,7 @@ int wtp_dfa_update_fdspool(struct wtp_fds* fds) {
/* */
fds->kmodeventscount = kmodcount;
fds->kmodevents = (struct wtp_kmod_event*)((wificount > 0) ? capwap_alloc(sizeof(struct wtp_kmod_event) * kmodcount) : NULL);
fds->kmodevents = (struct wtp_kmod_event*)((kmodcount > 0) ? capwap_alloc(sizeof(struct wtp_kmod_event) * kmodcount) : NULL);
}
/* Wifi Events Callback */
@ -271,7 +271,6 @@ int wtp_dfa_update_fdspool(struct wtp_fds* fds) {
fds->fdstotalcount = totalcount;
}
/* Retrieve File Descriptor Kernel Module Event */
if (fds->kmodeventscount > 0) {
fds->kmodeventsstartpos = fds->fdsnetworkcount;

View File

@ -299,10 +299,15 @@ int wtp_kmod_join_mac80211_device(struct wifi_wlan* wlan, uint32_t mode, uint32_
/* */
result = wtp_kmod_send_and_recv(interface->nl, interface->nl_cb, msg, NULL, NULL);
if (!result) {
interface->mode = mode;
interface->flags = flags;
interface->wlan = wlan;
/* */
capwap_itemlist_insert_after(g_wtp.kmodhandle.interfaces, NULL, itemlist);
if (mode == WTP_KMOD_MODE_TUNNEL_USERMODE) {
g_wtp.kmodhandle.interfaceconnectioncount++;
}
} else {
nl_socket_free(interface->nl);
nl_cb_put(interface->nl_cb);
@ -349,6 +354,10 @@ int wtp_kmod_leave_mac80211_device(struct wifi_wlan* wlan) {
nl_cb_put(interface->nl_cb);
/* Free item */
if (interface->mode == WTP_KMOD_MODE_TUNNEL_USERMODE) {
g_wtp.kmodhandle.interfaceconnectioncount--;
}
capwap_itemlist_free(capwap_itemlist_remove(g_wtp.kmodhandle.interfaces, itemlist));
break;
}
@ -369,19 +378,7 @@ int wtp_kmod_isconnected(void) {
int wtp_kmod_getfd(struct pollfd* fds, struct wtp_kmod_event* events, int count) {
int i;
struct capwap_list_item* itemlist;
int kmodcount = 0;
/* */
if (wtp_kmod_isconnected()) {
kmodcount = 1;
for (itemlist = g_wtp.kmodhandle.interfaces->first; itemlist; itemlist = itemlist->next) {
struct wtp_kmod_iface_handle* interface = (struct wtp_kmod_iface_handle*)itemlist->item;
if (interface->nl_fd) {
kmodcount++;
}
}
}
int kmodcount = (wtp_kmod_isconnected() ? 1 + g_wtp.kmodhandle.interfaceconnectioncount : 0);
/* */
if (!kmodcount) {

View File

@ -23,6 +23,8 @@ struct wtp_kmod_iface_handle {
int nl_fd;
struct nl_cb* nl_cb;
uint32_t mode;
uint32_t flags;
struct wifi_wlan* wlan;
};
@ -35,6 +37,7 @@ struct wtp_kmod_handle {
/* */
struct capwap_list* interfaces;
int interfaceconnectioncount;
};
/* */