Commented out code in arping.c causes issues when using large numbers with the -w flag

Bug #484242 reported by freakyclown
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
iputils (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Binary package hint: iputils-ping

1). Ubunto 9.10
2). iputils-ping 3:20071127-1build1

3). Arping to send packets
4). Setting the -w flag to greater than 19737417 will cause the programme to finish and not send any packets

In the arping.c file there are multiple lines commented out mainly includes with no explination as to why, however one line commented out is the definition of a function which is later referenced and causes the programme to finish early.

---------------------------------------------------------------
This is the function that is commented out:
#
#define MS_TDIFF(tv1,tv2) ( ((tv1).tv_sec-(tv2).tv_sec)*1000 + \
#
                           ((tv1).tv_usec-(tv2).tv_usec)/1000 )

--------------------------------------------------------------
This is the point where the code is refenced.:
void catcher(void)
{
        struct timeval tv;

        gettimeofday(&tv, NULL);

        if (start.tv_sec==0)
                start = tv;

        if (count-- == 0 || (timeout && MS_TDIFF(tv,start) > timeout*1000 + 500))
                finish();

        if (last.tv_sec==0 || MS_TDIFF(tv,last) > 500) {
                send_pack(s, src, dst, &me, &he);
                if (count == 0 && unsolicited)
                        finish();
        }
        alarm(1);
}

-------------------------------------------
This is a work around fix:

void catcher(void)
{
        struct timeval tv;

        gettimeofday(&tv, NULL);

        if (start.tv_sec==0)
                start = tv;

        if (count-- == 0 )
                finish();

        if (last.tv_sec==0) {
                send_pack(s, src, dst, &me, &he);
                if (count == 0 && unsolicited)
                        finish();
        }
        alarm(1);
}

5). the fix above allows a the user to set a -w flag of 19737418 and above and still send packets.

ProblemType: Bug
Architecture: i386
Date: Tue Nov 17 15:26:04 2009
DistroRelease: Ubuntu 9.10
InstallationMedia: Ubuntu 9.10 "Karmic Koala" - Release i386 (20091028.5)
Package: iputils-ping 3:20071127-1build1
ProcEnviron:
 PATH=(custom, no user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
ProcVersionSignature: Ubuntu 2.6.31-14.48-generic
SourcePackage: iputils
Uname: Linux 2.6.31-14-generic i686

Revision history for this message
freakyclown (freakyclown) wrote :
Revision history for this message
WeatherGod (ben-v-root) wrote :

freakyclown, the code that you mention is not commented out. In C/C++, the '#' sign is a preprocessor directive.

There is an issue with respect to such a large number being set, which is probably an overflow issue.

Revision history for this message
freakyclown (freakyclown) wrote :

I realised my error after posting (reading too much python recenty)...however at least you can confirm that the problem does exist, and that my code is a work around at least until a fix is presented :)

Changed in iputils (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.