Commit a3756afe authored by Josselin Mouette's avatar Josselin Mouette Committed by Germán Póo-Caamaño

Handle output with icmp_req

iputils-ping displays icmp_req= instead of icmp_seq=. Handle the two
outputs correctly.
Signed-off-by: 's avatarGermán Póo-Caamaño <gpoo@gnome.org>
parent cbd30cf3
......@@ -412,7 +412,7 @@ ping_foreach_with_tree (Netinfo * netinfo, gchar * line, gint len,
if (len > 0) { /* there are data to show */
count = strip_line (line, &data, netinfo);
if ((count == 5) || (count == 6)) {
if ((count == 5) || (count == 7)) {
/* Creation of GtkTreeView */
gtk_tree_view_set_rules_hint (GTK_TREE_VIEW
......@@ -526,6 +526,7 @@ static gint
strip_line (gchar * line, ping_data * data, Netinfo * netinfo)
{
gint count;
gchar dummy_buf[3];
if (netinfo_get_ip_version (netinfo) == IPV4)
line = g_strdelimit (line, ":", ' ');
......@@ -537,9 +538,9 @@ strip_line (gchar * line, ping_data * data, Netinfo * netinfo)
&(data)->bytes, data->ip, &(data)->icmp_seq,
data->srtt, data->unit);
#endif
#ifdef PING_PARAMS_6
#ifdef PING_PARAMS_7
count = sscanf (line, PING_FORMAT,
&(data)->bytes, data->ip, &(data)->icmp_seq,
&(data)->bytes, data->ip, dummy_buf, &(data)->icmp_seq,
&(data)->ttl, data->srtt, data->unit);
#endif
if (count != 5 && count != 6) {
......
......@@ -25,14 +25,14 @@
/* <path to program> ping -b [-c <count>] -n <host> */
# define PING_PROGRAM_FORMAT "%s ping -b%s-n %s"
# define PING_PROGRAM_FORMAT_6 "%s ping6%s-n %s"
# define PING_FORMAT "%d bytes from %s icmp_seq=%d ttl=%d time=%s %s"
# define PING_PARAMS_6
# define PING_FORMAT "%d bytes from %s icmp_%3c=%d ttl=%d time=%s %s"
# define PING_PARAMS_7
#elif defined(__OSF__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
/* <path to program> ping [-c <count>] -n <host> */
# define PING_PROGRAM_FORMAT "%s ping%s-n %s"
# define PING_PROGRAM_FORMAT_6 "%s ping6%s-n %s"
# define PING_FORMAT "%d bytes from %s icmp_seq=%d ttl=%d time=%s %s"
# define PING_PARAMS_6
# define PING_FORMAT "%d bytes from %s icmp_%3c=%d ttl=%d time=%s %s"
# define PING_PARAMS_7
#elif defined(__sun__)
/* <path to program> ping -s -n <host> [<count>] */
# define PING_PROGRAM_FORMAT "%s ping -s -n %s 56%s"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment