print-sflow.c (9b3ece1c2eb92a881cb2553271e123382bfe31c1) | print-sflow.c (39e421e8cedb2a1e819ab3f703a22b4c3da76b61) |
---|---|
1/* 2 * Copyright (c) 1998-2007 The TCPDUMP project 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that: (1) source code 6 * distributions retain the above copyright notice and this paragraph 7 * in its entirety, and (2) distributions including binary code include 8 * the above copyright notice and this paragraph in its entirety in --- 867 unchanged lines hidden (view full) --- 876 const u_char *tptr; 877 u_int tlen; 878 uint32_t sflow_sample_type, sflow_sample_len; 879 uint32_t nsamples; 880 881 tptr = pptr; 882 tlen = len; 883 sflow_datagram = (const struct sflow_datagram_t *)pptr; | 1/* 2 * Copyright (c) 1998-2007 The TCPDUMP project 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that: (1) source code 6 * distributions retain the above copyright notice and this paragraph 7 * in its entirety, and (2) distributions including binary code include 8 * the above copyright notice and this paragraph in its entirety in --- 867 unchanged lines hidden (view full) --- 876 const u_char *tptr; 877 u_int tlen; 878 uint32_t sflow_sample_type, sflow_sample_len; 879 uint32_t nsamples; 880 881 tptr = pptr; 882 tlen = len; 883 sflow_datagram = (const struct sflow_datagram_t *)pptr; |
884 if (len < sizeof(struct sflow_datagram_t)) { 885 ND_TCHECK(sflow_datagram->version); 886 ND_PRINT((ndo, "sFlowv%u", EXTRACT_32BITS(sflow_datagram->version))); 887 ND_PRINT((ndo, " [length %u < %zu]", 888 len, sizeof(struct sflow_datagram_t))); 889 ND_PRINT((ndo, " (invalid)")); 890 return; 891 } |
|
884 ND_TCHECK(*sflow_datagram); 885 886 /* 887 * Sanity checking of the header. 888 */ 889 if (EXTRACT_32BITS(sflow_datagram->version) != 5) { 890 ND_PRINT((ndo, "sFlow version %u packet not supported", 891 EXTRACT_32BITS(sflow_datagram->version))); --- 19 unchanged lines hidden (view full) --- 911 EXTRACT_32BITS(sflow_datagram->agent_id), 912 EXTRACT_32BITS(sflow_datagram->seqnum), 913 EXTRACT_32BITS(sflow_datagram->uptime), 914 nsamples, 915 len)); 916 917 /* skip Common header */ 918 tptr += sizeof(const struct sflow_datagram_t); | 892 ND_TCHECK(*sflow_datagram); 893 894 /* 895 * Sanity checking of the header. 896 */ 897 if (EXTRACT_32BITS(sflow_datagram->version) != 5) { 898 ND_PRINT((ndo, "sFlow version %u packet not supported", 899 EXTRACT_32BITS(sflow_datagram->version))); --- 19 unchanged lines hidden (view full) --- 919 EXTRACT_32BITS(sflow_datagram->agent_id), 920 EXTRACT_32BITS(sflow_datagram->seqnum), 921 EXTRACT_32BITS(sflow_datagram->uptime), 922 nsamples, 923 len)); 924 925 /* skip Common header */ 926 tptr += sizeof(const struct sflow_datagram_t); |
927 928 if(tlen <= sizeof(const struct sflow_datagram_t)) goto trunc; |
|
919 tlen -= sizeof(const struct sflow_datagram_t); 920 921 while (nsamples > 0 && tlen > 0) { 922 sflow_sample = (const struct sflow_sample_header *)tptr; 923 ND_TCHECK(*sflow_sample); 924 925 sflow_sample_type = (EXTRACT_32BITS(sflow_sample->format)&0x0FFF); 926 sflow_sample_len = EXTRACT_32BITS(sflow_sample->len); --- 65 unchanged lines hidden --- | 929 tlen -= sizeof(const struct sflow_datagram_t); 930 931 while (nsamples > 0 && tlen > 0) { 932 sflow_sample = (const struct sflow_sample_header *)tptr; 933 ND_TCHECK(*sflow_sample); 934 935 sflow_sample_type = (EXTRACT_32BITS(sflow_sample->format)&0x0FFF); 936 sflow_sample_len = EXTRACT_32BITS(sflow_sample->len); --- 65 unchanged lines hidden --- |