| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
libnet_if_addr.c(467): error C2082: redefinition of formal parameter 'dev'
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
|
|
|
| |
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
|
|
|
| |
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
|
|
|
| |
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
|
|
|
|
|
| |
Affects all non-Linux/OpenBSD and non-Windows platforms.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
|
|
|
|
|
| |
Simplifies code a lot and we never risk leaking memory.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
|
|
|
|
|
| |
Only used in libnet_if_addr.c and never documented as a public API.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
|
|
|
| |
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
|
|
|
| |
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
|
|
|
| |
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
|
|
|
| |
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
| |
https://github.com/libnet/libnet/commit/4059e2ef7f277b962dc4a93bd2df9445361c7cca#r54752736
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
|
|
|
|
|
|
|
|
|
| |
- Four space indent
- Braces on their own row, not cuddled
- No need for braces if only one statement, like return/goto
- Space between if and its parenthesis
- Variable decl. at top of function or block
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|\
| |
| | |
Fix unused parameter warnings
|
| |
| |
| |
| | |
Signed-off-by: Valery Ivanov <ivalery111@gmail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
libnet_cq.c:139:18: warning: dereference of possibly-NULL ‘new_18’ [CWE-690] [-Wanalyzer-possible-null-dereference]
139 | new->context = l;
| ~~~~~~~~~~~~~^~~
‘libnet_cq_add.part.0’: events 1-6
|
| 71 | libnet_cq_add(libnet_t *l, char *label)
| | ^~~~~~~~~~~~~
| | |
| | (1) entry to ‘libnet_cq_add.part.0’
|......
| 89 | if (label == NULL)
| | ~
| | |
| | (2) following ‘false’ branch (when ‘label_1(D)’ is non-NULL)...
|......
| 97 | if (l_cq == NULL)
| | ~~ ~
| | | |
| | | (4) following ‘false’ branch...
| | (3) ...to here
|......
| 124 | if (libnet_cq_dup_check(l, label))
| | ~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | | |
| | | (6) calling ‘libnet_cq_dup_check’ from ‘libnet_cq_add.part.0’
| | (5) ...to here
|
+--> ‘libnet_cq_dup_check’: events 7-13
|
| 269 | libnet_cq_dup_check(libnet_t *l, char *label)
| | ^~~~~~~~~~~~~~~~~~~
| | |
| | (7) entry to ‘libnet_cq_dup_check’
|......
| 273 | for (p = l_cq; p; p = p->next)
| | ~ ~~~~~~~~~~~
| | | |
| | | (13) ...to here
| | (8) following ‘true’ branch (when ‘p_6’ is non-NULL)...
| 274 | {
| 275 | if (p->context == l)
| | ~~ ~
| | | |
| | | (10) following ‘false’ branch...
| | (9) ...to here
|......
| 281 | if (strncmp(p->context->label, label, LIBNET_LABEL_SIZE) == 0)
| | ~~ ~
| | | |
| | | (12) following ‘false’ branch...
| | (11) ...to here
|
<------+
|
‘libnet_cq_add.part.0’: events 14-20
|
| 124 | if (libnet_cq_dup_check(l, label))
| | ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | ||
| | |(14) returning to ‘libnet_cq_add.part.0’ from ‘libnet_cq_dup_check’
| | (15) following ‘false’ branch...
|......
| 130 | new = (libnet_cq_t *)malloc(sizeof (libnet_cq_t));
| | ~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | | |
| | | (17) this call could return NULL
| | (16) ...to here
| 131 | if (l_cq == NULL)
| | ~
| | |
| | (18) following ‘false’ branch...
|......
| 139 | new->context = l;
| | ~~~~~~~~~~~~~~~~
| | | |
| | | (20) ‘new_18’ could be NULL: unchecked value from (17)
| | (19) ...to here
|
Signed-off-by: Adrian Reber <areber@redhat.com>
|
| |
| |
| |
| | |
Signed-off-by: Adrian Reber <areber@redhat.com>
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes:
libnet_port_list.c:99:8: warning: leak of ‘_8’ [CWE-401] [-Wanalyzer-malloc-leak]
99 | if (!all_lists)
| ^
‘libnet_plist_chain_new’: events 1-3
|
| 48 | if (l == NULL)
| | ^
| | |
| | (1) following ‘false’ branch (when ‘l_70(D)’ is non-NULL)...
|......
| 53 | if (token_list == NULL)
| | ~~ ~
| | | |
| | | (3) following ‘false’ branch (when ‘token_list_71(D)’ is non-NULL)...
| | (2) ...to here
|
‘libnet_plist_chain_new’: event 4
|
|cc1:
| (4): ...to here
|
‘libnet_plist_chain_new’: events 5-9
|
| 83 | *plist = malloc(sizeof (libnet_plist_t));
| | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (5) allocated here
| 84 |
| 85 | if (!(*plist))
| | ~
| | |
| | (6) assuming ‘*plist_74(D)’ is non-NULL
| | (7) following ‘false’ branch...
|......
| 93 | tmp = *plist;
| | ~~~
| | |
| | (8) ...to here
|......
| 99 | if (!all_lists)
| | ~
| | |
| | (9) ‘_8’ leaks here; was allocated at (5)
|
Signed-off-by: Adrian Reber <areber@redhat.com>
|
|
|
|
|
| |
According to getifaddrs man page, ifa_addr can be NULL. Skip
such interfaces to avoid NULL dereference.
|
|\
| |
| | |
Major license change: 4-clause BSD to 3-clause BSD
|
| |
| |
| |
| | |
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
|
| |
| |
| |
| | |
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This patch adopts the 3-clause BSD license for all src/libnet_link_*.c
files previously under the 4-clause BSD license. Effectively this drops
the "obnoxious" advertising clause which is usually what is under most
contention when BSD licenses are discussed.
For a background, the https://en.wikipedia.org/wiki/BSD_licenses page
provides an interesting read. Briefly, in 1999 Berkeley rescinded the
original 3rd clause (see below) leading to a change in major software
projects to, not only adopt this new BSD license, but also renumber
the listed provisions.
Ref. ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
|
| |
| |
| |
| | |
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
|
| | |
|
|\ \
| | |
| | | |
Clean up some signed/unsigned comparisons
|
| |/ |
|
|\ \
| | |
| | | |
Cast pointer to (void*) to silence -Wextra warning
|
| |/ |
|
|/ |
|
|
|
|
| |
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
|
|
|
|
| |
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
|