Opened 4 weeks ago
Closed 4 weeks ago
Last modified 4 weeks ago
New minor version.
Fixed at commit 0a38b7cff5238b69a3290479aafceacfbad887a8
This one was kind of tricky
ndptool: add -T target support
Currently ndptool can send a Neighbour Solicitation, but does not target
an IP address, so the NS packet doesn't really make sense.
Extend ndptool to target a destination for Neighbour Solicitation.
1) remove function ipv6_addr_is_multicast()
2) inline some help functions.
3) update code style.
ndptool: fix target parameter typo
In my last commit acccd78 ("ndptool: add -T target support"), after
renaming parameter -d to -T. I forgot to change the name in switch opt.
libndp: close sockfd after using to avoid handle leak
libndp: fix nd_msg typo when setting target address
When setting the target address of nd_msg, I set the ns/na type reversed.
ndptool: add -D dest support
This patch add -D dest option, with this option a user could set the dest
address in IPv6 header for solicited NS/NA message
For function ndp_msg_addrto_adjust_solicit_multi(), I moved the check
in ndp_msg_target_set() instead of in the function itself.
I also use reverse christmas tree variable order in the main() function
ndptool: fix potential memory leak caused by strdup
We use strdup to copy the parameters. As strdup will call malloc when
obtain the memory, we need to free them before exit, or there will be
memory leak. This is found by covscan.
ndptool: fix printing dnssl lifetime in ndptool
ndptool: don't use static variable for local context in msgrcv_handler_func()
ndptool is single threaded, so this isn't an actual issue. But
it's ugly and unnecessary.
libndp: use thread local variables for static return arguments
libndp should be thread safe. That doesn't mean, that one "struct ndp"
can be used by multiple threads without locking. But it should be
reasonably possible to use the library in a multi threaded scenario.
Some API functions return values that are cached in static variables.
That makes these function (and the entire library) not thread safe.
Fix that by using gcc's __thread specifier for thread local storage.
This is also supported by clang.
Currently, it's not clear whether all compiler that libndp supports,
support this. I expect that to be the case. Hence, the NDP_THREAD define
does not try to workaround such (yet unknown) build environments. However,
if the need arises, we can easily extend the NDP_THREAD define with some
ndptool: avoid static buffer for string in ndptool
ndptool is of single threaded, so there is no actual problem here.
However, I think it not best to use static variables, and in
this case it can be easily avoided.
libndp: avoid static buffer for debug string in ndp_sock_recv()
libndp should be thread safe. There is really no need to use a
static buffer in this case.
libndp,ndptool: use poll() instead of select()
select() doesn't support file descriptors greater than 1023. If the
program has many files open, the socket descriptor can be > 1023 and
then FD_SET(fd, &rfds) causes a buffer overflow.
Switch to poll() and ppoll() which don't have this limitation.
Powered by Trac 1.5.3.dev0
By Edgewall Software
© 1998-2021 Gerard Beekmans.