Page MenuHomeFreeBSD

D51292.id160176.diff
No OneTemporary

D51292.id160176.diff

diff --git a/usr.sbin/rtadvd/config.c b/usr.sbin/rtadvd/config.c
--- a/usr.sbin/rtadvd/config.c
+++ b/usr.sbin/rtadvd/config.c
@@ -331,6 +331,37 @@
return (0);
}
+void expand_linklocal_rdnss_address(struct ifinfo *ifi)
+{
+ struct ifaddrs *ifaddr, *ifa;
+ if (getifaddrs(&ifaddr) == -1) {
+ perror("getifaddrs");
+ return;
+ }
+
+ for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
+ struct sockaddr_in6 *current_addr =
+ (struct sockaddr_in6 *) ifa->ifa_addr;
+
+ if (ifa->ifa_addr->sa_family != AF_INET6)
+ continue;
+ if (strcmp(ifa->ifa_name, ifi->ifi_ifname))
+ continue;
+ if (!IN6_IS_ADDR_LINKLOCAL(&(current_addr->sin6_addr)))
+ continue;
+
+ if (inet_ntop(AF_INET6, &(current_addr->sin6_addr), abuf, INET6_ADDRSTRLEN)) {
+ syslog(LOG_INFO, "<%s> using link-local address %s for rdnss on %s",
+ __func__, abuf, ifi->ifi_ifname);
+ break;
+ }
+ }
+ freeifaddrs(ifaddr);
+ if (!ifa)
+ syslog(LOG_WARNING, "<%s> found LINKLOCAL keyword, no suitable address found for %s",
+ __func__, ifi->ifi_ifname);
+}
+
struct ifinfo *
getconfig(struct ifinfo *ifi)
{
@@ -826,6 +857,11 @@
c = strcspn(ap, ",");
strncpy(abuf, ap, c);
abuf[c] = '\0';
+
+ if (strcmp(abuf, "LINKLOCAL") == 0) {
+ expand_linklocal_rdnss_address(ifi);
+ }
+
ELM_MALLOC(rdna, goto getconfig_free_rdn);
if (inet_pton(AF_INET6, abuf, &rdna->ra_dns) != 1) {
syslog(LOG_ERR, "<%s> inet_pton failed for %s",
diff --git a/usr.sbin/rtadvd/rtadvd.conf.5 b/usr.sbin/rtadvd/rtadvd.conf.5
--- a/usr.sbin/rtadvd/rtadvd.conf.5
+++ b/usr.sbin/rtadvd/rtadvd.conf.5
@@ -378,6 +378,8 @@
(str) The IPv6 address of one or more recursive DNS servers.
The argument must be inside double quotes.
Multiple DNS servers can be specified in a comma-separated string.
+The keyword LINKLOCAL will be replaced by the interface's
+link-local address.
If different lifetimes are needed for different servers,
separate entries can be given by using
.Cm rdnss ,

File Metadata

Mime Type
text/plain
Expires
Sun, Aug 9, 8:14 PM (4 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
36356997
Default Alt Text
D51292.id160176.diff (2 KB)

Event Timeline