Changeset 0cc91ee
- Timestamp:
- 01/29/19 09:59:10 (2 years ago)
- Branches:
- develop
- Children:
- 4e9be84, b32e8f4
- Parents:
- 0af3a4e
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/format_erf.c
r0af3a4e r0cc91ee 1086 1086 uint16_t curr_sec = 0; 1087 1087 1088 if (packet == NULL) { 1089 fprintf(stderr, "NULL packet passed into erf_get_meta_section()\n"); 1090 return NULL; 1091 } 1088 1092 if (packet->buffer == NULL) { return NULL; } 1089 1093 … … 1150 1154 /* depending on the datatype we need to ensure the data is 1151 1155 * in host byte ordering */ 1152 if (result->items[result->num-1].datatype == TRACE_META_UINT32 1153 || result->items[result->num-1].datatype == TRACE_META_IPV4) { 1156 if (result->items[result->num-1].datatype == TRACE_META_UINT32) { 1154 1157 uint32_t t = *(uint32_t *)(ptr+sizeof(struct dag_opthdr)); 1155 1158 t = ntohl(t); -
lib/format_pcapng.c
r254c926 r0cc91ee 2032 2032 case(PCAPNG_SIMPLE_PACKET_TYPE): 2033 2033 /* simple packets should not contain any options */ 2034 return TRACE_META_UNKNOWN; 2034 2035 case(PCAPNG_NAME_RESOLUTION_TYPE): 2035 2036 /* todo - needs to handle name resolution options along with 2036 2037 * normal options */ 2038 return TRACE_META_UNKNOWN; 2037 2039 case(PCAPNG_INTERFACE_STATS_TYPE): 2038 2040 return TRACE_META_UINT64; … … 2046 2048 /* todo - needs to handle decryption secrets options along with 2047 2049 * normal options */ 2050 return TRACE_META_UNKNOWN; 2048 2051 default: 2049 2052 return TRACE_META_UNKNOWN; 2050 2053 } 2051 2052 /* If we get this far we dont know the datatype */2053 return TRACE_META_UNKNOWN;2054 2054 } 2055 2055 … … 2070 2070 else if (blocktype == PCAPNG_INTERFACE_TYPE) { ptr += sizeof(pcapng_int_t); } 2071 2071 else if (blocktype == PCAPNG_OLD_PACKET_TYPE) { ptr += sizeof(pcapng_opkt_t); } 2072 else if (blocktype == PCAPNG_NAME_RESOLUTION_TYPE) { ptr += sizeof(pcapng_ epkt_t); }2072 else if (blocktype == PCAPNG_NAME_RESOLUTION_TYPE) { ptr += sizeof(pcapng_nrb_t); } 2073 2073 else if (blocktype == PCAPNG_INTERFACE_STATS_TYPE) { ptr += sizeof(pcapng_stats_t); } 2074 2074 else if (blocktype == PCAPNG_ENHANCED_PACKET_TYPE) { … … 2117 2117 uint16_t tmp; 2118 2118 2119 if (packet == NULL) { 2120 fprintf(stderr, "NULL packet passed into pcapng_get_meta_section()\n"); 2121 return NULL; 2122 } 2119 2123 if (packet->buffer == NULL) { return NULL; } 2120 2124 … … 2179 2183 /* depending on the datatype we need to ensure the data is 2180 2184 * in host byte ordering */ 2181 if (result->items[result->num-1].datatype == TRACE_META_UINT32 2182 || result->items[result->num-1].datatype == TRACE_META_IPV4) { 2183 2185 if (result->items[result->num-1].datatype == TRACE_META_UINT32) { 2184 2186 uint32_t t = *(uint32_t *)(ptr+sizeof(struct pcapng_optheader)); 2185 2187 t = ntohl(t); -
lib/format_pcapng.h
rd0f25d4 r0cc91ee 20 20 21 21 22 #define PCAPNG_OPTION_END 0 x000022 #define PCAPNG_OPTION_END 0 23 23 #define PCAPNG_OPTION_COMMENT 1 24 24 /* Custom option code containing a UTF-8 string */ -
libpacketdump/link_23.c
rd0f25d4 r0cc91ee 41 41 static void print_interface_type(libtrace_meta_t *r, libtrace_packet_t *packet) { 42 42 int i; 43 char *ip4, *ip6, *ptr UNUSED; 43 struct in_addr ip; 44 char *ip6, *ptr UNUSED; 44 45 printf(" PCAPNG Interface Description Block\n"); 45 46 … … 57 58 break; 58 59 case(PCAPNG_META_IF_IP4): 59 ip4 = calloc(1, INET4_ADDRSTRLEN); 60 ptr = trace_get_interface_ipv4_string(packet, ip4, 61 INET4_ADDRSTRLEN, 0); 62 printf(" if_IPv4addr: %s", ip4); 63 free(ip4); 60 ip.s_addr = *(uint32_t *)r->items[i].data; 61 printf(" if_IPv4addr: %s", inet_ntoa(ip)); 64 62 break; 65 63 case(PCAPNG_META_IF_IP6): … … 119 117 static void print_name_resolution_type(libtrace_meta_t *r) { 120 118 int i; 119 struct in_addr ip; 121 120 printf(" PCAPNG Name Resolution\n"); 122 123 121 if (r == NULL) { return; } 124 122 125 123 for (i=0; i<r->num; i++) { 126 124 switch(r->items[i].option) { 127 //case(PCAPNG_META_NRB_RECORD_END): 128 // /* This should never occur, 129 // * the meta api should not return it */ 125 case(PCAPNG_META_NRB_RECORD_IP4): 126 ip.s_addr = *(uint32_t *)r->items[i].data; 127 printf(" nrb_record_ipv4: %s dns_name: %s\n", 128 inet_ntoa(ip), 129 (char *)(r->items[i].data+sizeof(uint32_t))); 130 break; 131 case(PCAPNG_META_NRB_RECORD_IP6): 132 /* todo - need to find an example */ 133 break; 134 //case(PCAPNG_META_NS_DNSNAME): 135 // printf(" ns_dnsname: %s\n", 136 // (char *)r->items[i].data); 130 137 // break; 131 //case(PCAPNG_META_NRB_RECORD_IP4): 132 // printf(" nrb_record_ipv4: %u dns_name: %s\n", 133 // *(uint32_t *)r->items[i].data, 134 // (char *)r->items[i].data+sizeof(uint32_t)); 138 //case(PCAPNG_META_NS_DNS_IP4_ADDR): 139 // printf(" ns_dnsIP4addr: %u.%u.%u.%u\n", 140 // *(uint8_t *)r->items[i].data, 141 // *(uint8_t *)r->items[i].data+8, 142 // *(uint8_t *)r->items[i].data+16, 143 // *(uint8_t *)r->items[i].data+24); 135 144 // break; 136 //case(PCAPNG_META_N RB_RECORD_IP6):145 //case(PCAPNG_META_NS_DNS_IP6_ADDR): 137 146 // /* todo - need to find an example */ 138 147 // break; 139 case(PCAPNG_META_NS_DNSNAME):140 printf(" ns_dnsname: %s\n",141 (char *)r->items[i].data);142 break;143 case(PCAPNG_META_NS_DNS_IP4_ADDR):144 printf(" ns_dnsIP4addr: %u.%u.%u.%u\n",145 *(uint8_t *)r->items[i].data,146 *(uint8_t *)r->items[i].data+8,147 *(uint8_t *)r->items[i].data+16,148 *(uint8_t *)r->items[i].data+24);149 break;150 case(PCAPNG_META_NS_DNS_IP6_ADDR):151 /* todo - need to find an example */152 break;153 148 default: 154 149 break;
Note: See TracChangeset
for help on using the changeset viewer.