summaryrefslogtreecommitdiffstats
path: root/contrib/tcpdump/print-ppp.c
diff options
context:
space:
mode:
authorpkelsey <pkelsey@FreeBSD.org>2015-07-08 16:19:32 +0000
committerpkelsey <pkelsey@FreeBSD.org>2015-07-08 16:19:32 +0000
commit7e965066ede451d7a551dd68d6c59acf32e4846e (patch)
treef0c2243cc0a2a59f3eb1354ba3987d4cbcb788bc /contrib/tcpdump/print-ppp.c
parent732211dc794db586649eabfc1d517b8a477440f5 (diff)
parentc2704d8ede887d9fe69a9a11fe0755b09ec6895d (diff)
downloadFreeBSD-src-7e965066ede451d7a551dd68d6c59acf32e4846e.zip
FreeBSD-src-7e965066ede451d7a551dd68d6c59acf32e4846e.tar.gz
MFV r285191: tcpdump 4.7.4.
Also, the changes made in r272451 and r272653 that were lost in the merge of 4.6.2 (r276788) have been restored. PR: 199568 Differential Revision: https://reviews.freebsd.org/D3007 Reviewed by: brooks, hiren Approved by: jmallett (mentor) MFC after: 1 month
Diffstat (limited to 'contrib/tcpdump/print-ppp.c')
-rw-r--r--contrib/tcpdump/print-ppp.c30
1 files changed, 10 insertions, 20 deletions
diff --git a/contrib/tcpdump/print-ppp.c b/contrib/tcpdump/print-ppp.c
index b1a4729..7e4870d 100644
--- a/contrib/tcpdump/print-ppp.c
+++ b/contrib/tcpdump/print-ppp.c
@@ -807,8 +807,8 @@ static const struct tok ppp_ml_flag_values[] = {
static void
handle_mlppp(netdissect_options *ndo,
- const u_char *p, int length) {
-
+ const u_char *p, int length)
+{
if (!ndo->ndo_eflag)
ND_PRINT((ndo, "MLPPP, "));
@@ -1353,14 +1353,15 @@ static void
ppp_hdlc(netdissect_options *ndo,
const u_char *p, int length)
{
- u_char *b, *s, *t, c;
+ u_char *b, *t, c;
+ const u_char *s;
int i, proto;
const void *se;
if (length <= 0)
return;
- b = (uint8_t *)malloc(length);
+ b = (u_char *)malloc(length);
if (b == NULL)
return;
@@ -1369,14 +1370,13 @@ ppp_hdlc(netdissect_options *ndo,
* Do this so that we dont overwrite the original packet
* contents.
*/
- for (s = (u_char *)p, t = b, i = length; i > 0; i--) {
+ for (s = p, t = b, i = length; i > 0 && ND_TTEST(*s); i--) {
c = *s++;
if (c == 0x7d) {
- if (i > 1) {
- i--;
- c = *s++ ^ 0x20;
- } else
- continue;
+ if (i <= 1 || !ND_TTEST(*s))
+ break;
+ i--;
+ c = *s++ ^ 0x20;
}
*t++ = c;
}
@@ -1394,11 +1394,9 @@ ppp_hdlc(netdissect_options *ndo,
case PPP_IP:
ip_print(ndo, b + 1, length - 1);
goto cleanup;
-#ifdef INET6
case PPP_IPV6:
ip6_print(ndo, b + 1, length - 1);
goto cleanup;
-#endif
default: /* no luck - try next guess */
break;
}
@@ -1468,12 +1466,10 @@ handle_ppp(netdissect_options *ndo,
case PPP_IP:
ip_print(ndo, p, length);
break;
-#ifdef INET6
case ETHERTYPE_IPV6: /*XXX*/
case PPP_IPV6:
ip6_print(ndo, p, length);
break;
-#endif
case ETHERTYPE_IPX: /*XXX*/
case PPP_IPX:
ipx_print(ndo, p, length);
@@ -1783,11 +1779,9 @@ ppp_bsdos_if_print(netdissect_options *ndo _U_,
case PPP_IP:
ip_print(ndo, p, length);
break;
-#ifdef INET6
case PPP_IPV6:
ip6_print(ndo, p, length);
break;
-#endif
case PPP_MPLS_UCAST:
case PPP_MPLS_MCAST:
mpls_print(ndo, p, length);
@@ -1802,11 +1796,9 @@ ppp_bsdos_if_print(netdissect_options *ndo _U_,
case PPP_IP:
ip_print(ndo, p, length);
break;
-#ifdef INET6
case PPP_IPV6:
ip6_print(ndo, p, length);
break;
-#endif
case PPP_MPLS_UCAST:
case PPP_MPLS_MCAST:
mpls_print(ndo, p, length);
@@ -1834,11 +1826,9 @@ ppp_bsdos_if_print(netdissect_options *ndo _U_,
case PPP_IP:
ip_print(p, length);
break;
-#ifdef INET6
case PPP_IPV6:
ip6_print(ndo, p, length);
break;
-#endif
case PPP_MPLS_UCAST:
case PPP_MPLS_MCAST:
mpls_print(ndo, p, length);
OpenPOWER on IntegriCloud