修改原版代码中strlcpy最大8个字节的限制, "enp175s0f0"这种网卡名被截断的BUG.
This commit is contained in:
13
configure
vendored
13
configure
vendored
@@ -2965,8 +2965,9 @@ _ACEOF
|
||||
|
||||
USER_CFLAGS=$CFLAGS
|
||||
#CFLAGS="${CFLAGS} -Wall -O3 -std=gnu99"
|
||||
CFLAGS="${CFLAGS} -Wall -g -O3 -std=gnu99 -DTCPBURST=1"
|
||||
#CFLAGS="${CFLAGS} -Wall -g -O3 -std=gnu99 -DTCPBURST=1 -DMARSIO=1"
|
||||
#CFLAGS="${CFLAGS} -Wall -g -O3 -std=gnu99 -DTCPBURST=1"
|
||||
CFLAGS="${CFLAGS} -Wall -g -O3 -std=gnu99 -DTCPBURST=1 -DMARSIO=1"
|
||||
LIBS="-lmarsio $LIBS"
|
||||
|
||||
# Make sure we can run config.sub.
|
||||
$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
|
||||
@@ -16579,7 +16580,7 @@ if ${ac_cv_lib_nsl_gethostbyname+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lnsl $LIBS"
|
||||
LIBS="-lnsl $LIBS -lpthread"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
@@ -16614,7 +16615,7 @@ if test "x$ac_cv_lib_nsl_gethostbyname" = xyes; then :
|
||||
#define HAVE_LIBNSL 1
|
||||
_ACEOF
|
||||
|
||||
LIBS="-lnsl $LIBS"
|
||||
LIBS="-lnsl $LIBS -lpthread"
|
||||
|
||||
fi
|
||||
|
||||
@@ -16624,7 +16625,7 @@ if ${ac_cv_lib_rt_nanosleep+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lrt $LIBS"
|
||||
LIBS="-lrt $LIBS -lpthread"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
@@ -16659,7 +16660,7 @@ if test "x$ac_cv_lib_rt_nanosleep" = xyes; then :
|
||||
#define HAVE_LIBRT 1
|
||||
_ACEOF
|
||||
|
||||
LIBS="-lrt $LIBS"
|
||||
LIBS="-lrt $LIBS -lpthread"
|
||||
|
||||
fi
|
||||
|
||||
|
||||
@@ -73,7 +73,8 @@ get_interface(interface_list_t *list, const char *alias)
|
||||
} while (ptr != NULL);
|
||||
} else {
|
||||
name = (char *)safe_malloc(strlen(alias) + 1);
|
||||
strlcpy(name, alias, sizeof(name));
|
||||
memset(name, 0, strlen(alias) + 1);
|
||||
strncpy(name, alias, strlen(alias) + 1);
|
||||
return(name);
|
||||
}
|
||||
|
||||
|
||||
@@ -1097,7 +1097,7 @@ int stream_burst_marsio_init(void)
|
||||
|
||||
tcpburst_marsio4_vdev = marsio_open_device(tcpburst_marsio4_instance, marsio_send_device, 0/* rx_stream */, 1 /* tx_stream */);
|
||||
if(NULL == tcpburst_marsio4_vdev) {
|
||||
fprintf(stderr,"%s\n","marsio_open_device() error!\n");
|
||||
fprintf(stderr,"%s\n","marsio_open_device %s error!\n", marsio_send_device);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -1799,14 +1799,15 @@ replay_file(int file_idx)
|
||||
#endif
|
||||
|
||||
|
||||
if (pcap != NULL) {
|
||||
dlt = sendpacket_get_dlt(options.intf1);
|
||||
if ((dlt > 0) && (dlt != pcap_datalink(pcap)))
|
||||
warnx("%s DLT (%s) does not match that of the outbound interface: %s (%s)",
|
||||
path, pcap_datalink_val_to_name(pcap_datalink(pcap)),
|
||||
options.intf1->device, pcap_datalink_val_to_name(dlt));
|
||||
}
|
||||
|
||||
if(1 == send_pkt_driver_mode){
|
||||
if (pcap != NULL) {
|
||||
dlt = sendpacket_get_dlt(options.intf1);
|
||||
if ((dlt > 0) && (dlt != pcap_datalink(pcap)))
|
||||
warnx("%s DLT (%s) does not match that of the outbound interface: %s (%s)",
|
||||
path, pcap_datalink_val_to_name(pcap_datalink(pcap)),
|
||||
options.intf1->device, pcap_datalink_val_to_name(dlt));
|
||||
}
|
||||
}
|
||||
send_packets(pcap, file_idx);
|
||||
if (pcap != NULL)
|
||||
pcap_close(pcap);
|
||||
@@ -2026,41 +2027,42 @@ post_args(void)
|
||||
if (HAVE_OPT(PKTLEN))
|
||||
warn("--pktlen may cause problems. Use with caution.");
|
||||
|
||||
if ((intname = get_interface(intlist, OPT_ARG(INTF1))) == NULL)
|
||||
errx(-1, "Invalid interface name/alias: %s", OPT_ARG(INTF1));
|
||||
if(1 == send_pkt_driver_mode){
|
||||
if ((intname = get_interface(intlist, OPT_ARG(INTF1))) == NULL)
|
||||
errx(-1, "Invalid interface name/alias: %s", OPT_ARG(INTF1));
|
||||
|
||||
options.intf1_name = safe_strdup(intname);
|
||||
options.intf1_name = safe_strdup(intname);
|
||||
|
||||
/* open interfaces for writing */
|
||||
if ((options.intf1 = sendpacket_open(options.intf1_name, ebuf, TCPR_DIR_C2S)) == NULL)
|
||||
errx(-1, "Can't open %s: %s", options.intf1_name, ebuf);
|
||||
/* open interfaces for writing */
|
||||
if ((options.intf1 = sendpacket_open(options.intf1_name, ebuf, TCPR_DIR_C2S)) == NULL)
|
||||
errx(-1, "Can't open %s: %s", options.intf1_name, ebuf);
|
||||
|
||||
int1dlt = sendpacket_get_dlt(options.intf1);
|
||||
int1dlt = sendpacket_get_dlt(options.intf1);
|
||||
|
||||
if (HAVE_OPT(INTF2)) {
|
||||
if ((intname = get_interface(intlist, OPT_ARG(INTF2))) == NULL)
|
||||
errx(-1, "Invalid interface name/alias: %s", OPT_ARG(INTF2));
|
||||
if (HAVE_OPT(INTF2)) {
|
||||
if ((intname = get_interface(intlist, OPT_ARG(INTF2))) == NULL)
|
||||
errx(-1, "Invalid interface name/alias: %s", OPT_ARG(INTF2));
|
||||
|
||||
options.intf2_name = safe_strdup(intname);
|
||||
options.intf2_name = safe_strdup(intname);
|
||||
|
||||
/* open interface for writing */
|
||||
if ((options.intf2 = sendpacket_open(options.intf2_name, ebuf, TCPR_DIR_S2C)) == NULL)
|
||||
errx(-1, "Can't open %s: %s", options.intf2_name, ebuf);
|
||||
/* open interface for writing */
|
||||
if ((options.intf2 = sendpacket_open(options.intf2_name, ebuf, TCPR_DIR_S2C)) == NULL)
|
||||
errx(-1, "Can't open %s: %s", options.intf2_name, ebuf);
|
||||
|
||||
int2dlt = sendpacket_get_dlt(options.intf2);
|
||||
if (int2dlt != int1dlt)
|
||||
errx(-1, "DLT type missmatch for %s (%s) and %s (%s)",
|
||||
options.intf1_name, pcap_datalink_val_to_name(int1dlt),
|
||||
options.intf2_name, pcap_datalink_val_to_name(int2dlt));
|
||||
}
|
||||
|
||||
if (HAVE_OPT(CACHEFILE)) {
|
||||
temp = safe_strdup(OPT_ARG(CACHEFILE));
|
||||
options.cache_packets = read_cache(&options.cachedata, temp,
|
||||
&options.comment);
|
||||
safe_free(temp);
|
||||
}
|
||||
int2dlt = sendpacket_get_dlt(options.intf2);
|
||||
if (int2dlt != int1dlt)
|
||||
errx(-1, "DLT type missmatch for %s (%s) and %s (%s)",
|
||||
options.intf1_name, pcap_datalink_val_to_name(int1dlt),
|
||||
options.intf2_name, pcap_datalink_val_to_name(int2dlt));
|
||||
}
|
||||
|
||||
if (HAVE_OPT(CACHEFILE)) {
|
||||
temp = safe_strdup(OPT_ARG(CACHEFILE));
|
||||
options.cache_packets = read_cache(&options.cachedata, temp,
|
||||
&options.comment);
|
||||
safe_free(temp);
|
||||
}
|
||||
}
|
||||
if (! HAVE_OPT(QUIET))
|
||||
notice("sending out %s %s", options.intf1_name,
|
||||
options.intf2_name == NULL ? "" : options.intf2_name);
|
||||
|
||||
Reference in New Issue
Block a user