- Timestamp:
- 11/02/06 15:57:21 (2 years ago)
- Location:
- trunk
- Files:
-
- 2 modified
-
mwnginject.c (modified) (4 diffs)
-
wginject.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/mwnginject.c
r87 r89 55 55 56 56 if (madwifing_devtype(in_tx, ARPHDR_PRISMAVS) != 0) { 57 printf("Error setting capture header type.\n");58 57 return -1; 59 58 } 60 59 61 60 if (wtinj_open(in_tx) != 0) { 62 printf("Error opening interface.\n");63 61 return -1; 64 62 } … … 79 77 fp = fopen(athdevpath, "w"); 80 78 if (!fp) { 81 fprintf(stderr, "Unable to open proc device \"%s\", ",82 athdevpath);83 perror("fopen");79 snprintf(in_tx->errstr, TX80211_STATUS_MAX, "Error setting madwifi-ng " 80 "capture header type, unable to open proc device \"%s\"", 81 athdevpath); 84 82 return -1; 85 83 } … … 87 85 ret = fprintf(fp, "%s\n", ARPHDR_PRISMAVS); 88 86 if (ret < 0) { 89 fprintf(stderr, "Unable to write to proc device \"%s\", ",90 athdevpath);91 perror("fprintf");87 snprintf(in_tx->errstr, TX80211_STATUS_MAX, "Error setting madwifi-ng " 88 "capture header type, unable to write to proc device \"%s\"", 89 athdevpath); 92 90 return ret; 93 91 } … … 116 114 pkt = malloc(len); 117 115 if (pkt == NULL) { 118 fprintf(stderr, "Unable to allocate memory buffer for send"119 "function.\n");116 snprintf(in_tx->errstr, TX80211_STATUS_MAX, "Unable to allocate memory buffer " 117 "for send function"); 120 118 return -1; 121 119 } -
trunk/wginject.c
r86 r89 91 91 if (!(wginj->raw_fd > 0)) { 92 92 /* file descriptor is not open */ 93 snprintf(wginj->errstr, TX80211_STATUS_MAX, "wlan-ng raw inject file descriptor " 94 "not open"); 93 95 return -1; 94 96 } … … 96 98 frame = malloc(sizeof(*frame) + payloadlen); 97 99 if (frame == NULL) { 100 snprintf(wginj->errstr, TX80211_STATUS_MAX, "wlan-ng send unable to allocate " 101 "memory buffer"); 98 102 return -3; 99 103 } … … 135 139 err = ioctl(wginj->raw_fd, SIOCGIFINDEX, &if_req); 136 140 if (err < 0) { 141 snprintf(wginj->errstr, TX80211_STATUS_MAX, "wlan-ng unable to find interface " 142 "index (SIOCGIFINDEX): %s", strerror(errno)); 137 143 close(wginj->raw_fd); 138 144 return -2; … … 145 151 err = bind(wginj->raw_fd, (struct sockaddr *)&sa_ll, sizeof sa_ll); 146 152 if (err != 0) { 153 snprintf(wginj->errstr, TX80211_STATUS_MAX, "wlan-ng unable to bind() socket: %s", 154 strerror(errno)); 147 155 close(wginj->raw_fd); 148 156 return -3;
