diff --git a/test/ospf.uts b/scapy/contrib/ospf.uts similarity index 78% rename from test/ospf.uts rename to scapy/contrib/ospf.uts index bde90303a1bcd7b7474b9539039f097d7dc02635..0dc1d6e1f731d7beec7cb23ce57a50cd08a8f66c 100644 --- a/test/ospf.uts +++ b/scapy/contrib/ospf.uts @@ -1,6 +1,11 @@ -############################## -% OSPF Related regression tests -############################## +# OSPF Related regression tests +# +# Type the following command to launch start the tests: +# $ test/run_tests -P "load_contrib('ospf')" -t scapy/contrib/ospf.uts + ++ OSPF + += OSPF, basic instanciation data = '\x01\x00^\x00\x00\x05\x00\xe0\x18\xb1\x0c\xad\x08\x00E\xc0\x00T\x08\x19\x00\x00\x01Ye\xc2\xc0\xa8\xaa\x08\xe0\x00\x00\x05\x02\x04\x00@\xc0\xa8\xaa\x08\x00\x00\x00\x01\x96\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x03\xe2\x02\x01\xc0\xa8\xaa\x08\xc0\xa8\xaa\x08\x80\x00\r\xc3%\x06\x00$\x02\x00\x00\x01\xc0\xa8\xaa\x00\xff\xff\xff\x00\x03\x00\x00\n' @@ -10,8 +15,8 @@ assert (p[OSPF_LSUpd][OSPF_Router_LSA].age == 994) assert (p[OSPF_LSUpd][OSPF_Router_LSA].type == 1) assert (p[OSPF_LSUpd][OSPF_Router_LSA].id == '192.168.170.8') assert (p[OSPF_LSUpd][OSPF_Router_LSA].adrouter == '192.168.170.8') -assert (hex(p[OSPF_LSUpd][OSPF_Router_LSA].seq) == '0x80000dc3') -assert (hex(p[OSPF_LSUpd][OSPF_Router_LSA].chksum) == '0x2506') +assert (p[OSPF_LSUpd][OSPF_Router_LSA].seq == 0x80000dc3) +assert (p[OSPF_LSUpd][OSPF_Router_LSA].chksum == 0x2506) assert (p[OSPF_LSUpd][OSPF_Router_LSA].len == 36) assert (p[OSPF_LSUpd][OSPF_Router_LSA].reserved == 0) assert (p[OSPF_LSUpd][OSPF_Router_LSA].linkcount == 1) @@ -20,4 +25,4 @@ assert (p[OSPF_LSUpd][OSPF_Router_LSA].linklist[0][OSPF_Link].id == '192.168.170 assert (p[OSPF_LSUpd][OSPF_Router_LSA].linklist[0][OSPF_Link].data == '255.255.255.0') assert (p[OSPF_LSUpd][OSPF_Router_LSA].linklist[0][OSPF_Link].type == 3) assert (p[OSPF_LSUpd][OSPF_Router_LSA].linklist[0][OSPF_Link].toscount == 0) -assert (p[OSPF_LSUpd][OSPF_Router_LSA].linklist[0][OSPF_Link].metric == 10) \ No newline at end of file +assert (p[OSPF_LSUpd][OSPF_Router_LSA].linklist[0][OSPF_Link].metric == 10) diff --git a/scapy/fields.py b/scapy/fields.py index 7316105552113b16fbcbfdde2c58cc01c4f52e6d..28ff64d9f51ba9a7ce0012f7829f0f2904b58898 100644 --- a/scapy/fields.py +++ b/scapy/fields.py @@ -439,6 +439,7 @@ class PacketListField(PacketField): self.count_from = count_from self.length_from = length_from + def any2i(self, pkt, x): if not isinstance(x, list): return [x]