jpirko / libndp Goto Github PK
View Code? Open in Web Editor NEWNeighbor Discovery library
License: GNU Lesser General Public License v2.1
Neighbor Discovery library
License: GNU Lesser General Public License v2.1
The current logic will be:
if this is NA, the ns message target will be set. If this NS, the na message target will be set. Even the result is correct, that's because they share the similar data structure. But I assume there are some mistake here. Can the owner confirm? Here is a change example.
$ git diff
diff --git a/libndp/libndp.c b/libndp/libndp.c
index bec55d4..84cb1d9 100644
--- a/libndp/libndp.c
+++ b/libndp/libndp.c
@@ -713,7 +713,7 @@ void ndp_msg_target_set(struct ndp_msg *msg, struct in6_addr *target)
enum ndp_msg_type msg_type = ndp_msg_type(msg);
switch (msg_type) {
case NDP_MSG_NS:
- ((struct ndp_msgna*)&msg->nd_msg)->na->nd_na_target = *target;
+ ((struct ndp_msgns*)&msg->nd_msg)->ns->nd_ns_target = *target;
/*
* Neighbor Solicitations are multicast when the node
* needs to resolve an address and unicast when the
@@ -727,7 +727,7 @@ void ndp_msg_target_set(struct ndp_msg *msg, struct in6_addr *target)
ndp_msg_addrto_adjust_solicit_multi(&msg->addrto, target);
break;
case NDP_MSG_NA:
- ((struct ndp_msgns*)&msg->nd_msg)->ns->nd_ns_target = *target;
+ ((struct ndp_msgna*)&msg->nd_msg)->na->nd_na_target = *target;
break;
default:
break;
I noticed you are adding -T support in last change. But there is a place you missed, line 424 of ndptool.c:
case 'd':
free(addr);
addr = strdup(optarg);
break;
I believe this should be case 'T'
libndp.c:212:43: warning: incompatible pointer types passing 'struct sockaddr_in6 *' to parameter of type 'const struct sockaddr *' [-Wincompatible-pointer-types]
ret = sendto(sockfd, buf, buflen, flags, &sin6, sizeof(sin6));
^~~~~
/usr/include/sys/socket.h:702:42: note: passing argument to parameter here
size_t, int, const struct sockaddr *, socklen_t);
^
libndp.c:295:8: error: no member named 's6_addr32' in 'struct in6_addr'
addr->s6_addr32[0] = htonl(0xFF020000);
~~~~ ^
libndp.c:296:8: error: no member named 's6_addr32' in 'struct in6_addr'
addr->s6_addr32[1] = 0;
~~~~ ^
libndp.c:297:8: error: no member named 's6_addr32' in 'struct in6_addr'
addr->s6_addr32[2] = 0;
~~~~ ^
libndp.c:298:8: error: no member named 's6_addr32' in 'struct in6_addr'
addr->s6_addr32[3] = htonl(0x1);
~~~~ ^
libndp.c:307:8: error: no member named 's6_addr32' in 'struct in6_addr'
addr->s6_addr32[0] = htonl(0xFF020000);
~~~~ ^
libndp.c:308:8: error: no member named 's6_addr32' in 'struct in6_addr'
addr->s6_addr32[1] = 0;
~~~~ ^
libndp.c:309:8: error: no member named 's6_addr32' in 'struct in6_addr'
addr->s6_addr32[2] = 0;
~~~~ ^
libndp.c:310:8: error: no member named 's6_addr32' in 'struct in6_addr'
addr->s6_addr32[3] = htonl(0x2);
~~~~ ^
libndp.c:319:8: error: no member named 's6_addr32' in 'struct in6_addr'
addr->s6_addr32[0] = htonl(0xFF020000);
~~~~ ^
libndp.c:320:8: error: no member named 's6_addr32' in 'struct in6_addr'
addr->s6_addr32[1] = 0;
~~~~ ^
libndp.c:321:8: error: no member named 's6_addr32' in 'struct in6_addr'
addr->s6_addr32[2] = htonl(0x1);
~~~~ ^
libndp.c:322:8: error: no member named 's6_addr32' in 'struct in6_addr'
addr->s6_addr32[3] = htonl(0xFF000000) | target->s6_addr32[3];
~~~~ ^
libndp.c:322:51: error: no member named 's6_addr32' in 'struct in6_addr'
addr->s6_addr32[3] = htonl(0xFF000000) | target->s6_addr32[3];
~~~~~~ ^
libndp.c:774:20: error: use of undeclared identifier 'SIOCGIFHWADDR'
if (ioctl(sockfd, SIOCGIFHWADDR, &ifr) < 0) {
^
libndp.c:780:19: error: no member named 'ifr_hwaddr' in 'struct ifreq'
memcpy(ptr, &ifr.ifr_hwaddr.sa_data, sizeof(ifr.ifr_hwaddr.sa_data));
~~~ ^
libndp.c:780:50: error: no member named 'ifr_hwaddr' in 'struct ifreq'
memcpy(ptr, &ifr.ifr_hwaddr.sa_data, sizeof(ifr.ifr_hwaddr.sa_data));
~~~ ^
libndp.c:979:43: error: use of undeclared identifier 'ND_RA_FLAG_HOME_AGENT'
return msgra->ra->nd_ra_flags_reserved & ND_RA_FLAG_HOME_AGENT;
^
libndp.c:993:38: error: use of undeclared identifier 'ND_RA_FLAG_HOME_AGENT'
msgra->ra->nd_ra_flags_reserved |= ND_RA_FLAG_HOME_AGENT;
^
libndp.c:995:39: error: use of undeclared identifier 'ND_RA_FLAG_HOME_AGENT'
msgra->ra->nd_ra_flags_reserved &= ~ND_RA_FLAG_HOME_AGENT;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
FreeBSD 13.1
Hi,
I have multiple IPs in my interface:
12: vlan40@ens3f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP qlen 1000
link/ether 52:54:00:56:48:ab brd ff:ff:ff:ff:ff:ff
inet6 2001:db8:cafe:d::5/64 scope global
valid_lft forever preferred_lft forever
inet6 2001:db8:cafe:d::7/64 scope global
valid_lft forever preferred_lft forever
inet6 fe80::5054:ff:fe56:48ab/64 scope link
valid_lft forever preferred_lft forever
It seems that with ndptool only the primary IP is being announced. Is my understanding correct? So ndptool does not yet support announcing multiple IPs for the interface?
The icmpv6 socket ist neither made nonblocking via O_NONBLOCK nor is recvfrom(2) passed MSG_DONTWAIT.
One cloud of course make the the fd nonblocking after retrieving it via ndp_get_eventfd() and
check -EAGAIN on ndp_callall_eventfd_handler(). Is that how it's supposed to work?
I saw the NetworkManager code ignore the return of ndp_callall_eventfd_handler() altogether.
This broke NetworkManager: http://build.gnome.org/continuous/buildmaster/builds/2016/03/10/21/build/log-NetworkManager.txt
For now I've "frozen" libndp: https://git.gnome.org/browse/gnome-continuous/commit/?id=8481fb467e1250b4c4a73237e091922e63dfaff5
At building 1.8 (Gentoo downstream bug report: https://bugs.gentoo.org/922613) and also at building from git-master with GCC 14 I get:
# make
Making all in include
make[1]: Entering directory '/root/builddir/libndp/include'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/root/builddir/libndp/include'
Making all in libndp
make[1]: Entering directory '/root/builddir/libndp/libndp'
CC libndp_la-libndp.lo
libndp.c: In function 'mysendto6':
libndp.c:212:50: error: passing argument 5 of 'sendto' from incompatible pointer type [-Wincompatible-pointer-types]
212 | ret = sendto(sockfd, buf, buflen, flags, &sin6, sizeof(sin6));
| ^~~~~
| |
| struct sockaddr_in6 *
In file included from libndp.c:27:
/usr/include/sys/socket.h:396:49: note: expected 'const struct sockaddr *' but argument is of type 'struct sockaddr_in6 *'
396 | ssize_t sendto (int, const void *, size_t, int, const struct sockaddr *, socklen_t);
| ^~~~~~~~~~~~~~~~~~~~~~~
make[1]: *** [Makefile:452: libndp_la-libndp.lo] Error 1
make[1]: Leaving directory '/root/builddir/libndp/libndp'
make: *** [Makefile:390: all-recursive] Error 1
Building was done on my Talos II on my ppc32/musl chroot.
config.log attached.
config.log
ndp_sock_open() sould probably set O_CLOEXEC, either via socket(2) or a separate fcntl(2) call depending on portability requirements.
Support for RFC 8781 - Discovering PREF64 in Router Advertisements, would be a nice addition. It can supply address prefix used to translate IPv4 address into working IPv6 address used for 464xlat. If there would be local DNSSEC validating resolver, it needs to know this used range to accept their synthetizations.
As you may know already, if we don't use -T or in previously version (v1.7 and before), this command totally not working because tgt address is "::", such like:
ndptool -t na -U -i eth1 send
The tcpdump result will be:
08:25:06.902409 IP6 (hlim 255, next-header ICMPv6 (58) payload length: 32) toolkit-vm.localdomain > ff02::1: [icmp6 sum ok] ICMP6, neighbor advertisement, length 32, tgt is ::, Flags [override]
destination link-address option (2), length 8 (1): fa:16:3e:03:c1:c2
So, my idea is that, -T should be optional parameter, it -T specified, the behavior should be the same as now. When -T is not offered and also in previously release, ndptool should loop for each IPv6 on this interface and send unsolicited NA one by one.
BR,
Larry
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.