@@ -760,6 +760,13 @@ static const TCPHeader *find_tcp(const PacketElement *pe) {
760
760
return (TCPHeader *) pe;
761
761
}
762
762
763
+ static const ICMPv6Header *find_icmpv6 (const PacketElement *pe) {
764
+ while (pe != NULL && pe->protocol_id () != HEADER_TYPE_ICMPv6)
765
+ pe = pe->getNextElement ();
766
+
767
+ return (ICMPv6Header *) pe;
768
+ }
769
+
763
770
static double vectorize_plen (const PacketElement *pe) {
764
771
const IPv6Header *ipv6;
765
772
@@ -857,9 +864,31 @@ static double vectorize_isr(std::map<std::string, FPPacket>& resps) {
857
864
return sum / t;
858
865
}
859
866
867
+ static int vectorize_icmpv6_type (const PacketElement *pe) {
868
+ const ICMPv6Header *icmpv6;
869
+
870
+ icmpv6 = find_icmpv6 (pe);
871
+ if (icmpv6 == NULL )
872
+ return -1 ;
873
+
874
+ return icmpv6->getType ();
875
+ }
876
+
877
+ static int vectorize_icmpv6_code (const PacketElement *pe) {
878
+ const ICMPv6Header *icmpv6;
879
+
880
+ icmpv6 = find_icmpv6 (pe);
881
+ if (icmpv6 == NULL )
882
+ return -1 ;
883
+
884
+ return icmpv6->getCode ();
885
+ }
886
+
860
887
static struct feature_node *vectorize (const FingerPrintResultsIPv6 *FPR) {
861
888
const char * const IPV6_PROBE_NAMES[] = {" S1" , " S2" , " S3" , " S4" , " S5" , " S6" , " IE1" , " IE2" , " NS" , " U1" , " TECN" , " T2" , " T3" , " T4" , " T5" , " T6" , " T7" };
862
889
const char * const TCP_PROBE_NAMES[] = {" S1" , " S2" , " S3" , " S4" , " S5" , " S6" , " TECN" , " T2" , " T3" , " T4" , " T5" , " T6" , " T7" };
890
+ const char * const ICMPV6_PROBE_NAMES[] = {" IE1" , " IE2" , " NS" };
891
+
863
892
unsigned int nr_feature, i, idx;
864
893
struct feature_node *features;
865
894
std::map<std::string, FPPacket> resps;
@@ -956,6 +985,15 @@ static struct feature_node *vectorize(const FingerPrintResultsIPv6 *FPR) {
956
985
else
957
986
features[idx++].value = -1 ;
958
987
}
988
+ /* ICMPv6 features */
989
+ for (i = 0 ; i < NELEMS (ICMPV6_PROBE_NAMES); i++) {
990
+ const char *probe_name;
991
+
992
+ probe_name = ICMPV6_PROBE_NAMES[i];
993
+ features[idx++].value = vectorize_icmpv6_type (resps[probe_name].getPacket ());
994
+ features[idx++].value = vectorize_icmpv6_code (resps[probe_name].getPacket ());
995
+ }
996
+
959
997
assert (idx == nr_feature);
960
998
961
999
if (o.debugging > 2 ) {
@@ -2603,7 +2641,11 @@ bool FPProbe::isResponse(PacketElement *rcvd) {
2603
2641
if (this ->pkt_time .tv_sec == 0 && this ->pkt_time .tv_usec == 0 )
2604
2642
return false ;
2605
2643
2606
- return PacketParser::is_response (this ->pkt , rcvd);
2644
+ bool is_response = PacketParser::is_response (this ->pkt , rcvd);
2645
+ if (o.debugging > 2 && is_response)
2646
+ printf (" Received response to probe %s\n " , this ->getProbeID ());
2647
+
2648
+ return is_response;
2607
2649
}
2608
2650
2609
2651
0 commit comments