]> The Tcpdump Group git mirrors - tcpdump/commitdiff
No need to test "is this the first fragment?" twice.
authorGuy Harris <[email protected]>
Sat, 10 Dec 2016 03:56:32 +0000 (19:56 -0800)
committerGuy Harris <[email protected]>
Sat, 10 Dec 2016 03:56:32 +0000 (19:56 -0800)
We were testing it within code that is only executed if it's not the
first fragment.

Clean up indentation while we're at it.

print-ip.c

index e64cd5f1d818054414914059eb2f27e3a5d64581..6700674add91ddc27c1a568b469e3d78401e0626 100644 (file)
@@ -647,22 +647,24 @@ ip_print(netdissect_options *ndo,
                }
                ip_print_demux(ndo, ipds);
        } else {
-           /* Ultra quiet now means that all this stuff should be suppressed */
-           if (ndo->ndo_qflag > 1) return;
+               /*
+                * Ultra quiet now means that all this stuff should be
+                * suppressed.
+                */
+               if (ndo->ndo_qflag > 1)
+                       return;
 
-           /*
-            * if this isn't the first frag, we're missing the
-            * next level protocol header.  print the ip addr
-            * and the protocol.
-            */
-               if (ipds->off & 0x1fff) {
-                       ND_PRINT((ndo, "%s > %s:", ipaddr_string(ndo, &ipds->ip->ip_src),
-                                 ipaddr_string(ndo, &ipds->ip->ip_dst)));
-                       if (!ndo->ndo_nflag && (proto = getprotobynumber(ipds->ip->ip_p)) != NULL)
-                               ND_PRINT((ndo, " %s", proto->p_name));
-                       else
-                               ND_PRINT((ndo, " ip-proto-%d", ipds->ip->ip_p));
-               }
+               /*
+                * This isn't the first frag, so we're missing the
+                * next level protocol header.  print the ip addr
+                * and the protocol.
+                */
+               ND_PRINT((ndo, "%s > %s:", ipaddr_string(ndo, &ipds->ip->ip_src),
+                         ipaddr_string(ndo, &ipds->ip->ip_dst)));
+               if (!ndo->ndo_nflag && (proto = getprotobynumber(ipds->ip->ip_p)) != NULL)
+                       ND_PRINT((ndo, " %s", proto->p_name));
+               else
+                       ND_PRINT((ndo, " ip-proto-%d", ipds->ip->ip_p));
        }
        return;