]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Make "mobility_opt_print()" static, as it's not used outside
authorguy <guy>
Fri, 2 Aug 2002 04:10:14 +0000 (04:10 +0000)
committerguy <guy>
Fri, 2 Aug 2002 04:10:14 +0000 (04:10 +0000)
"print-mobility.c".

Make sure "mobility_print()" returns a valid value even if there's no
data available in the mobility header - but note that the value isn't
used.  (Is there ever a need to use the value?)

print-ip6.c
print-mobility.c

index 9c43eed1f586540028ef7e9610ed66ecd5f3e2cb..e58b3f9cb6205498c483f0ab93d3e207762c60b7 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-ip6.c,v 1.24 2002-08-01 08:53:10 risso Exp $";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-ip6.c,v 1.25 2002-08-02 04:10:14 guy Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -119,6 +119,10 @@ ip6_print(register const u_char *bp, register u_int length)
 #define IPPROTO_MOBILITY 62
 #endif
                case IPPROTO_MOBILITY:
+                       /*
+                        * XXX - we don't use "advance"; is this
+                        * header always a final header?
+                        */
                        advance = mobility_print(cp, (const u_char *)ip6);
                        nh = *cp;
                        goto end;
index dc6a2c87e9190ea34dc98d8ad85491f070d4fb14..d5933b8cabbf0da7ccff5180ae5c37fd25233578 100644 (file)
@@ -33,7 +33,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-     "@(#) $Header: /tcpdump/master/tcpdump/print-mobility.c,v 1.3 2002-08-01 08:53:19 risso Exp $";
+     "@(#) $Header: /tcpdump/master/tcpdump/print-mobility.c,v 1.4 2002-08-02 04:10:14 guy Exp $";
 #endif
 
 #ifdef INET6
@@ -87,7 +87,7 @@ struct ip6_mobility {
 #define IP6MOPT_AUTH          0x5
 #define IP6MOPT_AUTH_MINLEN     2 /* 2+len */
 
-void
+static void
 mobility_opt_print(const u_char *bp, int len)
 {
        int i;
@@ -181,7 +181,22 @@ mobility_print(const u_char *bp, const u_char *bp2)
        /* 'ep' points to the end of available data. */
        ep = snapend;
 
-       TCHECK(mh->ip6m_len);
+       if (!TTEST(mh->ip6m_len)) {
+               /*
+                * There's not enough captured data to include the
+                * mobility header length.
+                *
+                * Our caller expects us to return the length, however,
+                * so return a value that will run to the end of the
+                * captured data.
+                *
+                * XXX - "ip6_print()" doesn't do anything with the
+                * returned length, however, as it breaks out of the
+                * header-processing loop.
+                */
+               mhlen = ep - bp;
+               goto trunc;
+       }
        mhlen = (int)(mh->ip6m_len << 3);
        if (mhlen < IP6M_MINLEN)
                mhlen = IP6M_MINLEN;    /* XXX */