Bug 756439 - ping Record Route report incorrect (same route)
Summary: ping Record Route report incorrect (same route)
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: iputils
Version: 15
Hardware: All
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: Jiri Skala
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-11-23 15:23 UTC by Enrique V. Bonet Esteban
Modified: 2014-11-09 22:35 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-11-24 13:58:32 UTC
Type: ---


Attachments (Terms of Use)

Description Enrique V. Bonet Esteban 2011-11-23 15:23:32 UTC
Description of problem:

The ping -R command report (same route) although the route are different. The
problem turns up when before reaching the different section route (A or B),
there is a 0 value in a component of the IP address of a node. In the
following example, which we use in our university lessons, the routers
balanced the network traffic one to one:

Route A:
10.0.0.2 <- Fedora 15
10.0.4.5
10.0.3.1
10.0.2.2 <- Fedora 15
10.0.2.2
10.0.4.2
10.0.0.1
10.0.0.2

Route B:
10.0.0.2 <- Fedora 15
10.0.4.1
10.0.2.1
10.0.2.2 <- Fedora 15
10.0.2.2
10.0.4.2
10.0.0.1
10.0.0.2

Executing the command ping -R 10.0.2.2 in the 10.0.0.2 host, the ping reports
the first route A (or the first route B) and after always the (same route),
instead of reporting the A route, B route, A route, B route...

Version-Release number of selected component (if applicable):

iputils-20071127 and subsequent iputils packages, including Fedora 14, Fedora 
15, Fedora 16 and rawhide iputils packages.

How reproducible:

Execute ping -R in a network with two routes and, for example, Fedora node
with IP 10.0.X.X.

Steps to Reproduce:
1. Install the iputils package in a Fedora 14 or later version.
2. Execute ping -R in a network as describe above.
3. The ping -R report (same route).
4. Modify the code as after the bug is solved.
  
Actual results:

ping -R report (same route)

Expected results:

ping -R report route A, route B, route A, route B, ...

Additional info:

The error is caused by the use of the strncmp() function in the code that
replaces the obsolete bcmp() function:

if (i == old_rrlen
    && !strncmp((char *)cp, old_rr, i)
    && !(options & F_FLOOD)) {
        printf("\t(same route)");
        i = ((i + 3) / 4) * 4;
        cp += i;
        break;
}

The bug solution is to replace the strncmp() function for the memcmp() function 
as follows:

if (i == old_rrlen
    && !memcmp(cp, (unsigned char *)old_rr, i)
    && !(options & F_FLOOD)) {
        printf("\t(same route)");
        i = ((i + 3) / 4) * 4;
        cp += i;
        break;
}


Note You need to log in before you can comment on or make changes to this bug.