C/ajinject.c
/* aj_setmonitor sets or disables RFMON mode for AirJack interfaces */
aj_setmonitor sets or disables RFMON mode for AirJack interfaces
aj_setmonitor sets or disables RFMON mode for AirJack interfaces
int aj_setmonitor(char *ifname, int rfmonset) {
    struct aj_config ajconf;
    struct ifreq req;
    int sock;
    if((sock = aj_getsocket(ifname)) < 0) {
        perror("aj_getsocket");
        close(sock);
        return(-1);
    }
    req.ifr_data = (char *)&ajconf;
    strncpy(req.ifr_name, ifname, sizeof(req.ifr_name));
    if (ioctl(sock, SIOCAJGMODE, &req) < 0) {
        close(sock); 
        return(-1);
    }
    ajconf.monitor = rfmonset;
    if (ioctl(sock, SIOCAJSMODE, &req) < 0) {
        close(sock); 
        return(-1);
    }
    return(0);
}
int aj_setmonitor ( char * ifname , int rfmonset ) { struct aj_config ajconf ; struct ifreq req ; int sock ; if ( ( sock = aj_getsocket ( ifname ) ) < 0 ) { perror ( " " ) ; close ( sock ) ; return ( -1 ) ; } req . ifr_data = ( char * ) & ajconf ; strncpy ( req . ifr_name , ifname , sizeof ( req . ifr_name ) ) ; if ( ioctl ( sock , SIOCAJGMODE , & req ) < 0 ) { close ( sock ) ; return ( -1 ) ; } ajconf . monitor = rfmonset ; if ( ioctl ( sock , SIOCAJSMODE , & req ) < 0 ) { close ( sock ) ; return ( -1 ) ; } return ( 0 ) ; }
aj_setmonitor sets or disables RFMON mode for AirJack interfaces
aj_setmonitor sets or disables RFMON mode for AirJack interfaces
/* populate the structure */