1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-23 02:35:57 +01:00
Commit Graph

732 Commits

Author SHA1 Message Date
Prosper Van
a619e4ff98 IPv6 use interface when sending to link-local dest 2021-07-22 11:18:48 -07:00
Matias Fontanini
07012648fb Assign a PDUType for Dot11ControlTA 2020-09-10 07:34:54 -07:00
Matias Fontanini
16e77146ab Merge pull request #382 from laudrup/fix-install-without-libpcap
Don't include non-existing headers when installed without libpcap
2020-02-01 11:01:16 -08:00
Kasper Laudrup
9e61286a59 Fix compiler warnings from MSVC 2017
The MS C++ compiler doesn't seem to understand that a small constant
like 0, although strictly being an integer, will fit perfectly fine
into an 8 bit type so add some safe casts to silence that warning.
2019-12-20 14:37:38 +01:00
Kasper Laudrup
8da102fb48 Don't include non-existing headers when installed without libpcap
If libpcap support has been disabled (LIBTINS_ENABLE_PCAP=OFF)
then the headers requiring that library will not be installed,
but they will still be included from the main tins.h convenience
header.

This fixes that by sorrounding the includes with an #ifdef the
same way it has been done for DOT11 support.
2019-12-20 14:18:07 +01:00
Matias Fontanini
731e36e373 Fix "fi" in comment 2019-10-02 08:32:54 -07:00
Karas Lukáš
608b48f25c add IPv6 check for Link-Local unicast address 2019-10-01 17:08:01 +02:00
Lukáš Karas
22b4435c81 simplify tcp flag checks, fix stream_follower (#334)
* simplify tcp flag checks, fix stream_follower

On various places was used simple comparison for checking state of flags.

tcp.flags() == (TCP::SYN | TCP::ACK)

This is not what you want usually, because this check is false
in case that another flag is set also. Correct check for syn-ack
packet should be:

(tcp.flags() & (TCP::SYN | TCP::ACK)) == (TCP::SYN | TCP::ACK)

To simplify this kind of check, add new has_flags method:

bool TCP::has_flags(small_uint<12> check_flags) const

* remove duplicate TCP::SYN flag check
2019-03-14 18:18:12 -07:00
Jens Keim
2a8101eef3 add advertised_size method 2019-01-22 19:32:51 +01:00
Matias Fontanini
776ae4e83b Merge pull request #305 from christophert/master
Add comprehensive list of 802.11 Element IDs
2019-01-07 18:53:41 -08:00
Matias Fontanini
2158c7a92e Merge pull request #313 from fflexo/raw_ip
add support for libpcap's DLT_RAW link type
2019-01-07 18:49:10 -08:00
DDoSolitary
6c92bcdad1 Clarify pointer's validity for documentation of current_option_ptr(). 2018-12-25 10:38:44 +08:00
Teodoro Vargas
57ac099703 Fix serialization for QinQ (#316)
* Add QinQ Frame

* Fix serialization for QinQ
2018-10-09 14:02:01 -07:00
fflexo
eb7628eca4 add support for libpcap's DLT_RAW link type 2018-09-08 15:11:06 +01:00
Ulf Wetzker
c26e4943c2 Added base class access specifier for socket_close_error (#306) 2018-08-02 09:17:07 -07:00
Christopher Tran
7e90c8be6a add comprehensive list of Element IDs per 802.11-2016 9.4.2/T9-77 2018-07-26 13:29:23 -04:00
Kasper Laudrup
fa79582b89 Add parsing of well known IPv6 extension headers (#287)
* Add parsing of well known IPv6 extension headers

Add classes for IPv6 extension headers defined in the IPv6 protocol
specification (RFC 2460) as well as functions for creating them from
the IPv6 class' ext_header type.

The currently known extension headers are Hop-By-Hop Option,
Destination Routing, Routing and Fragment.

* Cleanup after PR #287 comments

Pull in stuff from the std namespace with "using" instead of
qualifying with std::.

Keep starting braces on the same line.

Avoid potential copy when appending to vector.
2018-03-28 21:05:01 -07:00
stubbfel
342e2c77a7 Add missing operators to address classes (#275)
* * add or-operator and a simlple unit test for hw_address, ip_address, ipv6_address
* add not-operator and a simlple unit test for hw_address, ip_address, ipv6_address
* add greater-then-operator and a simlple unit test for ipv6_address
* add new constructor and a simlple unit test for network_interface, which use a ipv6_address to find the nic
* add override the function gateway_from_ip for ipv6_address parameter (untested)

* change the ipv6_address in NotMaskAdress_Test, so that the expceted addresses are valid for the winsock api

* Delete CMakeLists.txt.user

* * add  <=, >, >= operator for HWAddress with tests

* add  <=, >, >= operator for IPv4Address with tests
* add  <=,>= operator for IPv6Address with tests

* refactoring the  & , |, ~ operator of ipv6_address to "regular" operator
2018-03-28 20:44:28 -07:00
Matias Fontanini
7848e28b62 Add version macros in config.h
Fixes #286
2018-03-20 18:50:42 -07:00
Matias Fontanini
f29566d6d9 Implement IPv6::recv_response 2018-02-25 10:42:16 -08:00
Ed Catmur
1038c6f7f3 Don't call &* on PDUIterator 2018-02-03 09:32:43 -08:00
Jeff Ebert
8efc0271f5 Don't include dot11.h in tins.h if it is not configured in the library (#277) 2018-02-03 09:31:24 -08:00
Matias Fontanini
f44b253a42 Fix memory leak in PDU's move assignment operator
Fixes #272
2017-12-14 14:42:46 -03:00
Matias Fontanini
8f85a6e557 Append padding to IPv6 options
Relates to #270
2017-12-12 10:33:17 -03:00
Matias Fontanini
a3dd057147 Use first IP fragment as base for reassembly
Fixes #225 for good
2017-12-03 13:50:02 -08:00
mavrikiy
39f3b24058 Fix dhcpv6::duid_type constructor from duid_ll (#266) 2017-11-06 09:29:57 -08:00
Santiago Alessandri
8e50756afa Add MPLS experimental field (#265)
* Add experimental field to MPLS PDU

See RFC-4950 https://tools.ietf.org/html/rfc4950

* Add tests for MPLS' experimental field
2017-11-04 12:08:34 -07:00
Ed Catmur
983325bfdf Ensure TCP::OptionTypes has 8-bit range (#259)
When reading TCP packets with esoteric (or corrupt) values for option types, the asan fsanitize=enum will trigger if the read value is not in range of the enum. The range of a classic (pre-C++11) enum with no negative enumerators is determined by the highest bit set in any of its enumerators, so if `TCP::OptionTypes` has highest enumerator `ALTCHK  = 14` it cannot take values above 15.

Define enumerators (per IANA) with bit 7 set to ensure that `TCP::OptionTypes` can take any 8-bit value.

An alternative (C++11 only) would be to give `TCP::OptionTypes` underlying type `uint8_t`.
2017-10-19 10:17:51 -07:00
Matias Fontanini
f4635a696e Fix build issues when disabling Dot11
Fixes #258
2017-10-18 06:40:51 -07:00
Alex Collins
04e29858ee Add RawPDU c'tor for const payload_type&. (#253)
* Add RawPDU c'tor for const payload_type &.

* Correct indentation.
2017-10-12 20:02:28 -07:00
juno0812
b43d2f74e4 Add getter/setter for more data field in Dot11Base (#252) 2017-10-04 07:03:17 -07:00
Matias Fontanini
f2766db829 Add IPv4/6Address::size member function 2017-10-01 20:38:54 -07:00
Matias Fontanini
db0fb7f20d Don't convert IPv6Address to string when hashing 2017-10-01 20:33:06 -07:00
Matias Fontanini
a6817528bc Use absolute include paths
Fixes #250
2017-09-21 20:48:57 -07:00
solvingj
a7dd867503 Fix hash<IPv4/6Address> build issues in VC
* fixed compile failure due to macro

* add functional to cxxstd.h to try to fix mac

* clang bug identified, moving functional include to later

* last step, move hash def to header

* avoid allocation on hash

* set ipv6 back to string hash
2017-09-19 19:00:28 -07:00
solvingj
e48f64daac Remove include directories CMakeLists files
* simply consolidate 6 files into 6 lines

* narrowed glob on inc and simplified
2017-09-14 09:32:27 -07:00
Matias Fontanini
171067eb22 Keep first fragment during IPv4 reassembly
Fixes #225
2017-09-10 16:39:15 -07:00
Christopher Tran
5df1c354f0 added cipher and akm suites from 802.11-2016 2017-08-12 13:34:13 -07:00
Matias Fontanini
eb0d82ce89 Add more documentation on partial stream following
Fixes #227
2017-08-05 19:21:21 -07:00
Matias Fontanini
f89e922d72 Add missing TINS_API on address types
Fixes #229
2017-08-05 19:12:12 -07:00
Andrea Barberio
87c0e3a337 Add set_pcap_sniffing_method to specify either pcap_loop or pcap_dispatch 2017-07-23 09:38:11 -07:00
Matias Fontanini
3e6e25d0aa Add support for XChannel field on RadioTap 2017-06-05 20:44:03 -07:00
Matias Fontanini
77ca5c2701 Add missing radiotap parsing fields 2017-06-05 20:44:03 -07:00
Matias Fontanini
2f528876ad Add back RadioTap::TSTF 2017-06-05 20:44:03 -07:00
Matias Fontanini
aa64e34880 Keep current flags as member in RadioTapParser 2017-06-05 20:44:03 -07:00
Matias Fontanini
5fcde41023 Use RadioTapParser/Writer in RadioTap 2017-06-05 20:44:03 -07:00
Matias Fontanini
63e22fc349 Add RadioTapWriter class 2017-06-05 20:44:03 -07:00
Matias Fontanini
7af1ec0984 Add some useful member functions to RadioTapParser 2017-06-05 20:44:03 -07:00
Matias Fontanini
4e95797710 Allow constructing RadioTapParser from an empty buffer 2017-06-05 20:44:03 -07:00
Matias Fontanini
a641589b09 Make RadioTapParser work using only the options buffer 2017-06-05 20:44:03 -07:00