summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #161 from ivalery111/3-introduce-udld-supportHEADmasterJoachim Wiberg2023-05-0418-2/+1957
|\ | | | | | | | | UDLD protocol support Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
| * udld: initial supportValery Ivanov2023-05-0316-2/+1942
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary of changes: - Complete UDLD protocol support was added according to RFC5171 - UDLD checksum implementation was added - UDLD unit tests were added - CI has been updated to run UDLD unit tests That's how sample/udld looks in tcpdump: tcpdump: listening on lo0, link-type EN10MB (Ethernet), capture size 262144 bytes 06:23:33.536964 UDLDv1, Code Probe message (1), Flags [RT, RSY] (0x03), length 60 Checksum 0x6d85 (unverified) Device-ID TLV (0x0001) TLV, length 15, FOC1031Z7JG Port-ID TLV (0x0002) TLV, length 9, Gi0/1 Echo TLV (0x0003) TLV, length 8, ^@^@^@^@ Message Interval TLV (0x0004) TLV, length 5, 7s Timeout Interval TLV (0x0005) TLV, length 5, 5s Device Name TLV (0x0006) TLV, length 6, S1 Sequence Number TLV (0x0007) TLV, length 8, 1 0x0000: 2103 6d85 0001 000f 464f 4331 3033 315a !.m.....FOC1031Z 0x0010: 374a 4700 0200 0947 6930 2f31 0003 0008 7JG....Gi0/1.... 0x0020: 0000 0000 0004 0005 0700 0500 0505 0006 ................ 0x0030: 0006 5331 0007 0008 0000 0001 ..S1........ Signed-off-by: Valery Ivanov <ivalery111@gmail.com>
| * tests: fetch header/packet without advanced modeValery Ivanov2023-05-022-0/+15
| | | | | | | | | | | | | | | | Sometimes it's necessary to obtain a header or packet for unit testing. This possible only in advanced mode. The advanced mode requires sudo. This limitation is not necessary for unit testing. Signed-off-by: Valery Ivanov <ivalery111@gmail.com>
* | Merge pull request #159 from uniontech-lilinjie/masterJoachim Wiberg2023-04-0420-24/+24
|\ \ | | | | | | | | | | | | fix typos Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
| * | fix typoslilinjie2023-04-0420-24/+24
|/ / | | | | | | Signed-off-by: lilinjie <lilinjie@uniontech.com>
* | Merge pull request #156 from herveboisse/remove_sock_packetJoachim Wiberg2023-01-184-108/+0
|\ \ | |/ | | | | | | Remove support for SOCK_PACKET sockets Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
| * Remove support for SOCK_PACKET socketsHervé Boisse2023-01-174-108/+0
|/ | | | | | | | | | | | | | | | The current code has a build-time check to verify that PF_PACKET sockets are supported on Linux systems and if not, fallback on SOCK_PACKET sockets. The test implementation relies on FTM (Feature Test Macros) to detect glibc and its version to include correct headers. But, some libc such as the musl libc do not have such macros, making the test program compilation fail and libnet fallback on SOCK_PACKET. Since PF_PACKET support is present in kernel for more than 20 years now, the simplest solution and safe choice is to just drop support for SOCK_PACKET and assume PF_PACKET is always available on any Linux system. Signed-off-by: Hervé Boisse <admin@netgeek.ovh>
* Refresh configure.ac, AC_TRY_COMPILE is obsoleteJoachim Wiberg2023-01-011-7/+5
| | | | Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
* Bump copyright yearsJoachim Wiberg2022-12-311-1/+1
| | | | Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
* Extract version from new file VERSION, for the benefit of win32Joachim Wiberg2022-12-313-2/+4
| | | | | | | Use the same source of all version information instead of hard-coding it everywhere, and then having to update if for every releae cycle. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
* win32: encode version in DLL instead of in filenameJoachim Wiberg2022-12-311-1/+1
| | | | | | | Most Windows DLL files have their version encoded in the DLL not in their filename, e.g., the Npcap library. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
* win32: build in parallelJoachim Wiberg2022-12-311-1/+1
| | | | Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
* .github: enable matrix bulder for 32/64-bit buildsJoachim Wiberg2022-12-312-9/+7
| | | | Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
* .github: archive DLL files after each buildJoachim Wiberg2022-12-311-0/+5
| | | | Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
* win32: add error handling after calling cl and linkJoachim Wiberg2022-12-311-9/+19
| | | | Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
* win32: generalize and clean up batch file a bitJoachim Wiberg2022-12-312-56/+37
| | | | Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
* Drop appveyor for win32 builds in favor of GitHub actionsJoachim Wiberg2022-12-311-11/+0
| | | | Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
* win32: test x86_64 arch in dll linkingJoachim Wiberg2022-12-311-9/+4
| | | | Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
* win32: add missing ssize_t definitionJoachim Wiberg2022-12-311-0/+5
| | | | | | See https://www.scivision.dev/ssize_t-visual-studio-posix/ Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
* win32: try using the default msvc stdint.hJoachim Wiberg2022-12-314-250/+5
| | | | Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
* win32: change to npcap-sdk everywhereJoachim Wiberg2022-12-312-17/+14
| | | | Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
* switch to npcap and set a fixed install directory for libs & headersJoachim Wiberg2022-12-312-3/+4
| | | | Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
* .github: use zip file directory, don't create another levelJoachim Wiberg2022-12-311-1/+1
| | | | Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
* win32: search for path to VC ToolsJoachim Wiberg2022-12-311-11/+19
| | | | | | - convert to Visual Studio 2017 using vswhere Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
* .github: spellcheckJoachim Wiberg2022-12-311-1/+1
| | | | Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
* .github: prototype windows action to replace appveyorJoachim Wiberg2022-12-311-0/+20
| | | | Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
* Fix win32 regression introduced in 36e96bfJoachim Wiberg2022-12-311-2/+2
| | | | | | libnet_if_addr.c(467): error C2082: redefinition of formal parameter 'dev' Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
* Follow-up to 6954544: update license in man pages and dll infoJoachim Wiberg2022-12-302-2/+2
| | | | Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
* src: alllow returning lo when dev i set also on Linux and OpenBSDJoachim Wiberg2022-12-301-4/+2
| | | | | | | | | | The other (older) implementations of libnet_ifaddrlist() explicitly check if dev is unset before discarding any loopback interface. This patch adds the same behavior to the Linux and OpeBSD backends for consistency. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
* src: minor, fix parametner unused in windows backendJoachim Wiberg2022-12-301-1/+3
| | | | Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
* src: fix signed vs unsigned comparison warning, found by appveyorJoachim Wiberg2022-12-301-13/+11
| | | | Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
* src: refactor non-linux & non-windows libnet_ifadrrlist()Joachim Wiberg2022-12-301-67/+136
| | | | | | | | | Split the non-linux HAVE_LINUX_PROCFS non-windows libnet_ifadrrlist() in two functions for readability. It is very unclear atm. which OS this might actually be, new function tested on Linux. The remaining, cleaned up non-HAVE_LINUX_PROCFS version is what runs on FreeBSD and macOS. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
* src: minor cleanup, for consistency in variable useJoachim Wiberg2022-12-301-10/+7
| | | | Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
* src: simplify and align different libnet_ifaddrlist() backendsJoachim Wiberg2022-12-301-20/+21
| | | | Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
* src: drop useless call to free() on not yet allocated pointerJoachim Wiberg2022-12-301-2/+0
| | | | | | Affects all non-Linux/OpenBSD and non-Windows platforms. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
* src: ensure ifaddrlist is always freedJoachim Wiberg2022-12-301-27/+20
| | | | | | Simplifies code a lot and we never risk leaking memory. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
* include: drop internal-only ifaddrlist.h includeJoachim Wiberg2022-12-303-60/+16
| | | | | | Only used in libnet_if_addr.c and never documented as a public API. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
* De-register, compiler knows bestJoachim Wiberg2022-12-297-34/+29
| | | | Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
* .github: bump actions to latest versionsJoachim Wiberg2022-12-282-4/+4
| | | | | | | This hopefully fixes the problems with the FreeBSD builder. Apparently they recommend using v0 instead of the latest release (v0.3.0). Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
* Follow-up to f035f60: ignore lldp binaryJoachim Wiberg2022-12-281-0/+1
| | | | Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
* Follow-up to 8b4688c: fix regression on WindowsJoachim Wiberg2022-12-281-10/+39
| | | | | | | | | | | | libnet has multiple libnet_ifaddrlist(), one for each OS family. The changes in PR #150, fixing the aribtrary MAX IP address limit on LInux, unfortunately broke all other operating systems. This is a specualtive change for the Windows operating system, untested. Issue #150 Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
* Follow-up to 8b4688c: fix regression on macOSJoachim Wiberg2022-12-281-4/+26
| | | | | | | | | | | | | libnet has multiple libnet_ifaddrlist(), one for each OS family. The changes in PR #150, fixing the aribtrary MAX IP address limit on LInux, unfortunately broke all other operating systems. This change is for the "other" operating system that are not Windows. Tested on macOS. Issue #150 Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
* libnet_destroy(): verify l->device is a pointer before calling freeJoachim Wiberg2022-12-281-1/+2
| | | | Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
* src: simplify, exit earlyJoachim Wiberg2022-12-281-2/+1
| | | | Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
* src: reduce code duplication and protect against NULL ptr derefJoachim Wiberg2022-12-281-14/+13
| | | | Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
* src: minor coding style cleanupJoachim Wiberg2022-12-282-54/+42
| | | | Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
* Merge pull request #150 from aroulin/fix-segfault-ifaddrlistJoachim Wiberg2022-11-231-2/+24
|\ | | | | | | | | libnet_if_addr.c: fix segfault when number of IPs > 512 Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
| * libnet_if_addr.c: fix segfault when number of IPs > 512Andy Roulin2022-11-231-2/+24
|/ | | | | | | | | | | | The current code has a hardcoded limit of 512 IP addresses. The static array will be overflowed when more addresses are present. Fix the static limit by using realloc when the array needs to grow to accomodate more interfaces. Growing the array by a factor of 1.5 each time (close to golden ratio) to maximize reuse of previously allocated space.
* Merge pull request #148 from beni-sandu/masterJoachim Wiberg2022-09-264-37/+35
|\ | | | | | | | | libnet_raw: don't change the TX buffer size for raw sockets Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
| * libnet_raw: don't change the TX buffer size for raw socketsBeniamin Sandu2022-09-264-37/+35
|/ | | | | | | | Instead of trying to set the max TX buffer size for every raw socket, export this to a separate interface that can be used when needed, called libnet_setfd_max_sndbuf(). Signed-off-by: Beniamin Sandu <beniaminsandu@gmail.com>