Fix compilation errors in monitor.c
- Add forward declaration for verify_monitor_mode - Initialize cb to NULL in verify_monitor_mode - Add missing nla_put_failure label and error handling Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
680253c120
commit
5827518041
|
|
@ -50,6 +50,9 @@ static void nl80211_cleanup(void) {
|
|||
}
|
||||
}
|
||||
|
||||
// Forward declaration
|
||||
static int verify_monitor_mode(const char *interface);
|
||||
|
||||
// Helper function to bring interface up/down using ioctl
|
||||
static int set_interface_up(const char *interface, int up) {
|
||||
int sockfd;
|
||||
|
|
@ -300,7 +303,7 @@ static int get_interface_type_cb(struct nl_msg *msg, void *arg) {
|
|||
// Verify interface is in monitor mode
|
||||
static int verify_monitor_mode(const char *interface) {
|
||||
struct nl_msg *msg;
|
||||
struct nl_cb *cb;
|
||||
struct nl_cb *cb = NULL;
|
||||
int ifindex;
|
||||
int err = 0;
|
||||
uint32_t iftype = 0;
|
||||
|
|
@ -351,6 +354,14 @@ static int verify_monitor_mode(const char *interface) {
|
|||
nl80211_cleanup();
|
||||
|
||||
return (iftype == NL80211_IFTYPE_MONITOR) ? 0 : -1;
|
||||
|
||||
nla_put_failure:
|
||||
if (cb) {
|
||||
nl_cb_put(cb);
|
||||
}
|
||||
nlmsg_free(msg);
|
||||
nl80211_cleanup();
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Get current channel from interface using netlink
|
||||
|
|
|
|||
Loading…
Reference in New Issue