]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Window changes in compressed SLIP are signed.
authorGuy Harris <[email protected]>
Sun, 14 Jan 2018 22:32:28 +0000 (14:32 -0800)
committerGuy Harris <[email protected]>
Sun, 14 Jan 2018 22:32:28 +0000 (14:32 -0800)
If the first byte has a non-zero value, it is a positive value of the
change from 1 to 255.  If it's zero, the next two bytes are a signed
big-endian value.

print-sl.c

index 9f83da72f39fed40d1474cd33ce9dbc2dbb40775..bccdee46fa96d5d867f3569a4fd619a5805e7646 100644 (file)
@@ -211,17 +211,17 @@ static const u_char *
 print_sl_winchange(netdissect_options *ndo,
                    const u_char *cp)
 {
-       u_short i;
+       int16_t i;
 
        if ((i = EXTRACT_U_1(cp)) == 0) {
                cp++;
-               i = EXTRACT_BE_U_2(cp);
+               i = EXTRACT_BE_S_2(cp);
                cp += 2;
        }
        if (i >= 0)
-               ND_PRINT(" W+%u", i);
+               ND_PRINT(" W+%d", i);
        else
-               ND_PRINT(" W%u", i);
+               ND_PRINT(" W%d", i);
        return (cp);
 }