Changeset 1742
- Timestamp:
- 03/21/07 21:34:13 (22 months ago)
- Location:
- trunk/src
- Files:
-
- 3 modified
-
tcpbridge.c (modified) (3 diffs, 1 prop)
-
tcpreplay.c (modified) (6 diffs, 1 prop)
-
tcpreplay_opts.def (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/tcpbridge.c
- Property svn:keywords changed from Makefile to Id HeadURL Author Rev Date
r1736 r1742 1 /* $Id : tcpbridge.c 1573 2006-08-05 20:26:08Z aturner$ */1 /* $Id$ */ 2 2 3 3 /* … … 164 164 { 165 165 char ebuf[SENDPACKET_ERRBUF_SIZE]; 166 char *intname; 167 interface_list_t *intlist = get_interface_list(); 168 166 169 167 170 #ifdef DEBUG … … 189 192 options.limit_send = OPT_VALUE_LIMIT; /* default is -1 */ 190 193 191 options.intf1 = safe_strdup(OPT_ARG(INTF1)); 192 193 if (HAVE_OPT(INTF2)) 194 options.intf2 = safe_strdup(OPT_ARG(INTF2)); 195 194 195 if ((intname = get_interface(intlist, OPT_ARG(INTF1))) == NULL) 196 errx(1, "Invalid interface name/alias: %s", OPT_ARG(INTF1)); 197 198 options.intf1 = safe_strdup(intname); 199 200 if (HAVE_OPT(INTF2)) { 201 if ((intname = get_interface(intlist, OPT_ARG(INTF2))) == NULL) 202 errx(1, "Invalid interface name/alias: %s", OPT_ARG(INTF2)); 203 204 options.intf2 = safe_strdup(intname); 205 } 196 206 197 207 -
trunk/src/tcpreplay.c
- Property svn:keywords changed from Makefile to Id HeadURL Author Rev Date
r1734 r1742 1 /* $Id : tcpreplay.c 1556 2006-07-31 06:12:01Z aturner$ */1 /* $Id$ */ 2 2 3 3 /* … … 157 157 dlt = sendpacket_get_dlt(options.intf1); 158 158 if ((dlt > 0) && (dlt != pcap_datalink(pcap))) 159 warnx("%s DLT does not match that of the outbound interface: %s", path, options.intf1->device); 159 warnx("%s DLT (%s) does not match that of the outbound interface: %s (%s)", 160 path, pcap_datalink_val_to_name(pcap_datalink(pcap)), 161 options.intf1->device, pcap_datalink_val_to_name(dlt)); 160 162 161 163 send_packets(pcap); … … 205 207 post_args(void) 206 208 { 207 char *temp ;209 char *temp, *intname; 208 210 char ebuf[SENDPACKET_ERRBUF_SIZE]; 209 211 int int1dlt, int2dlt; 210 212 interface_list_t *intlist = get_interface_list(); 213 211 214 212 215 #ifdef DEBUG … … 255 258 warn("--pktlen may cause problems. Use with caution."); 256 259 257 options.intf1_name = (char *)safe_malloc(strlen(OPT_ARG(INTF1)) + 1); 258 strncpy(options.intf1_name, OPT_ARG(INTF1), strlen(OPT_ARG(INTF1))); 260 261 if ((intname = get_interface(intlist, OPT_ARG(INTF1))) == NULL) 262 errx(1, "Invalid interface name/alias: %s", OPT_ARG(INTF1)); 263 264 options.intf1_name = safe_strdup(intname); 259 265 260 266 /* open interfaces for writing */ … … 265 271 266 272 if (HAVE_OPT(INTF2)) { 267 options.intf2_name = (char *)safe_malloc(strlen(OPT_ARG(INTF2)) + 1); 268 strncpy(options.intf2_name, OPT_ARG(INTF2), strlen(OPT_ARG(INTF2))); 273 if ((intname = get_interface(intlist, OPT_ARG(INTF2))) == NULL) 274 errx(1, "Invalid interface name/alias: %s", OPT_ARG(INTF2)); 275 276 options.intf2_name = safe_strdup(intname); 269 277 270 278 /* open interface for writing */ … … 274 282 int2dlt = sendpacket_get_dlt(options.intf2); 275 283 if (int2dlt != int1dlt) 276 errx(1, "DLT type missmatch for %s and %s", options.intf1_name, options.intf2_name); 284 errx(1, "DLT type missmatch for %s (%s) and %s (%s)", 285 options.intf1_name, pcap_datalink_val_to_name(int1dlt), 286 options.intf2_name, pcap_datalink_val_to_name(int2dlt)); 277 287 } 278 288 -
trunk/src/tcpreplay_opts.def
r1731 r1742 196 196 flag-code = <<- EOFlag 197 197 198 char ebuf[PCAP_ERRBUF_SIZE]; 199 pcap_if_t *pcap_if, *pcap_if_ptr; 200 int i = 0; 201 202 if (pcap_findalldevs(&pcap_if, ebuf) < 0) 203 errx(1, "Error: %s", ebuf); 204 205 pcap_if_ptr = pcap_if; 206 printf("%s", "Available network interfaces:\n"); 207 #ifdef HAVE_WIN32 /* Win32 has alias/name/description */ 208 printf("Alias\tName\n"); 209 #else 210 /* Unix just has a warning about being root */ 211 if (geteuid() != 0) 212 printf("Warning! Need to run as root to get complete list.\n"); 213 #endif 214 215 while (pcap_if_ptr != NULL) { 216 if (! pcap_if_ptr->flags & PCAP_IF_LOOPBACK) { 217 #ifdef HAVE_WIN32 218 printf("%%%d\t%s\n\t%s\n", i, pcap_if_ptr->name, pcap_if_ptr->description); 219 #else 220 printf("%s\n", pcap_if_ptr->name); 221 #endif 222 i ++; 223 } 224 pcap_if_ptr = pcap_if_ptr->next; 225 } 226 pcap_freealldevs(pcap_if); 198 interface_list_t *list = get_interface_list(); 199 list_interfaces(list); 200 free(list); 227 201 exit(0); 228 202
