+int hop_channel(struct info_struct *info,int foo_fd) {
+ struct iwreq my_iwreq;
+
+ if (info->channel>=14) info->channel=1;
+
+ memset(&my_iwreq,0,sizeof(my_iwreq));
+ strcpy(my_iwreq.ifr_name,info->dev);
+ printf("debug: device = %s\n",my_iwreq.ifr_name);
+ printf("debug: %d\n",foo_fd);
+ printf("debug: channel = %d\n",info->channel);
+ my_iwreq.u.freq.e=0;
+ my_iwreq.u.freq.m=info->channel;
+ if((ioctl(foo_fd,SIOCSIWFREQ,&my_iwreq))==-1) {
+ printf("unable to hop channels\n");
+ perror("ioctl");
+ return -1;
+ }
+ printf("debug: hopped to channel %d\n",info->channel);
+ ++(info->channel);
+ return 0;
+}