You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (0==memcmp(&cmp_addr, ¤t->address, sizeof(structin6_addr))) {
I hope that when sysctl net.ipv6.ip_nonlocal_bind=1 is set, AdvRASrcAddress can directly set iface->props.if_addr_rasrc whatever it is a valid link local addresses or not .
Reason:
It maybe a rare case . My VPS provider offers an IPv6 Prefix to a machine. I want to set SLAAC in that machine.
when i use normal radvd.conf ,I can get an IPv6 address , but i must set a gateway manually to fe80::1 to make the connection work. (maybe related to https://serverfault.com/a/1069528).
Because the RA message is sent in the just same machine to itself , so it takes self link local address as gateway.
Then I found AdvRASrcAddress option , but when i set AdvRASrcAddress { fe80::1 ; }; , radvd refuse to work saying interface eth0 does not exist or is not set up properly, ignoring the interface because of no configured AdvRASrcAddress present, skipping send.
Finally, I tried short circuit the code and set sysctl net.ipv6.ip_nonlocal_bind=1
diff --git a/device-common.c b/device-common.c
index 77a9e77..46d5316 100644
--- a/device-common.c+++ b/device-common.c@@ -179,6 +179,8 @@ int setup_iface_addrs(struct Interface *iface)
for (struct AdvRASrcAddress *current = iface->AdvRASrcAddressList; current; current = current->next) {
for (int i = 0; i < iface->props.addrs_count; i++) {
struct in6_addr cmp_addr = iface->props.if_addrs[i];
+ iface->props.if_addr_rasrc = ¤t->address;+ break;
if (0 == memcmp(&cmp_addr, ¤t->address, sizeof(struct in6_addr))) {
addrtostr(&(cmp_addr), addr_str, sizeof(addr_str));
dlog(LOG_DEBUG, 4, "AdvRASrcAddress selecting: %s", addr_str);
And it works. I can do SLAAC and the gateway is fe80::1 and connection works.
The text was updated successfully, but these errors were encountered:
That's a creative solution, but I have a better suggestion, borrowed from HAProxy's transparent option:
Foreign sockets
IPV6_TRANSPARENT (Linux) / IP_FREEBIND (Linux,FreeBSD?) / IPV6_BINDANY (NetBSD,FreeBSD?) / SO_BINDANY (OpenBSD)
This would be set as a configuration option, per-interface, and then the kernel should just accept the values set, and permit it on a per-interface basis, which is safer than the sysctl, and more portable.
current AdvRASrcAddress will only be used when matched one of valid link local addresses.
radvd/device-common.c
Line 182 in b368cb9
I hope that when sysctl
net.ipv6.ip_nonlocal_bind=1
is set, AdvRASrcAddress can directly set iface->props.if_addr_rasrc whatever it is a valid link local addresses or not .Reason:
It maybe a rare case . My VPS provider offers an IPv6 Prefix to a machine. I want to set SLAAC in that machine.
when i use normal radvd.conf ,I can get an IPv6 address , but i must set a gateway manually to
fe80::1
to make the connection work. (maybe related to https://serverfault.com/a/1069528).Because the RA message is sent in the just same machine to itself , so it takes self link local address as gateway.
Then I found
AdvRASrcAddress
option , but when i setAdvRASrcAddress { fe80::1 ; };
, radvd refuse to work sayinginterface eth0 does not exist or is not set up properly, ignoring the interface
because ofno configured AdvRASrcAddress present, skipping send
.Finally, I tried short circuit the code and set
sysctl net.ipv6.ip_nonlocal_bind=1
And it works. I can do SLAAC and the gateway is
fe80::1
and connection works.The text was updated successfully, but these errors were encountered: