Commit Graph

24 Commits

Author SHA1 Message Date
Tobias Brunner 8cd5f33dd8 libipsec: Fix compiler warning with GCC 9
The compiler complains that "taking address of packed member ... of
class or structure 'ip6_hdr' may result in an unaligned pointer value".
We don't care if the address is aligned as we explicitly use untoh16()
to convert the read value.
2019-08-28 11:10:49 +02:00
Tobias Brunner 1b67166921 Unify format of HSR copyright statements 2018-05-23 16:32:53 +02:00
Matus Fabian 04ede658c8 libipsec: Fix ip_packet_create_from_data() version field in IPv6 header
Closes strongswan/strongswan#92.

Signed-off-by: Matus Fabian <matfabia@cisco.com>
2018-03-19 11:01:10 +01:00
Tobias Brunner bdcaca76c5 ip-packet: Correctly determine protocol in fragmented IPv6 packets
We don't attempt to parse the transport headers for fragments, not even
for the initial fragment (it's not guaranteed they contain the header,
depending on the number and type of extension headers).
2017-09-18 10:28:54 +02:00
Tobias Brunner b3cc46381d ip-packet: Fix "packet too short" error when parsing fragmented IPv4 packets
Only attempt to parse the transport header of an IPv4 packet if it's
not fragmented or the first fragment.
2017-09-18 10:28:54 +02:00
Tobias Brunner 1da567734f libipsec: Fix Windows build via MinGW
Fixes #2118.
2017-01-25 17:12:30 +01:00
Andreas Steffen b12c53ce77 Use standard unsigned integer types 2016-03-24 18:52:48 +01:00
Tobias Brunner 9e20fdbaf6 ip-packet: Fix length in IPv6 header of generated packets 2014-10-20 15:33:35 +02:00
Tobias Brunner 15dee933de ip-packet: Fix removal of TFC padding for IPv6
The IPv6 length field denotes the payload length after the 40 bytes header.

Fixes: 293515f95c ("libipsec: remove extra RFC4303 TFC padding appended to inner payload")
2014-10-14 14:10:33 +02:00
Tobias Brunner f8613abc8a ip-packet: Define our own structs to handle TCP/UDP headers 2014-09-09 10:56:15 +02:00
Tobias Brunner 16e519d42c ip_packet: Add function to easily encode UDP packets 2014-07-22 11:10:35 +02:00
Tobias Brunner 108a67893f ip_packet: Apply transport protocol ports when encoding IP packet 2014-07-22 11:10:35 +02:00
Tobias Brunner 46bb36980b ip_packet: Add getter for IP payload 2014-07-22 11:10:35 +02:00
Tobias Brunner d56d9a45d4 ip_packet: Allow creation of IP packets from data 2014-07-22 11:10:35 +02:00
Tobias Brunner a10eb93566 ip_packet: Parse ports from TCP and UDP headers 2014-07-22 11:10:35 +02:00
Martin Willi 5f35b73344 libipsec: Avoid name clash with sched.h clone() 2014-06-04 15:53:01 +02:00
Martin Willi 293515f95c libipsec: remove extra RFC4303 TFC padding appended to inner payload 2013-10-11 10:23:17 +02:00
Martin Willi 2b84ccd6a6 libipsec: fix memory management when cloning ip_packet 2013-09-13 13:56:44 +02:00
Tobias Brunner ae8ac58c45 Fix detection and use of netinet/ip6.h on FreeBSD 2013-03-27 09:56:48 +01:00
Tobias Brunner f05b427265 Moved debug.[ch] to utils folder 2012-10-24 16:00:51 +02:00
Tobias Brunner 43e0cb6519 Fix parsing of IPv6 headers in ip_packet_t 2012-09-28 15:15:07 +02:00
Tobias Brunner 39e9af9666 struct iphdr is Linux specific use struct ip instead 2012-08-29 15:32:26 +02:00
Tobias Brunner b6a071514a Fixed ip_packet_t if IPv6 is not available 2012-08-08 15:41:03 +02:00
Tobias Brunner 2dd47c2442 ip_packet_t parses the header of IP packets 2012-08-08 15:41:03 +02:00